LIME2-270: create automated e2e tests on push or PR to Mosul #62
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build all configurations and deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN: ${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN }} | |
jobs: | |
build-and-publish: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ '8' ] | |
outputs: | |
msf_mosul_artifact_id: ${{steps.get_artifactId.outputs.mosul_artifact_id}} | |
msf_mosul_artifact_version: ${{steps.get_version.outputs.mosul_artifact_version}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'maven' | |
- name: Set settings.xml | |
uses: s4u/maven-settings-action@v3.0.0 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
servers: | | |
[{ | |
"id": "msf-ocg-github-lime-emr", | |
"username": "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_USERNAME }}", | |
"password": "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN }}" | |
}] | |
- name: Get MSF Mosul version | |
working-directory: "${{ github.workspace }}/sites/mosul" | |
id: get_version | |
run: echo "mosul_artifact_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
- name: Get MSF Mosul artifactId | |
working-directory: "${{ github.workspace }}/sites/mosul" | |
id: get_artifactId | |
run: echo "mosul_artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV | |
- name: Build and Test | |
run: mvn --batch-mode --update-snapshots --activate-profiles validator clean package | |
- name: Publish MSF Mosul artifacts to GitHub | |
uses: ./.github/actions/upload-maven-artifacts | |
if: ${{ github.event_name == 'push' }} | |
with: | |
artifact-name: "Mosul" | |
artifact-path: "${{ github.workspace }}/sites/mosul" | |
maven-server-username: "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_USERNAME }}" | |
maven-server-token: "${{ secrets.MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN }}" | |
run-e2e-on-push: | |
uses: ./.github/workflows/run-e2e-tests.yml | |
with: | |
frontend-container-name: "ozone-frontend-1" | |
backend-container-name: "ozone-openmrs-1" | |
gateway-container-name: "ozone-proxy-1" | |
database-container-name: "ozone-mysql-1" | |
frontend-config-file-path: "./emr/mosul/${{ needs.build-and-publish.outputs.msf_mosul_artifact_id }}-${{ needs.build-and-publish.outputs.msf_mosul_artifact_version }}/binaries/openmrs/frontend/spa-assemble-config.json" | |
start-server-command: "curl -sSL -H 'Cache-Control: no-cache, no-store' -H 'Authorization: token $MAVEN_GITHUB_ACTIONS_DEPLOY_TOKEN' https://raw.githubusercontent.com/MSF-OCG/LIME-EMR-Tooling/dev/Procedures/local_lime_emr.sh | bash -s -- install mosul" | |
needs: build-and-publish | |
if: ${{ github.event_name == 'push' }} | |
run-e2e-on-pull-request: | |
uses: ./.github/workflows/run-e2e-tests.yml | |
with: | |
frontend-container-name: "ozone-frontend-1" | |
backend-container-name: "ozone-openmrs-1" | |
gateway-container-name: "ozone-proxy-1" | |
database-container-name: "ozone-mysql-1" | |
frontend-config-file-path: "./sites/mosul/target/${{ needs.build-and-publish.outputs.msf_mosul_artifact_id }}-${{ needs.build-and-publish.outputs.msf_mosul_artifact_version }}/binaries/openmrs/frontend/spa-assemble-config.json" | |
start-server-command: "cd ./sites/mosul/target/${{ needs.build-and-publish.outputs.msf_mosul_artifact_id }}-${{ needs.build-and-publish.outputs.msf_mosul_artifact_version }}/run/docker/scripts" | |
should-delete-artifacts: false | |
needs: build-and-publish | |
if: ${{ github.event_name != 'push' }} |