Skip to content

Commit

Permalink
Merge pull request #3061 from E3SM-Project/bartgol/ghci/eamxx-testing
Browse files Browse the repository at this point in the history
Add workflow files for eamxx standalone and v1 testing
  • Loading branch information
bartgol authored Oct 25, 2024
2 parents e0746bf + cff9601 commit 7a0f81f
Show file tree
Hide file tree
Showing 5 changed files with 470 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/actions/test-all-scream/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Composite action to call test-all-scream inside a workflow

This action is meant to be used inside a workflow. E.g.,

```yaml
jobs:
my-testing:
steps:
...
- name: run-test-all-scream
uses: ./.github/actions/eamxx-test-all-scream
with:
build_type: <build-type>
machine: <machine>
run_type: <run-type>
```
The input run_type is the only input that this action has to explicitly handle.
As such, this action checks that its value is one of the following.
- nightly: runs tests and then submit to cdash
- at-run: runs tests without submitting to cdash
- bless: runs tests and copy output files to baselines folder
As for build_type and machine, we do not prescribe a list of
valid values, as that will be handled by components/eamxx/scripts/test-all-scream.
If their values are not supported, it is up to test-all-scram to handle the error.
As a guideline, however, you may have to ensure that the following exist:
- the file components/eamxx/cmake/machine-files/${machine}.cmake
- the entry ${machine} in the MACHINE_METADATA dict in components/eamxx/scripts/machine_specs.py
Questions? Contact Luca Bertagna [lbertag@sandia.gov](mailto:lbertag@sandia.gov)
104 changes: 104 additions & 0 deletions .github/actions/test-all-scream/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: EAMxx standalone testing
description: |
Run EAMxx standalone testing with required configuration inputs.
More precisely, it launches test-all-scream with the proper flags.
See components/eamxx/scripts/test-all-scream for more details.
The configuration inputs are:
- build_type: the type of build to pass to test-all-scream.
- machine: the name of the machine to pass to test-all-scream
- generate: whether to generate baselines
- submit: whether to submit to cdash (unused if generate is 'true')
inputs:
build_type:
description: 'Build type to run'
required: true
machine:
description: 'Machine name for test-all-scream'
required: true
generate:
description: 'Generate baselines instead of running tests'
required: true
default: 'false'
valid_values:
- 'true'
- 'false'
submit:
description: 'Submit results to cdash (unused if generate=true)'
required: true
default: 'false'
valid_values:
- 'true'
- 'false'
cmake-configs:
description: 'Semicolon-separated list of key=value pairs for CMake to pass to test-all-scream'
required: false
default: ''

