forked from wrf-model/WRF
-
Notifications
You must be signed in to change notification settings - Fork 0
262 lines (240 loc) · 9.27 KB
/
ci.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
name: Regression Suite
run-name : Run ${{ inputs.event_name == 'push' && 'CI' || inputs.test }} (${{ inputs.event_name }})
on:
workflow_dispatch:
inputs:
event_name:
description: Event name that triggered this dispatch
required: false
default: push
type: string
event_number:
description: Event number that triggered this dispatch
required: false
default: 0
type: string
ref:
description: Actual ref to use
required: false
default: null
type: string
test:
description: Test to run
required: true
default: all-tests
type: choice
options:
- all-tests
- compile-tests
- tmp-tests
# https://docs.github.com/en/actions/sharing-automations/reusing-workflows#supported-keywords-for-jobs-that-call-a-reusable-workflow
# Also https://stackoverflow.com/a/74959635
# TL;DR - For public repositories the safest approach will be to use the default read permissions, but at the cost
# of not being able to modify the labels. That will need to be a separate [trusted] workflow that runs from the base repo
# permissions :
# contents : read
# pull-requests : write
# Write our tests out this way for easier legibility
# testsSet :
# - key : value
# key : value
# tests :
# - value
# - value
# - < next test >
# https://stackoverflow.com/a/68940067
jobs:
buildtests:
if : ${{ contains( fromJson('["compile-tests","all-tests"]'), inputs.test ) || inputs.event_name == 'push' }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
testSet :
- host : derecho
hpc-workflows_path : .ci/hpc-workflows
archive : /glade/work/aislas/github/runners/wrf/derecho/logs/
account : NMMM0012
name : "Make Compilation Tests"
id : make-tests
fileroot : wrf_compilation_tests-make
args : -j='{"node_select":{"-l ":{"select":1}}}'
pool : 8
tpool : 1
mkdirs : true
tests :
- make-gnu-serial
- make-gnu-sm
- make-gnu-dm
- make-gnu-dm+sm
- make-intel-classic-serial
- make-intel-classic-sm
- make-intel-classic-dm
- make-intel-classic-dm+sm
- make-intel-llvm-serial
- make-intel-llvm-sm
- make-intel-llvm-dm
- make-intel-llvm-dm+sm
- make-pgi-serial
- make-pgi-sm
- make-pgi-dm
- make-pgi-dm+sm
# add new compilation tests here
- host : derecho
hpc-workflows_path : .ci/hpc-workflows
archive : /glade/work/aislas/github/runners/wrf/derecho/logs/
account : NMMM0012
name : "CMake Compilation Tests"
id : cmake-tests
fileroot : wrf_compilation_tests-cmake
args : -j='{"node_select":{"-l ":{"select":1}}}'
pool : 8
tpool : 1
mkdirs : false
tests :
- cmake-gnu-serial
- cmake-gnu-sm
- cmake-gnu-dm
- cmake-gnu-dm+sm
- cmake-intel-classic-serial
- cmake-intel-classic-sm
- cmake-intel-classic-dm
- cmake-intel-classic-dm+sm
- cmake-intel-llvm-serial
- cmake-intel-llvm-sm
- cmake-intel-llvm-dm
- cmake-intel-llvm-dm+sm
- cmake-pgi-serial
- cmake-pgi-sm
- cmake-pgi-dm
- cmake-pgi-dm+sm
# add new compilation tests here
uses : ./.github/workflows/test_workflow.yml
with :
# This should be the only hard-coded value, we don't use ${{ github.event.label.name }}
# to avoid 'all-tests' to be used in this workflow
label : compile-tests
# Everything below this should remain the same and comes from the testSet matrix
hpc-workflows_path : ${{ matrix.testSet.hpc-workflows_path }}
archive : ${{ matrix.testSet.archive }}
name : ${{ matrix.testSet.name }}
id : ${{ matrix.testSet.id }}
host : ${{ matrix.testSet.host }}
fileroot : ${{ matrix.testSet.fileroot }}
account : ${{ matrix.testSet.account }}
tests : ${{ toJson( matrix.testSet.tests ) }}
mkdirs : ${{ matrix.testSet.mkdirs }}
args : ${{ matrix.testSet.args }}
pool : ${{ matrix.testSet.pool }}
tpool : ${{ matrix.testSet.tpool }}
# required to emulate event trigger
event_name : ${{ inputs.event_name }}
event_number : ${{ inputs.event_number }}
ref : ${{ inputs.ref }}
# I am leaving this here for posterity if this is to be replicated in private repositories for testing
permissions:
contents: read
pull-requests: write
name : Test ${{ matrix.testSet.name }} on ${{ matrix.testSet.host }}
tmp_tests:
if : ${{ contains( fromJson('["tmp-tests","all-tests"]'), inputs.test ) || inputs.event_name == 'push' }}
name: Temp test
runs-on: ubuntu-latest
permissions:
checks: write
steps:
# Don't use gh checks as they are woefully underdeveloped as a feature leading
# to confusing UI and misplaced metrics
# https://github.com/orgs/community/discussions/24616
- name: Set pending status
id: check_run_start
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
target_url: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}',
description: 'dummy',
context: '${{ inputs.test }}',
state: 'pending'
})
# const checks = await github.rest.checks.listForRef({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: context.sha,
# check_name : '${{ inputs.test }}'
# })
# core.info( JSON.stringify( checks ) )
# if ( checks.data.total_count > 0 )
# {
# await core.info( "Check run already exists, updating..." )
# github.rest.checks.update({
# owner: context.repo.owner,
# repo: context.repo.repo,
# check_run_id: checks.check_runs[0].id,
# status:'in_progress',
# details_url: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
# })
# return checks.check_runs[0].id
# }
# else
# {
# core.info( "Check run dose not exist, creating..." )
# response = await github.rest.checks.create({
# owner: context.repo.owner,
# repo: context.repo.repo,
# head_sha: context.sha,
# name: '${{ inputs.test }}',
# status: 'in_progress',
# details_url: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
# })
# core.info( JSON.stringify( response ) )
# return response.data.id
# }
- name: dummy
id: dummy
run: |
echo "Hello World!"
sleep 5
- name: Set completed status
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
target_url: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}',
description: 'dummy',
context: '${{ inputs.test }}',
state: '${{ contains( fromJson('["success","failure","error"]'),steps.dummy.outcome ) && steps.dummy.outcome || error }}'
})
# github.rest.checks.update({
# owner: context.repo.owner,
# repo: context.repo.repo,
# check_run_id: ${{ steps.check_run_start.outputs.result }},
# status: 'completed',
# details_url: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}',
# conclusion: "${{ steps.dummy.outcome }}"
# })
# # In the event that 'all-tests' is used, this final job will be the one to remove
# # the label from the PR
# removeAllLabel :
# if : ${{ !cancelled() && github.event.label.name == 'all-tests' }}
# name : Remove 'all-tests' label
# runs-on: ubuntu-latest
# needs : [ buildtests ] # Put tests here to make this wait for the tests to complete
# steps:
# - name : Remove '${{ github.event.label.name }}' label
# env:
# PR_NUMBER: ${{ github.event.number }}
# run: |
# curl \
# -X DELETE \
# -H "Accept: application/vnd.github.v3+json" \
# -H 'Authorization: token ${{ github.token }}' \
# https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels/${{ github.event.label.name }}