Skip to content

Commit 9a2ff49

Browse files
committed
Add CI/CD tests to the repository using github actions
This pipeline is triggered if any pushes occur on master or develop OR if a PR is labeled with an appropriate tag as specified by the tests within this workflow. Additionally, a specific label to trigger all tests can be used that will be removed from the PR when all tests finish, regardless of exit status. The pipeline makes extensive use of the reusable test_workflow.yml to instantiate tests on runners. This pipeline currently only includes the definition for one test to be run on a github runner with tags that satisfy "derecho". Likewise, other hard-coded values appearing in here assume a particular runner setup and environment.
1 parent dcfef97 commit 9a2ff49

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Regression Suite
2+
run-name : ${{ github.event_name == 'push' && 'CI' || github.event.label.name }} (${{ github.event_name }})
3+
4+
on:
5+
push:
6+
branches: [ master, develop ]
7+
pull_request:
8+
types: [ labeled ]
9+
10+
11+
# Write our tests out this way for easier legibility
12+
# testsSet :
13+
# - key : value
14+
# key : value
15+
# tests :
16+
# - value
17+
# - value
18+
# - < next test >
19+
# https://stackoverflow.com/a/68940067
20+
jobs:
21+
buildtests:
22+
if : ${{ github.event.label.name == 'compile-tests' || github.event.label.name == 'all-tests' || github.event_name == 'push' }}
23+
strategy:
24+
max-parallel: 4
25+
fail-fast: false
26+
matrix:
27+
28+
testSet :
29+
- host : derecho
30+
archive : /glade/work/aislas/github/runners/mpas/derecho/logs/
31+
account : NMMM0012
32+
name : "Make Compilation Tests"
33+
id : make-tests
34+
fileroot : mpas_compilation
35+
args : -j='{"node_select":{"-l ":{"select":1}}}'
36+
pool : 8
37+
tpool : 1
38+
mkdirs : true
39+
tests :
40+
- make-gnu
41+
# add new compilation tests here
42+
43+
uses : ./.github/workflows/test_workflow.yml
44+
with :
45+
# This should be the only hard-coded value, we don't use ${{ github.event.label.name }}
46+
# to avoid 'all-tests' to be used in this workflow
47+
label : compile-tests
48+
49+
# Everything below this should remain the same and comes from the testSet matrix
50+
archive : ${{ matrix.testSet.archive }}
51+
name : ${{ matrix.testSet.name }}
52+
id : ${{ matrix.testSet.id }}
53+
host : ${{ matrix.testSet.host }}
54+
fileroot : ${{ matrix.testSet.fileroot }}
55+
account : ${{ matrix.testSet.account }}
56+
tests : ${{ toJson( matrix.testSet.tests ) }}
57+
mkdirs : ${{ matrix.testSet.mkdirs }}
58+
args : ${{ matrix.testSet.args }}
59+
pool : ${{ matrix.testSet.pool }}
60+
tpool : ${{ matrix.testSet.tpool }}
61+
permissions:
62+
contents: read
63+
pull-requests: write
64+
name : Test ${{ matrix.testSet.name }} on ${{ matrix.testSet.host }}
65+
66+
# In the event that 'all-tests' is used, this final job will be the one to remove
67+
# the label from the PR
68+
removeAllLabel :
69+
if : ${{ !cancelled() && github.event.label.name == 'all-tests' }}
70+
name : Remove 'all-tests' label
71+
runs-on: ubuntu-latest
72+
needs : [ buildtests ] # Put tests here to make this wait for the tests to complete
73+
steps:
74+
- name : Remove '${{ github.event.label.name }}' label
75+
env:
76+
PR_NUMBER: ${{ github.event.number }}
77+
run: |
78+
curl \
79+
-X DELETE \
80+
-H "Accept: application/vnd.github.v3+json" \
81+
-H 'Authorization: token ${{ github.token }}' \
82+
https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels/${{ github.event.label.name }}

0 commit comments

Comments
 (0)