Skip to content

Commit 7a0f81f

Browse files
authored
Merge pull request #3061 from E3SM-Project/bartgol/ghci/eamxx-testing
Add workflow files for eamxx standalone and v1 testing
2 parents e0746bf + cff9601 commit 7a0f81f

File tree

5 files changed

+470
-0
lines changed

5 files changed

+470
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Composite action to call test-all-scream inside a workflow
2+
3+
This action is meant to be used inside a workflow. E.g.,
4+
5+
```yaml
6+
jobs:
7+
my-testing:
8+
steps:
9+
...
10+
- name: run-test-all-scream
11+
uses: ./.github/actions/eamxx-test-all-scream
12+
with:
13+
build_type: <build-type>
14+
machine: <machine>
15+
run_type: <run-type>
16+
```
17+
18+
The input run_type is the only input that this action has to explicitly handle.
19+
As such, this action checks that its value is one of the following.
20+
21+
- nightly: runs tests and then submit to cdash
22+
- at-run: runs tests without submitting to cdash
23+
- bless: runs tests and copy output files to baselines folder
24+
25+
As for build_type and machine, we do not prescribe a list of
26+
valid values, as that will be handled by components/eamxx/scripts/test-all-scream.
27+
If their values are not supported, it is up to test-all-scram to handle the error.
28+
As a guideline, however, you may have to ensure that the following exist:
29+
30+
- the file components/eamxx/cmake/machine-files/${machine}.cmake
31+
- the entry ${machine} in the MACHINE_METADATA dict in components/eamxx/scripts/machine_specs.py
32+
33+
Questions? Contact Luca Bertagna [lbertag@sandia.gov](mailto:lbertag@sandia.gov)
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: EAMxx standalone testing
2+
description: |
3+
Run EAMxx standalone testing with required configuration inputs.
4+
More precisely, it launches test-all-scream with the proper flags.
5+
See components/eamxx/scripts/test-all-scream for more details.
6+
The configuration inputs are:
7+
- build_type: the type of build to pass to test-all-scream.
8+
- machine: the name of the machine to pass to test-all-scream
9+
- generate: whether to generate baselines
10+
- submit: whether to submit to cdash (unused if generate is 'true')
11+
12+
inputs:
13+
build_type:
14+
description: 'Build type to run'
15+
required: true
16+
machine:
17+
description: 'Machine name for test-all-scream'
18+
required: true
19+
generate:
20+
description: 'Generate baselines instead of running tests'
21+
required: true
22+
default: 'false'
23+
valid_values:
24+
- 'true'
25+
- 'false'
26+
submit:
27+
description: 'Submit results to cdash (unused if generate=true)'
28+
required: true
29+
default: 'false'
30+
valid_values:
31+
- 'true'
32+
- 'false'
33+
cmake-configs:
34+
description: 'Semicolon-separated list of key=value pairs for CMake to pass to test-all-scream'
35+
required: false
36+
default: ''
37+
38+
runs:
39+
using: "composite"
40+
steps:
41+
- name: Set CA certificates env var
42+
run: |
43+
# Ensure the operating system is Linux
44+
if [ "$(uname)" != "Linux" ]; then
45+
echo "This action only supports Linux."
46+
exit 1
47+
fi
48+
# Set env var to be used in upload-artifacts phase
49+
if [ -f /etc/debian_version ]; then
50+
echo "NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt" >> $GITHUB_ENV
51+
elif [ -f /etc/redhat-release ] || [ -f /etc/centos-release ] || [ -f /etc/fedora-release ]; then
52+
echo "NODE_EXTRA_CA_CERTS=/etc/pki/tls/certs/ca-bundle.crt" >> $GITHUB_ENV
53+
else
54+
echo "Unsupported Linux distribution"
55+
exit 1
56+
fi
57+
shell: sh
58+
- name: Check repo presence
59+
run: |
60+
if [ ! -d ".git" ]; then
61+
echo "Repository is not checked out. Please ensure the repository is checked out before running this action."
62+
exit 1
63+
fi
64+
shell: sh
65+
- name: Print build specs
66+
run: |
67+
echo "Testing EAMxx standalone, for the following configuration:"
68+
echo " build type : ${{ inputs.build_type }}"
69+
echo " machine : ${{ inputs.machine }}"
70+
echo " generate : ${{ inputs.generate }}"
71+
echo " submit : ${{ inputs.submit }}"
72+
echo " cmake-configs: ${{ inputs.cmake-configs }}"
73+
shell: sh
74+
- name: Run test-all-scream
75+
working-directory: components/eamxx
76+
run: |
77+
cmd="./scripts/test-all-scream -m ${{ inputs.machine }} -t ${{inputs.build_type}} --baseline-dir AUTO -c EKAT_DISABLE_TPL_WARNINGS=ON"
78+
if [ "${{ inputs.generate }}" = "true" ]; then
79+
cmd+=" -g"
80+
elif [ "${{ inputs.submit }}" = "true" ]; then
81+
cmd+=" -s"
82+
fi
83+
84+
# If cmake-configs is non-empty, add tokens to test-all-scream via "-c key=val"
85+
IFS=';' read -ra configs <<< "${{ inputs.cmake-configs }}"
86+
for config in "${configs[@]}"; do
87+
cmd+=" -c $config"
88+
done
89+
90+
# Print the full command, then run it
91+
echo "test-all-scream call: $cmd"
92+
$cmd
93+
shell: sh
94+
- name: Upload ctest logs
95+
if: always()
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: log-files-${{ inputs.build_type }}
99+
path: |
100+
components/eamxx/ctest-build/*/Testing/Temporary/Last*.log
101+
components/eamxx/ctest-build/*/ctest_resource_file.json
102+
components/eamxx/ctest-build/*/CMakeCache.txt
103+
env:
104+
NODE_EXTRA_CA_CERTS: ${{ env.NODE_EXTRA_CA_CERTS }}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: EAMxx scripts testing
2+
3+
on:
4+
# Runs on PRs against master, but only if they touch eamxx scripts
5+
pull_request:
6+
branches: [ master ]
7+
types: [opened, synchronize, ready_for_review, reopened]
8+
paths:
9+
- components/eamxx/scripts
10+
- components/eamxx/cime_config/*.py
11+
12+
# Manual run for debug purposes only
13+
workflow_dispatch:
14+
15+
# Add schedule trigger for nightly runs at midnight MT (Standard Time)
16+
# schedule:
17+
# - cron: '0 7 * * *' # Runs at 7 AM UTC, which is midnight MT during Standard Time
18+
19+
concurrency:
20+
# Two runs are in the same group if:
21+
# - they have the same trigger
22+
# - if trigger=pull_request, the PR number must match
23+
# - if trigger=workflow_dispatch, the inputs are the same
24+
group: ${{ github.workflow }}-${{ github.event_name }}-${{
25+
github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id
26+
}}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
cpu-gcc:
31+
runs-on: [self-hosted, gcc, ghci-snl-cpu]
32+
# Run this workflow if:
33+
# - workflow_dispatch: user requested this job.
34+
# - schedule: always:
35+
# - pull_request: matching skip label is NOT found
36+
if: |
37+
${{
38+
github.event_name == 'schedule' ||
39+
github.event_name == 'workflow_dispatch' ||
40+
(
41+
github.event_name == 'pull_request' &&
42+
!(
43+
contains(github.event.pull_request.labels.*.name, 'AT: skip all')
44+
)
45+
)
46+
}}
47+
steps:
48+
- name: Show action trigger
49+
uses: actions/github-script@v7
50+
with:
51+
script: |
52+
const eventName = context.eventName;
53+
const eventAction = context.payload.action || 'N/A';
54+
const actor = context.actor;
55+
console.log(`The job was triggered by a ${eventName} event.`);
56+
console.log(` - Event action: ${eventAction}`);
57+
console.log(` - Triggered by: ${actor}`);
58+
- name: Check out the repository
59+
uses: actions/checkout@v4
60+
with:
61+
persist-credentials: false
62+
show-progress: false
63+
submodules: recursive
64+
- name: Run test
65+
run: |
66+
cd components/eamxx
67+
if [ ${{ github.event_name == 'schedule' }} ]; then
68+
./scripts/scripts-ctest-driver -s -m ghci-snl-cpu
69+
else
70+
./scripts/scripts-tests -f -m ghci-snl-cpu
71+
./scripts/cime-nml-tests
72+
fi
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: EAMxx standalone testing
2+
3+
on:
4+
# Runs on PRs against master
5+
pull_request:
6+
branches: [ master ]
7+
types: [opened, synchronize, ready_for_review, reopened]
8+
paths:
9+
- components/eamxx
10+
- components/eam/src/physics/rrtmgp
11+
- components/eam/src/physics/p3/scream
12+
- components/eam/src/physics/cam
13+
14+
# Manual run is used to bless
15+
workflow_dispatch:
16+
inputs:
17+
jobs_list:
18+
description: 'Job to run'
19+
required: true
20+
type: choice
21+
options:
22+
- gcc-openmp
23+
bless:
24+
description: 'Generate baselines'
25+
required: true
26+
type: boolean
27+
28+
# Add schedule trigger for nightly runs at midnight MT (Standard Time)
29+
# schedule:
30+
# - cron: '0 7 * * *' # Runs at 7 AM UTC, which is midnight MT during Standard Time
31+
32+
concurrency:
33+
# Two runs are in the same group if:
34+
# - they have the same trigger
35+
# - if trigger=pull_request, the PR number must match
36+
# - if trigger=workflow_dispatch, the inputs are the same
37+
group: ${{ github.workflow }}-${{ github.event_name }}-${{
38+
github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id
39+
}}
40+
cancel-in-progress: true
41+
42+
jobs:
43+
gcc-openmp:
44+
runs-on: [self-hosted, ghci-snl-cpu, gcc]
45+
strategy:
46+
fail-fast: true
47+
matrix:
48+
build_type: [sp, dbg, fpe, opt]
49+
# Run this workflow if:
50+
# - workflow_dispatch: user requested this job.
51+
# - schedule: always:
52+
# - pull_request: matching skip label is NOT found
53+
if: |
54+
${{
55+
github.event_name == 'schedule' ||
56+
( github.event_name == 'workflow_dispatch' && github.event.inputs.jobs_list == 'gcc-openmp' ) ||
57+
(
58+
github.event_name == 'pull_request' &&
59+
!(
60+
contains(github.event.pull_request.labels.*.name, 'AT: skip gcc') ||
61+
contains(github.event.pull_request.labels.*.name, 'AT: skip openmp') ||
62+
contains(github.event.pull_request.labels.*.name, 'AT: skip eamxx-standalone') ||
63+
contains(github.event.pull_request.labels.*.name, 'AT: skip all')
64+
)
65+
)
66+
}}
67+
name: gcc-openmp-${{ matrix.build_type }}
68+
steps:
69+
- name: Show action trigger
70+
uses: actions/github-script@v7
71+
with:
72+
script: |
73+
const eventName = context.eventName;
74+
const eventAction = context.payload.action || 'N/A';
75+
const actor = context.actor;
76+
console.log(`The job was triggered by a ${eventName} event.`);
77+
console.log(` - Event action: ${eventAction}`);
78+
console.log(` - Triggered by: ${actor}`);
79+
- name: Check out the repository
80+
uses: actions/checkout@v4
81+
with:
82+
persist-credentials: false
83+
show-progress: false
84+
submodules: recursive
85+
- name: Set test-all inputs based on event specs
86+
run: |
87+
echo "submit=false" >> $GITHUB_ENV
88+
echo "generate=false" >> $GITHUB_ENV
89+
if [ "${{ github.event_name }}" == "schedule" ]; then
90+
echo "submit=true" >> $GITHUB_ENV
91+
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
92+
if [ "${{ inputs.bless }}" == "true" ]; then
93+
echo "generate=true" >> $GITHUB_ENV
94+
fi
95+
fi
96+
- name: Run tests
97+
uses: ./.github/actions/test-all-scream
98+
with:
99+
build_type: ${{ matrix.build_type }}
100+
machine: ghci-snl-cpu
101+
generate: ${{ env.generate }}
102+
submit: ${{ env.submit }}
103+
cmake-configs: Kokkos_ENABLE_OPENMP=ON
104+
# cuda:
105+
# # Disable until the CUDA container is up and running. When CUDA container is availabe, remove
106+
# # this line and uncomment the next if
107+
# if: false
108+
# # Runs always for pull_request. For workflow_dispatch, user must request this machine
109+
# # if: ${{ github.event_name == 'pull_request' || contains(github.event.inputs.jobs_to_run, 'openmp-gcc') }}
110+
# runs-on: [self-hosted, cuda]
111+
# strategy:
112+
# fail-fast: false
113+
# matrix:
114+
# build_type: [sp, dbg, fpe, opt]
115+
# name: cuda-${{ matrix.build_type }}
116+
# steps:
117+
# - name: Show action trigger
118+
# uses: ./.github/actions/print-workflow-trigger
119+
# - name: Check out the repository
120+
# uses: actions/checkout@v4
121+
# with:
122+
# persist-credentials: false
123+
# show-progress: false
124+
# submodules: recursive
125+
# - name: Run tests
126+
# uses: ./.github/actions/test-all-scream
127+
# with:
128+
# build_type: ${{ matrix.build_type }}
129+
# machine: ghci-snl-cuda
130+
# run_type: at-run

0 commit comments

Comments
 (0)