runs:
using: "composite"
steps:
- name: Set CA certificates env var
run: |
# Ensure the operating system is Linux
if [ "$(uname)" != "Linux" ]; then
echo "This action only supports Linux."
exit 1
fi
# Set env var to be used in upload-artifacts phase
if [ -f /etc/debian_version ]; then
echo "NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt" >> $GITHUB_ENV
elif [ -f /etc/redhat-release ] || [ -f /etc/centos-release ] || [ -f /etc/fedora-release ]; then
echo "NODE_EXTRA_CA_CERTS=/etc/pki/tls/certs/ca-bundle.crt" >> $GITHUB_ENV
else
echo "Unsupported Linux distribution"
exit 1
fi
shell: sh
- name: Check repo presence
run: |
if [ ! -d ".git" ]; then
echo "Repository is not checked out. Please ensure the repository is checked out before running this action."
exit 1
fi
shell: sh
- name: Print build specs
run: |
echo "Testing EAMxx standalone, for the following configuration:"
echo " build type : ${{ inputs.build_type }}"
echo " machine : ${{ inputs.machine }}"
echo " generate : ${{ inputs.generate }}"
echo " submit : ${{ inputs.submit }}"
echo " cmake-configs: ${{ inputs.cmake-configs }}"
shell: sh
- name: Run test-all-scream
working-directory: components/eamxx
run: |
cmd="./scripts/test-all-scream -m ${{ inputs.machine }} -t ${{inputs.build_type}} --baseline-dir AUTO -c EKAT_DISABLE_TPL_WARNINGS=ON"
if [ "${{ inputs.generate }}" = "true" ]; then
cmd+=" -g"
elif [ "${{ inputs.submit }}" = "true" ]; then
cmd+=" -s"
fi
# If cmake-configs is non-empty, add tokens to test-all-scream via "-c key=val"
IFS=';' read -ra configs <<< "${{ inputs.cmake-configs }}"
for config in "${configs[@]}"; do
cmd+=" -c $config"
done
# Print the full command, then run it
echo "test-all-scream call: $cmd"
$cmd
shell: sh
- name: Upload ctest logs
if: always()
uses: actions/upload-artifact@v4
with:
name: log-files-${{ inputs.build_type }}
path: |
components/eamxx/ctest-build/*/Testing/Temporary/Last*.log
components/eamxx/ctest-build/*/ctest_resource_file.json
components/eamxx/ctest-build/*/CMakeCache.txt
env:
NODE_EXTRA_CA_CERTS: ${{ env.NODE_EXTRA_CA_CERTS }}
72 changes: 72 additions & 0 deletions .github/workflows/eamxx-scripts-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: EAMxx scripts testing

on:
# Runs on PRs against master, but only if they touch eamxx scripts
pull_request:
branches: [ master ]
types: [opened, synchronize, ready_for_review, reopened]
paths:
- components/eamxx/scripts
- components/eamxx/cime_config/*.py

# Manual run for debug purposes only
workflow_dispatch:

# Add schedule trigger for nightly runs at midnight MT (Standard Time)
# schedule:
# - cron: '0 7 * * *' # Runs at 7 AM UTC, which is midnight MT during Standard Time

concurrency:
# Two runs are in the same group if:
# - they have the same trigger
# - if trigger=pull_request, the PR number must match
# - if trigger=workflow_dispatch, the inputs are the same
group: ${{ github.workflow }}-${{ github.event_name }}-${{
github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id
}}
cancel-in-progress: true

jobs:
cpu-gcc:
runs-on: [self-hosted, gcc, ghci-snl-cpu]
# Run this workflow if:
# - workflow_dispatch: user requested this job.
# - schedule: always:
# - pull_request: matching skip label is NOT found
if: |
${{
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'pull_request' &&
!(
contains(github.event.pull_request.labels.*.name, 'AT: skip all')
)
)
}}
steps:
- name: Show action trigger
uses: actions/github-script@v7
with:
script: |
const eventName = context.eventName;
const eventAction = context.payload.action || 'N/A';
const actor = context.actor;
console.log(`The job was triggered by a ${eventName} event.`);
console.log(` - Event action: ${eventAction}`);
console.log(` - Triggered by: ${actor}`);
- name: Check out the repository
uses: actions/checkout@v4
with:
persist-credentials: false
show-progress: false
submodules: recursive
- name: Run test
run: |
cd components/eamxx
if [ ${{ github.event_name == 'schedule' }} ]; then
./scripts/scripts-ctest-driver -s -m ghci-snl-cpu
else
./scripts/scripts-tests -f -m ghci-snl-cpu
./scripts/cime-nml-tests
fi
130 changes: 130 additions & 0 deletions .github/workflows/eamxx-standalone-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: EAMxx standalone testing

on:
# Runs on PRs against master
pull_request:
branches: [ master ]
types: [opened, synchronize, ready_for_review, reopened]
paths:
- components/eamxx
- components/eam/src/physics/rrtmgp
- components/eam/src/physics/p3/scream
- components/eam/src/physics/cam

# Manual run is used to bless
workflow_dispatch:
inputs:
jobs_list:
description: 'Job to run'
required: true
type: choice
options:
- gcc-openmp
bless:
description: 'Generate baselines'
required: true
type: boolean

# Add schedule trigger for nightly runs at midnight MT (Standard Time)
# schedule:
# - cron: '0 7 * * *' # Runs at 7 AM UTC, which is midnight MT during Standard Time

concurrency:
# Two runs are in the same group if:
# - they have the same trigger
# - if trigger=pull_request, the PR number must match
# - if trigger=workflow_dispatch, the inputs are the same
group: ${{ github.workflow }}-${{ github.event_name }}-${{
github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id
}}
cancel-in-progress: true

jobs:
gcc-openmp:
runs-on: [self-hosted, ghci-snl-cpu, gcc]
strategy:
fail-fast: true
matrix:
build_type: [sp, dbg, fpe, opt]
# Run this workflow if:
# - workflow_dispatch: user requested this job.
# - schedule: always:
# - pull_request: matching skip label is NOT found
if: |
${{
github.event_name == 'schedule' ||
( github.event_name == 'workflow_dispatch' && github.event.inputs.jobs_list == 'gcc-openmp' ) ||
(
github.event_name == 'pull_request' &&
!(
contains(github.event.pull_request.labels.*.name, 'AT: skip gcc') ||
contains(github.event.pull_request.labels.*.name, 'AT: skip openmp') ||
contains(github.event.pull_request.labels.*.name, 'AT: skip eamxx-standalone') ||
contains(github.event.pull_request.labels.*.name, 'AT: skip all')
)
)
}}
name: gcc-openmp-${{ matrix.build_type }}
steps:
- name: Show action trigger
uses: actions/github-script@v7
with:
script: |
const eventName = context.eventName;
const eventAction = context.payload.action || 'N/A';
const actor = context.actor;
console.log(`The job was triggered by a ${eventName} event.`);
console.log(` - Event action: ${eventAction}`);
console.log(` - Triggered by: ${actor}`);
- name: Check out the repository
uses: actions/checkout@v4
with:
persist-credentials: false
show-progress: false
submodules: recursive
- name: Set test-all inputs based on event specs
run: |
echo "submit=false" >> $GITHUB_ENV
echo "generate=false" >> $GITHUB_ENV
if [ "${{ github.event_name }}" == "schedule" ]; then
echo "submit=true" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
if [ "${{ inputs.bless }}" == "true" ]; then
echo "generate=true" >> $GITHUB_ENV
fi
fi
- name: Run tests
uses: ./.github/actions/test-all-scream
with:
build_type: ${{ matrix.build_type }}
machine: ghci-snl-cpu
generate: ${{ env.generate }}
submit: ${{ env.submit }}
cmake-configs: Kokkos_ENABLE_OPENMP=ON
# cuda:
# # Disable until the CUDA container is up and running. When CUDA container is availabe, remove
# # this line and uncomment the next if
# if: false
# # Runs always for pull_request. For workflow_dispatch, user must request this machine
# # if: ${{ github.event_name == 'pull_request' || contains(github.event.inputs.jobs_to_run, 'openmp-gcc') }}
# runs-on: [self-hosted, cuda]
# strategy:
# fail-fast: false
# matrix:
# build_type: [sp, dbg, fpe, opt]
# name: cuda-${{ matrix.build_type }}
# steps:
# - name: Show action trigger
# uses: ./.github/actions/print-workflow-trigger
# - name: Check out the repository
# uses: actions/checkout@v4
# with:
# persist-credentials: false
# show-progress: false
# submodules: recursive
# - name: Run tests
# uses: ./.github/actions/test-all-scream
# with:
# build_type: ${{ matrix.build_type }}
# machine: ghci-snl-cuda
# run_type: at-run
Loading

0 comments on commit 7a0f81f

Please sign in to comment.