-
Notifications
You must be signed in to change notification settings - Fork 5
104 lines (93 loc) · 4.6 KB
/
build-all.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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_version: ${{steps.get_version.outputs.mosul_artifact_version}}
msf_mosul_artifact_id: ${{steps.get_artifactId.outputs.mosul_artifact_id}}
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: Build and Test
run: mvn --batch-mode --update-snapshots --activate-profiles validator clean package
- name: Get MSF Mosul version
working-directory: "${{ github.workspace }}/sites/mosul"
id: get_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "mosul_artifact_version=$VERSION" >> $GITHUB_OUTPUT
- name: Get MSF Mosul artifactId
working-directory: "${{ github.workspace }}/sites/mosul"
id: get_artifactId
run: |
ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)
echo "mosul_artifact_id=$ARTIFACT_ID" >> $GITHUB_OUTPUT
- 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 }}"
- name: cache Mosul artifact for future use
if: ${{ github.event_name != 'push' }}
uses: actions/cache@v4
with:
path: ./sites/mosul/target/${{ steps.get_artifactId.outputs.mosul_artifact_id }}-${{ steps.get_version.outputs.mosul_artifact_version }}.zip
key: ${{ github.sha }}
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 }}/distro/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 && ./start-demo.sh"
test-artifact-cache-path: ./sites/mosul/target/${{ needs.build-and-publish.outputs.msf_mosul_artifact_id }}-${{ needs.build-and-publish.outputs.msf_mosul_artifact_version }}.zip
test-artifact-cache-name: "${{ needs.build-and-publish.outputs.msf_mosul_artifact_id }}-${{ needs.build-and-publish.outputs.msf_mosul_artifact_version }}"
needs: build-and-publish
if: ${{ github.event_name != 'push' }}