Switching to matrix job creation #27
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
name: Regression Suite | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
types: [ labeled ] | ||
jobs: | ||
buildtests: | ||
if : ${{ github.event.label.name == 'test' }} || ${{ github.event_name == 'push' }} | ||
strategy: | ||
max-parallel: 4 | ||
fail-fast: false | ||
matrix: | ||
# # Write our tests out this way for easier legibility | ||
# test : | ||
# - | ||
# - | ||
# - | ||
# - | ||
# - | ||
# - | ||
# Specify accounts specific to each HPC resource | ||
# https://stackoverflow.com/a/68940067 | ||
testSet : | ||
- { | ||
host : wsl, | ||
account : None, | ||
name : "Compilation Tests", | ||
file : wrf_arw_tests.json, | ||
args : -m "TEST CompilationSet PASS", | ||
pool : 1, | ||
tests : [ | ||
gnu-nompi, gnu-mpi, intel-nompi, intel-mpi, pgi-nompi, pgi-mpi | ||
] | ||
} | ||
# - { | ||
# host : cheyenne, | ||
# account : NMMM0012, | ||
# name : "Compilation Tests", | ||
# file : wrf_arw_tests.json, | ||
# args : -j="-l select=1" -m "TEST CompilationSet PASS", | ||
# pool : 6, | ||
# tests : [ | ||
# gnu-nompi, gnu-mpi, intel-nompi, intel-mpi, pgi-nompi, pgi-mpi | ||
# ] | ||
# } | ||
# - { | ||
# host : cheyenne, | ||
# account : NMMM0012, | ||
# name : "em_real, A-H Tests", | ||
# file : wrf_em_real_tests.json, | ||
# args : -j="-l select=1" -m "TEST em_realSet PASS", | ||
# pool : 6, | ||
# tests : [ | ||
# em_real0, em_real1, em_realA, em_realB, em_realC, em_realD, em_realE, em_realF, em_realG | ||
# ] | ||
# } | ||
# Is 5 days a reasonable wait time for testing? | ||
timeout-minutes: 7200 | ||
name: Test ${{ matrix.testSet.name }} on ${{ matrix.testSet.host }} | ||
runs-on: ${{ matrix.testSet.host }} | ||
permissions: | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
# Immediately copy out to # of tests to do | ||
- name: Create testing directories | ||
id : cpTestDirs | ||
run : | | ||
echo "${{ join( matrix.testSet.tests, ' ' )}}" | ||
- name: Test ${{ matrix.testSet.name }} | ||
id : runTest | ||
run: | | ||
Check failure on line 79 in .github/workflows/ci.yml GitHub Actions / Regression SuiteInvalid workflow file
|
||
./hpc-workflows/.ci/runner.py \ | ||
.ci/${{ matrix.testSet.file }} \ | ||
-t ${{ join( matrix.testSet.tests, ' ' }} \ | ||
-d .. \ | ||
-a "${{ matrix.testSet.account }}" \ | ||
-p ${{ matrix.testSet.pool}} \ | ||
${{ matrix.testSet.args }} | ||
- name: Print failed steps | ||
if : ${{ failure() }} | ||
run : | | ||
import json | ||
import os | ||
def dumpFile( filename, bannerMsg="" ) : | ||
print( "\n{msg}\n{banner}".format( msg=bannerMsg, banner="!" * 50 ) ) | ||
with open( filename, 'r') as f: | ||
print( f.read() ) | ||
print( "!" * 50 ) | ||
masterLog = "./{0}.log".format( os.path.splitext( "${{ matrix.testSet.file }}" )[0] ) | ||
fp = open( masterLog ) | ||
logs = json.load( fp ) | ||
print( "Finding tests that failed..." ) | ||
for test, testlog in logs.items() : | ||
if not testlog["success"] : | ||
print( "Test {test} failed, printing stdout".format( test=test ) ) | ||
dumpFile( testlog["message"], bannerMsg="STDOUT FOR TEST {test}".format( test=test ) ) | ||
print( "Finding logs for steps that failed..." ) | ||
for step, steplog in testlog["steps"].items() : | ||
if not steplog["success"] : | ||
print( "Step {step} failed, printing stdout".format( step=step ) ) | ||
dumpFile( steplog["logfile"], bannerMsg="STDOUT FOR STEP {step}".format( step=step ) ) | ||
# Exit with bad status so people know where to look since that might be | ||
# an issue as this will look "successful" | ||
raise Exception( "Test did not pass, refer to the above logs" ) | ||
shell: python3 {0} | ||
# Since this a new job, the token should be fine, per the documentation: | ||
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret | ||
removelabel: | ||
runs-on: cheyenne | ||
if : ${{ !cancelled() && github.event.label.name == 'test' }} | ||
name: Remove 'test' label | ||
needs: buildtests | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name : Remove 'test' 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/test | ||