Skip to content

test: appointment unit tests (#122) #358

test: appointment unit tests (#122)

test: appointment unit tests (#122) #358

Workflow file for this run

name: Lint & Test
on:
push:
release:
types: [ created ]
jobs:
lint-and-test:
strategy:
matrix:
platform: [ubuntu-latest]
java-version: [8]
maven: ['3.6.3']
runs-on: ${{ matrix.platform }}
env:
PLATFORM: ${{ matrix.platform }}
JAVA_VERSION: ${{ matrix.java-version }}
# Grant status permission for MULTI_STATUS #
permissions:
contents: write
packages: read
statuses: write
security-events: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: adopt
cache: maven
- name: Setup Maven Action
uses: s4u/[email protected]
with:
java-version: ${{ matrix.java-version }}
maven-version: ${{ matrix.maven }}
# Enable caching dependencies to speed up the build
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Checkout code
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter/[email protected]
env:
VALIDATE_ALL_CODEBASE: true
VALIDATE_JAVA: true
VALIDATE_XML: true
DEFAULT_BRANCH: develop
JAVA_FILE_NAME: checkstyle.xml
- name: Download and Extract SQL Archive
run: |
curl -LJO "https://github.com/savannahghi/kenya-emr-releases/releases/download/v18.6.2/KenyaEMR.Release.Archive.xz"
tar -xf KenyaEMR.Release.Archive.xz
- name: Setup MySQL Server
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "5.6"
- name: Create Database and Restore Data
run: |
mysql -h localhost -uroot -e "CREATE DATABASE IF NOT EXISTS $MYSQL_DATABASE;"
mysql -h localhost -uroot $MYSQL_DATABASE < kenya-emr-release-content/databases/openmrs.sql
env:
MYSQL_DATABASE: openmrs
- name: Download Liquibase 2.0.5
run: |
mkdir -p liquibase
curl -LJO https://github.com/liquibase/liquibase/releases/download/liquibase-parent-2.0.5/liquibase-2.0.5-bin.tar.gz
tar -xzf liquibase-2.0.5-bin.tar.gz -C liquibase
- name: Run Liquibase Migrations
run: |
java -jar liquibase/liquibase.jar \
--classpath=liquibase/liquibase.jar \
--driver=com.mysql.jdbc.Driver \
--url=jdbc:mysql://localhost:3306/$MYSQL_DATABASE \
--username=root \
update \
--changeLogFile=api/src/main/resources/liquibase.xml
env:
MYSQL_DATABASE: openmrs
- name: Cleanup Downloaded Files
run: |
rm -rf kenya-emr-release-content
rm KenyaEMR.Release.Archive.xz
rm -rf liquibase
rm liquibase-2.0.5-bin.tar.gz
- name: Install Dependencies
run: mvn clean install -Dartifact.version=1.0.0 -DskipTests=true -Dmaven.javadoc.skip=true --batch-mode --show-version --file pom.xml
- name: Test and Generate Coverage Report
run: mvn -B verify -P coverage --no-transfer-progress -Dartifact.version=1.0.0 -Ddb.name="openmrs" -Ddb.user="root"
- name: Post Coverage Report to CodeCov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./api/target/site/jacoco/jacoco.xml, ./omod/target/site/jacoco/jacoco.xml
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
release:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
- name: Build Assets
run: mvn clean install --file pom.xml -Dartifact.version=${{ github.event.release.tag_name }} -DskipTests=true
- name: Generate Dependency Graph
run: mvn com.github.ferstl:depgraph-maven-plugin:4.0.2:reactor -DgraphFormat=json -DoutputFileName=reactor.json -Dartifact.version=${{ github.event.release.tag_name }}
- name: Prepare Released Files
run: mkdir -p released-files
working-directory: ${{ github.workspace }}
- name: Copy omod to Released Files
run: cp omod/target/mycarehub-${{ github.event.release.tag_name }}.omod released-files/
working-directory: ${{ github.workspace }}
- name: "✏️ Generate release changelog"
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.RELEASE_PAT }}
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: released-files/mycarehub-${{ github.event.release.tag_name }}.omod
tag_name: ${{ github.event.release.tag_name }}
body_path: CHANGELOG.md
token: ${{ secrets.RELEASE_PAT }}