-
Notifications
You must be signed in to change notification settings - Fork 6
235 lines (201 loc) · 7.32 KB
/
Copy pathtest.yml
File metadata and controls
235 lines (201 loc) · 7.32 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: "Test Workflow"
on:
workflow_call:
inputs:
name:
required: true
type: string
path:
required: true
type: string
jobs:
checkstyle:
name: ${{ inputs.name }} Checkstyle
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Java 21 LTS
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
java-version: 21
distribution: 'temurin'
- name: Execute Checkstyle
run: ./gradlew checkStyleMain checkstyleTest checkstyleIntegrationTest
working-directory: ${{ inputs.path }}
- name: Collect Artifacts
if: always()
run: |
mkdir -p artifacts
cp -r ./${{ inputs.path }}/build/reports ./artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: '${{ inputs.name }} Checkstyle Report'
path: ./artifacts/**
compression-level: 9
- name: Temporary Artifacts Cleanup
run: rm -rf ./artifacts
spotbugs:
name: ${{ inputs.name }} Spotbugs
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Java 21 LTS
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
java-version: 21
distribution: 'temurin'
- name: Execute Spotbugs
run: ./gradlew spotbugsMain spotbugsTest spotbugsIntegrationTest
working-directory: ${{ inputs.path }}
- name: Collect Artifacts
if: always()
run: |
mkdir -p artifacts
cp -r ./${{ inputs.path }}/build/reports ./artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: '${{ inputs.name }} Spotbugs Report'
path: ./artifacts/**
compression-level: 9
- name: Temporary Artifacts Cleanup
run: rm -rf ./artifacts
unit-tests:
name: ${{ inputs.name }} Unit Tests
needs: [ checkstyle, spotbugs ]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Java 21 LTS
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
java-version: 21
distribution: 'temurin'
- name: Execute Unit Tests
run: ./gradlew test --parallel --build-cache
working-directory: ${{ inputs.path }}
- name: Collect Artifacts
if: always()
run: |
mkdir -p artifacts
cp -r ./${{ inputs.path }}/build/reports ./artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: '${{ inputs.name }} Unit Test Report'
path: ./artifacts/**
compression-level: 9
- name: Test Job Summary
if: always()
uses: test-summary/action@37b508cfee6d4d080eedd00b5bb240a6a784a6a5
with:
paths: "${{ inputs.path }}/build/test-results/test/TEST-*.xml"
- name: Temporary Artifacts Cleanup
run: rm -rf ./artifacts
integration_tests:
name: ${{ inputs.name }} Integration Tests
needs: [ checkstyle, spotbugs ]
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
env:
PS_DB_OWNER_NAME: "postgres"
POSTGRES_PASSWORD: "pass_test"
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
distribution: 'temurin'
java-version: '21'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: gp2gp_github_action_build_workflow
aws-region: ${{ secrets.AWS_REGION }}
- name: Retrieve Snomed CT Image
run: |
aws s3 cp s3://snomed-schema/${{ vars.SNOMED_CT_TERMINOLOGY_FILE }} \
./snomed-database-loader/${{ vars.SNOMED_CT_TERMINOLOGY_FILE }}
- name: Setup Required Docker Images
working-directory: ./docker
run: |
source vars.local.tests.sh
docker network create ps-network || true
docker compose -f ./docker-compose.yml up -d ps_db mhs-adaptor-mock activemq gp2gp_translator gpc_facade
- name: Run Migrations
working-directory: ./docker
env:
PS_DB_URL: "jdbc:postgresql://ps_db:5432"
PS_DB_OWNER_NAME: "postgres"
GP2GP_TRANSLATOR_USER_DB_PASSWORD: "pass_test"
GPC_FACADE_USER_DB_PASSWORD: "pass_test"
run: docker compose -f ./docker-compose.yml up db_migration
- name: Populate Database
continue-on-error: true
working-directory: ./snomed-database-loader
env:
PS_DB_HOST: "localhost"
PS_DB_PORT: "5436"
run: ./load_release-postgresql.sh ${{ vars.SNOMED_CT_TERMINOLOGY_FILE }}
- name: Check Immunizations Loaded
working-directory: ./snomed-database-loader
env:
PS_DB_HOST: "localhost"
PS_DB_PORT: "5436"
run: ./test-load-immunization-codes.sh
- name: Execute Integration Tests
working-directory: ${{ inputs.path }}
env:
GPC_FACADE_SERVER_PORT: "8081"
GPC_FACADE_USER_DB_PASSWORD: "pass_test"
GP2GP_TRANSLATOR_USER_DB_PASSWORD: "pass_test"
run: ./gradlew integrationTest
- name: Dump Docker Logs
if: always()
run: |
mkdir -p ./logs
container_names=$(docker ps -a --format '{{.Names}}')
for container in $container_names; do
docker logs "$container" > ./logs/"$container".log
echo "Logs saved for container: $container"
done
working-directory: ./scripts
shell: bash
- name: Collect Artifacts
if: always()
run: |
mkdir -p artifacts
cp -r ./${{ inputs.path }}/build/reports ./artifacts
cp -r ./scripts/logs ./artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: '${{ inputs.name }} Integration Test Report & Docker Logs'
path: ./artifacts/**
compression-level: 9
- name: Test Job Summary
if: always()
uses: test-summary/action@37b508cfee6d4d080eedd00b5bb240a6a784a6a5
with:
paths: "./${{ inputs.path }}/build/test-results/integrationTest/TEST-*.xml"
- name: Stop Docker Dependencies
if: always()
run: |
docker compose down --rmi=local --remove-orphans
docker compose rm
docker network rm ps-network
working-directory: ./docker
- name: Temporary Artifacts Cleanup
run: rm -rf ./artifacts