-
Notifications
You must be signed in to change notification settings - Fork 13
336 lines (290 loc) · 11.4 KB
/
testing.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
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
name: Testing
# Pull or build component images and run one or more test cases
# for pull requests into the main branch
on:
push:
branches:
- main
- feature**
- bugfix**
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
force_build_base:
description: "Build Base Image"
default: false
type: boolean
force_build_wps_wrf:
description: "Build WPS/WRF Image"
default: false
type: boolean
force_build_gsi:
description: "Build GSI Image"
default: false
type: boolean
force_build_upp:
description: "Build UPP Image"
default: false
type: boolean
force_build_python:
description: "Build Python Image"
default: false
type: boolean
force_build_met:
description: "Build MET Image"
default: false
type: boolean
force_build_metviewer:
description: "Build METviewer Image"
default: false
type: boolean
force_run_sandy:
description: "Run Sandy Case"
default: true
type: boolean
jobs:
event_info:
name: "Trigger: ${{ github.event_name }} from ${{ github.actor }}"
runs-on: ubuntu-latest
steps:
- name: Print GitHub values for reference
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
job_control:
name: Determine which jobs to run
runs-on: ubuntu-latest
outputs:
branch_name: ${{ steps.job_status.outputs.branch_name }}
build_base: ${{ steps.job_status.outputs.build_base }}
build_wps_wrf: ${{ steps.job_status.outputs.build_wps_wrf }}
build_gsi: ${{ steps.job_status.outputs.build_gsi }}
build_upp: ${{ steps.job_status.outputs.build_upp }}
build_python: ${{ steps.job_status.outputs.build_python }}
build_met: ${{ steps.job_status.outputs.build_met }}
build_metviewer: ${{ steps.job_status.outputs.build_metviewer }}
run_sandy: ${{ steps.job_status.outputs.run_sandy }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set job controls
id: job_status
run: .github/jobs/set_job_controls.sh
env:
commit_msg: ${{ github.event.head_commit.message }}
reference_sha: ${{ github.event.before }}
force_build_base: ${{ github.event.inputs.force_build_base }}
force_build_wps_wrf: ${{ github.event.inputs.force_build_wps_wrf }}
force_build_gsi: ${{ github.event.inputs.force_build_gsi }}
force_build_upp: ${{ github.event.inputs.force_build_upp }}
force_build_python: ${{ github.event.inputs.force_build_python }}
force_build_met: ${{ github.event.inputs.force_build_met }}
force_build_metviewer: ${{ github.event.inputs.force_build_metviewer }}
force_run_sandy: ${{ github.event.inputs.force_run_sandy }}
- uses: actions/upload-artifact@v2
with:
name: job_control_status
path: job_control_status
build_wps_wrf:
name: Build WPS/WRF Image
runs-on: ubuntu-latest
needs: job_control
steps:
- uses: actions/checkout@v2
- name: Create directory to store logs
run: mkdir -p ${RUNNER_WORKSPACE}/logs
- name: Build and push the WPS/WRF Image, as needed
run: .github/jobs/build_docker_image.sh wps_wrf wps_wrf wps_wrf
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BASE_IMAGE: "dtcenter/base_image:simple"
BUILD_BASE: ${{ needs.job_control.outputs.build_base }}
BUILD_IMAGE: ${{ needs.job_control.outputs.build_wps_wrf }}
- name: Copy Docker build log into logs directory
if: always()
run: cp ${GITHUB_WORKSPACE}/docker_build_wps_wrf.log ${RUNNER_WORKSPACE}/logs/.
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
build_gsi:
name: Build GSI Image
runs-on: ubuntu-latest
needs: job_control
steps:
- uses: actions/checkout@v2
- name: Create directory to store logs
run: mkdir -p ${RUNNER_WORKSPACE}/logs
- name: Build and push the GSI Image, as needed
run: .github/jobs/build_docker_image.sh gsi gsi gsi
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BASE_IMAGE: "dtcenter/base_image:latest"
BUILD_BASE: ${{ needs.job_control.outputs.build_base }}
BUILD_IMAGE: ${{ needs.job_control.outputs.build_gsi }}
- name: Copy Docker build log into logs directory
if: always()
run: cp ${GITHUB_WORKSPACE}/docker_build_gsi.log ${RUNNER_WORKSPACE}/logs/.
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
build_upp:
name: Build UPP Image
runs-on: ubuntu-latest
needs: job_control
steps:
- uses: actions/checkout@v2
- name: Create directory to store logs
run: mkdir -p ${RUNNER_WORKSPACE}/logs
- name: Build and push the UPP Image, as needed
run: .github/jobs/build_docker_image.sh upp upp upp
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BASE_IMAGE: "dtcenter/base_image:latest"
BUILD_BASE: ${{ needs.job_control.outputs.build_base }}
BUILD_IMAGE: ${{ needs.job_control.outputs.build_upp }}
- name: Copy Docker build log into logs directory
if: always()
run: cp ${GITHUB_WORKSPACE}/docker_build_upp.log ${RUNNER_WORKSPACE}/logs/.
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
build_python:
name: Build Python Image
runs-on: ubuntu-latest
needs: job_control
steps:
- uses: actions/checkout@v2
- name: Create directory to store logs
run: mkdir -p ${RUNNER_WORKSPACE}/logs
- name: Build and push the Python Image, as needed
run: .github/jobs/build_docker_image.sh python python python
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BASE_IMAGE: "dtcenter/base_image:simple"
BUILD_BASE: ${{ needs.job_control.outputs.build_base }}
BUILD_IMAGE: ${{ needs.job_control.outputs.build_python }}
- name: Copy Docker build log into logs directory
if: always()
run: cp ${GITHUB_WORKSPACE}/docker_build_python.log ${RUNNER_WORKSPACE}/logs/.
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
build_met:
name: Build MET Image
runs-on: ubuntu-latest
needs: job_control
steps:
- uses: actions/checkout@v2
- name: Create directory to store logs
run: mkdir -p ${RUNNER_WORKSPACE}/logs
- name: Build and push the MET Image, as needed
run: .github/jobs/build_docker_image.sh met nwp-container-met met/MET
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BASE_IMAGE: "dtcenter/base_image:latest"
BUILD_BASE: ${{ needs.job_control.outputs.build_base }}
BUILD_IMAGE: ${{ needs.job_control.outputs.build_met }}
- name: Copy Docker build log into logs directory
if: always()
run: cp ${GITHUB_WORKSPACE}/docker_build_met.log ${RUNNER_WORKSPACE}/logs/.
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
build_metviewer:
name: Build METviewer Image
runs-on: ubuntu-latest
needs: job_control
steps:
- uses: actions/checkout@v2
- name: Create directory to store logs
run: mkdir -p ${RUNNER_WORKSPACE}/logs
- name: Build and push the METviewer Image, as needed
run: .github/jobs/build_docker_image.sh metviewer nwp-container-metviewer metviewer/METviewer
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BASE_IMAGE: "dtcenter/base_image:simple"
BUILD_BASE: ${{ needs.job_control.outputs.build_base }}
BUILD_IMAGE: ${{ needs.job_control.outputs.build_metviewer }}
- name: Copy Docker build log into logs directory
if: always()
run: cp ${GITHUB_WORKSPACE}/docker_build_metviewer.log ${RUNNER_WORKSPACE}/logs/.
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
sandy:
name: Run Sandy
runs-on: ubuntu-latest
needs: [job_control, build_wps_wrf, build_gsi, build_upp, build_python, build_met, build_metviewer]
if: ${{ needs.job_control.outputs.run_sandy == 'true' }}
steps:
- uses: actions/checkout@v2
- name: Create directory to store logs
run: mkdir -p ${RUNNER_WORKSPACE}/logs
- name: Create directory to store output
run: mkdir -p ${RUNNER_WORKSPACE}/output
- name: Run the Sandy case
run: .github/jobs/run_case.sh sandy
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
BUILD_WPS_WRF: ${{ needs.job_control.outputs.build_wps_wrf }}
BUILD_GSI: ${{ needs.job_control.outputs.build_gsi }}
BUILD_UPP: ${{ needs.job_control.outputs.build_upp }}
BUILD_PYTHON: ${{ needs.job_control.outputs.build_python }}
BUILD_MET: ${{ needs.job_control.outputs.build_met }}
BUILD_METVIEWER: ${{ needs.job_control.outputs.build_metviewer }}
- name: Copy the Sandy log into the logs directory
if: always()
run: cp ${GITHUB_WORKSPACE}/run_sandy.log ${RUNNER_WORKSPACE}/logs/.
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
- name: Copy run Sandy output into the output directory
if: always()
run: cp -r ${GITHUB_WORKSPACE}/sandy/pythonprd ${GITHUB_WORKSPACE}/sandy/metprd ${GITHUB_WORKSPACE}/sandy/metviewer ${RUNNER_WORKSPACE}/output/.
- name: Upload output as artifact
uses: actions/upload-artifact@v2
with:
name: sandy
path: ${{ runner.workspace }}/output