-
Notifications
You must be signed in to change notification settings - Fork 24
419 lines (365 loc) · 12.9 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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
name: Testing
# Compile MET for feature branches
# Run unit tests for pull requests
on:
push:
branches:
- develop
- develop-ref
- 'feature_**'
- 'main_v**'
- 'bugfix_**'
paths-ignore:
- 'docs/**'
- '.github/pull_request_template.md'
- '.github/ISSUE_TEMPLATE/**'
- '.github/labels/**'
- '**/README.md'
- '**/LICENSE.md'
pull_request:
types: [opened, reopened, synchronize]
branches:
- develop
- 'main_v**'
paths-ignore:
- 'docs/**'
- '.github/pull_request_template.md'
- '.github/ISSUE_TEMPLATE/**'
- '.github/labels/**'
- '**/README.md'
- '**/LICENSE.md'
workflow_dispatch:
inputs:
force_tests:
description: 'Run the unit tests'
default: true
type: boolean
env:
DOCKERHUB_REPO: dtcenter/met-dev
jobs:
job_control:
name: Determine which jobs to run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set job controls
id: job_status
run: .github/jobs/set_job_controls.sh
env:
commit_msg: ${{ github.event.head_commit.message }}
force_tests: ${{ github.event.inputs.force_tests }}
outputs:
run_compile: ${{ steps.job_status.outputs.run_compile }}
run_push: ${{ steps.job_status.outputs.run_push }}
run_unit_tests: ${{ steps.job_status.outputs.run_unit_tests }}
run_diff: ${{ steps.job_status.outputs.run_diff }}
run_update_truth: ${{ steps.job_status.outputs.run_update_truth }}
met_base_repo: ${{ steps.job_status.outputs.met_base_repo }}
met_base_tag: ${{ steps.job_status.outputs.met_base_tag }}
branch_name: ${{ steps.job_status.outputs.branch_name }}
truth_data_version: ${{ steps.job_status.outputs.truth_data_version }}
input_data_version: ${{ steps.job_status.outputs.input_data_version }}
compile:
name: Compile MET
runs-on: ubuntu-latest
needs: job_control
if: ${{ needs.job_control.outputs.run_compile == 'true' }}
steps:
- uses: actions/checkout@v3
- name: Create directories to store output
run: mkdir -p ${RUNNER_WORKSPACE}/logs
- name: Compile MET in Docker
run: .github/jobs/build_docker_image.sh
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
MET_BASE_REPO: ${{ needs.job_control.outputs.met_base_repo }}
MET_BASE_TAG: ${{ needs.job_control.outputs.met_base_tag }}
- name: Copy Docker build log into logs directory
if: always()
run: cp ${GITHUB_WORKSPACE}/docker_build.log ${RUNNER_WORKSPACE}/logs/
- name: Push Docker Image
run: .github/jobs/push_docker_image.sh
if: ${{ needs.job_control.outputs.run_push == 'true' }}
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
update_input_data:
name: Update input data volumes
runs-on: ubuntu-latest
needs: [job_control]
if: ${{ needs.job_control.outputs.run_unit_tests == 'true' }}
steps:
- uses: dtcenter/metplus-action-data-update@v2
with:
docker_name: ${{ secrets.DOCKER_USERNAME }}
docker_pass: ${{ secrets.DOCKER_PASSWORD }}
repo_name: ${{ github.repository }}
data_prefix: unit_test
branch_name: ${{ needs.job_control.outputs.branch_name }}
docker_data_dir: /data/input/MET_test_data
data_repo_dev: met-data-dev
unit_1a:
name: Unit 1a
runs-on: ubuntu-latest
needs: [job_control, update_input_data, compile]
if: ${{ needs.job_control.outputs.run_unit_tests == 'true' }}
strategy:
matrix:
tests:
- 'ascii2nc'
- 'pb2nc madis2nc pcp_combine'
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Run Unit Tests in Docker
run: .github/jobs/run_unit_docker.sh
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
TESTS: ${{ matrix.tests }}
INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all
- name: Upload output as artifact
uses: actions/upload-artifact@v3
with:
name: unit_1a
path: ${{ runner.workspace }}/output
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
unit_1b:
name: Unit 1b
runs-on: ubuntu-latest
needs: [job_control, update_input_data, compile]
if: ${{ needs.job_control.outputs.run_unit_tests == 'true' }}
strategy:
matrix:
tests:
- 'ascii2nc_indy pb2nc_indy tc_dland tc_pairs tc_stat plot_tc tc_rmw rmw_analysis tc_gen'
- 'met_test_scripts mode_multivar mode_graphics mtd regrid airnow gsi_tools netcdf modis series_analysis gen_ens_prod wwmca_regrid gen_vx_mask grid_weight interp_shape grid_diag grib_tables lidar2nc shift_data_plane trmm2nc aeronet wwmca_plot ioda2nc gaussian'
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Run Unit Tests in Docker
run: .github/jobs/run_unit_docker.sh
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
TESTS: ${{ matrix.tests }}
INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all
- name: Upload output as artifact
uses: actions/upload-artifact@v3
with:
name: unit_1b
path: ${{ runner.workspace }}/output
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
unit_rc_leads:
name: Unit RC leads
runs-on: ubuntu-latest
needs: [job_control, update_input_data, compile]
if: ${{ needs.job_control.outputs.run_unit_tests == 'true' }}
strategy:
matrix:
tests:
- 'ref_config_lead_00 ref_config_lead_12'
- 'ref_config_lead_24 ref_config_lead_48'
- 'ref_config_lead_36'
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Run Unit Tests in Docker
run: .github/jobs/run_unit_docker.sh
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
TESTS: ${{ matrix.tests }}
INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all
- name: Upload output as artifact
uses: actions/upload-artifact@v3
with:
name: unit_rc_leads
path: ${{ runner.workspace }}/output
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
unit_rc:
name: Unit RC
runs-on: ubuntu-latest
needs: [job_control, unit_rc_leads]
if: ${{ needs.job_control.outputs.run_unit_tests == 'true' }}
strategy:
matrix:
tests:
- 'ref_config'
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Download ref_config_leads output from artifact
uses: actions/download-artifact@v3
with:
name: unit_rc_leads
path: ${{ runner.workspace }}/output
- name: Run Unit Tests in Docker
run: .github/jobs/run_unit_docker.sh
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
TESTS: ${{ matrix.tests }}
INPUT_DATA_VERSION: 'none'
- name: Upload output as artifact
uses: actions/upload-artifact@v3
with:
name: unit_rc
path: ${{ runner.workspace }}/output
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
unit_2a:
name: Unit 2a
runs-on: ubuntu-latest
needs: [job_control, unit_1a]
if: ${{ needs.job_control.outputs.run_unit_tests == 'true' }}
strategy:
matrix:
tests:
- 'point_stat stat_analysis_ps'
- 'grid_stat stat_analysis_gs'
- 'wavelet_stat stat_analysis_ws'
- 'ensemble_stat stat_analysis_es'
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Download 1a output from artifact
uses: actions/download-artifact@v3
with:
name: unit_1a
path: ${{ runner.workspace }}/output
- name: Run Unit Tests in Docker
run: .github/jobs/run_unit_docker.sh
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
TESTS: ${{ matrix.tests }}
INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all
- name: Upload output as artifact
uses: actions/upload-artifact@v3
with:
name: unit_2a
path: ${{ runner.workspace }}/output
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
unit_2b:
name: Unit 2b
runs-on: ubuntu-latest
needs: [job_control, unit_1a]
if: ${{ needs.job_control.outputs.run_unit_tests == 'true' }}
strategy:
matrix:
tests:
- 'climatology_1.0deg'
- 'climatology_1.5deg'
- 'climatology_2.5deg'
- 'python point2grid plot_data_plane mode mode_analysis perc_thresh hira plot_point_obs quality_filter obs_summary duplicate_flag'
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Download 1a output from artifact
uses: actions/download-artifact@v3
with:
name: unit_1a
path: ${{ runner.workspace }}/output
- name: Run Unit Tests in Docker
run: .github/jobs/run_unit_docker.sh
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
TESTS: ${{ matrix.tests }}
INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all
- name: Upload output as artifact
uses: actions/upload-artifact@v3
with:
name: unit_2b
path: ${{ runner.workspace }}/output
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
run_diffs:
name: Check for Differences
runs-on: ubuntu-latest
needs: [job_control, unit_1b, unit_2a, unit_2b, unit_rc]
if: ${{ needs.job_control.outputs.run_diff == 'true' }}
steps:
- name: Download data from previous jobs
uses: actions/download-artifact@v3
- name: Copy test output into single directory
run: |
mkdir ${RUNNER_WORKSPACE}/output
cp -r unit_*/* ${RUNNER_WORKSPACE}/output/
- uses: actions/checkout@v3
- name: Run Diff Tests in Docker
run: .github/jobs/run_diff_docker.sh
env:
SOURCE_BRANCH: ${{ needs.job_control.outputs.branch_name }}
RUN_UPDATE_TRUTH: ${{ needs.job_control.outputs.run_update_truth }}
TRUTH_DATA_VERSION: ${{ needs.job_control.outputs.truth_data_version }}
- name: Upload diff files as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: diff
path: ${{ runner.workspace }}/diff
if-no-files-found: ignore
- name: Upload logs as artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: logs
path: ${{ runner.workspace }}/logs
if-no-files-found: ignore
update_truth:
name: Update Truth Data
runs-on: ubuntu-latest
needs: [job_control, unit_1b, unit_2a, unit_2b, unit_rc]
if: ${{ needs.job_control.outputs.run_update_truth == 'true' }}
steps:
- uses: actions/checkout@v3
- name: Download data from previous jobs
uses: actions/download-artifact@v3
- name: Copy test output into single directory
run: |
mkdir ${RUNNER_WORKSPACE}/met_test_truth
cp -r unit_*/* ${RUNNER_WORKSPACE}/met_test_truth/
- name: Create Docker Data Volume
run: .github/jobs/create_docker_truth.sh
env:
TRUTH_DATA_VERSION: ${{ needs.job_control.outputs.truth_data_version }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}