-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Regression Suite | ||
run-name : ${{ github.event_name == 'push' && 'CI' || github.event.label.name }} (${{ github.event_name }}) | ||
|
||
on: | ||
push: | ||
branches: [ master, develop ] | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
|
||
# 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 : ${{ github.event.label.name == 'compile-tests' || github.event.label.name == 'all-tests' || github.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/mpas/derecho/logs/ | ||
account : NMMM0012 | ||
name : "Make Compilation Tests" | ||
id : make-tests | ||
fileroot : mpas_compilation | ||
args : -j='{"node_select":{"-l ":{"select":1}}}' | ||
pool : 8 | ||
tpool : 1 | ||
mkdirs : true | ||
tests : | ||
- make-gnu | ||
# 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 }} | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
name : Test ${{ matrix.testSet.name }} on ${{ matrix.testSet.host }} | ||
|
||
# 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 }} |