Skip to content

Add option to prescribe an invariant solar constant #293

Add option to prescribe an invariant solar constant

Add option to prescribe an invariant solar constant #293

name: eamxx-v1
on:
# Runs on PRs against master
pull_request:
branches: [ master ]
types: [opened, synchronize, ready_for_review, reopened]
# Manual run is used to bless
workflow_dispatch:
inputs:
job_to_run:
description: 'Job to run'
required: true
type: choice
options:
- cpu-gcc
- all
bless:
description: 'Generate baselines'
required: true
type: boolean
concurrency:
# Two runs are in the same group if they are testing the same git ref
# - if trigger=pull_request, the ref is refs/pull/<PR_NUMBER>/merge
# - for other triggers, the ref is the branch tested
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre_process_pr:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest # This job can run anywhere
outputs:
relevant_paths: ${{ steps.check_paths.outputs.value }}
labels: ${{ steps.get_labels.outputs.labels }}
steps:
- name: Check files modified by PR
id: check_paths
run: |
paths=(
components/eamxx
components/eam/src/physics/rrtmgp
components/eam/src/physics/p3/scream
components/eam/src/physics/cam
components/eam/src/physics/rrtmgp/external
externals/ekat
externals/scorpio
externals/haero
externals/YAKL
.github/workflows/eamxx-v1-testing.yml
)
pattern=$(IFS=\|; echo "${paths[*]}")
# Use the GitHub API to get the list of changed files
# There are page size limits, so do it in chunks
page=1
while true; do
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/E3SM-Project/scream/pulls/${{ github.event.number }}/files?per_page=100&page=$page")
# Check if the response is empty, and break if it is
[ -z "$response" ] && break
changed_files+=$(echo "$response" | grep -o '"filename": *"[^"]*"' | sed 's/"filename": *//; s/"//g')$'\n'
# Check if there are more pages, and quite if there aren't
[[ $(echo "$response" | jq '. | length') -lt 100 ]] && break
page=$((page + 1))
done
# Check for matches and echo the matching files (or "" if none)
matching_files=$(echo "$changed_files" | grep -E "^($pattern)" || echo "")
if [[ -n "$matching_files" ]]; then
echo "Found relevant files: $matching_files"
echo "value=true" >> $GITHUB_OUTPUT
else
echo "No relevant files touched by this PR."
echo "value=false" >> $GITHUB_OUTPUT
fi
- name: Retrieve PR labels
id: get_labels
run: |
labels="${{ join(github.event.pull_request.labels.*.name, ',') }}"
echo "labels=${labels}" >> $GITHUB_OUTPUT
cpu-gcc:
needs: [pre_process_pr]
if: |
!failure() && !cancelled() &&
(
github.event_name == 'schedule' ||
(
github.event_name == 'pull_request' &&
needs.pre_process_pr.outputs.relevant_paths=='true' &&
!contains(needs.pre_process_pr.outputs.labels,'CI: skip gcc') &&
!contains(needs.pre_process_pr.outputs.labels,'CI: skip eamxx-v1') &&
!contains(needs.pre_process_pr.outputs.labels,'CI: skip eamxx-all')
) || (
github.event_name == 'workflow_dispatch' &&
github.event.inputs.job_to_run == 'cpu-gcc' ||
github.event.inputs.job_to_run == 'all'
)
)
runs-on: [self-hosted, gcc, ghci-snl-cpu]
strategy:
matrix:
test:
- full_name: ERS_Ln9.ne4_ne4.F2000-SCREAMv1-AQP1.ghci-snl-cpu_gnu.scream-output-preset-2
short_name: ERS_Ln9.ne4_ne4.F2000-SCREAMv1-AQP1.scream-output-preset-2
- full_name: ERS_P16_Ln22.ne30pg2_ne30pg2.FIOP-SCREAMv1-DP.ghci-snl-cpu_gnu.scream-dpxx-arm97
short_name: ERS_P16_Ln22.ne30pg2_ne30pg2.FIOP-SCREAMv1-DP.scream-dpxx-arm97
- full_name: ERS_Ln22.ne4pg2_ne4pg2.F2010-SCREAMv1.ghci-snl-cpu_gnu.scream-small_kernels--scream-output-preset-5
short_name: ERS_Ln22.ne4pg2_ne4pg2.F2010-SCREAMv1.scream-small_kernels--scream-output-preset-5
- full_name: SMS_D_Ln5.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.ghci-snl-cpu_gnu.scream-mam4xx-all_mam4xx_procs
short_name: SMS_D_Ln5.ne4pg2_oQU480.F2010-SCREAMv1-MPASSI.scream-mam4xx-all_mam4xx_procs
fail-fast: false
name: cpu-gcc / ${{ matrix.test.short_name }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
persist-credentials: false
show-progress: false
submodules: recursive
- name: Show action trigger
uses: ./.github/actions/show-workflow-trigger
- 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
- name: Establish cmp/gen flag
run: |
dir_suffix=".C"
cmp_gen_flag="-c"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
if [ ${{ inputs.bless }} ]; then
cmp_gen_flag="-o -g"
dir_suffix=".G"
fi
fi
echo "flags=$cmp_gen_flag -b master" >> $GITHUB_ENV
echo "folder_suffix=$dir_suffix" >> $GITHUB_ENV
- name: Run test
run: |
./cime/scripts/create_test ${{ matrix.test.full_name }} ${{ env.flags }} --wait
- name: Upload case files
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.test.full_name }}
path: |
/projects/e3sm/scratch/${{ matrix.test.full_name }}${{ env.folder_suffix }}*/TestStatus.log
/projects/e3sm/scratch/${{ matrix.test.full_name }}${{ env.folder_suffix }}*/bld/*.bldlog.*
/projects/e3sm/scratch/${{ matrix.test.full_name }}${{ env.folder_suffix }}*/bld/case2bld/*.bldlog.*
/projects/e3sm/scratch/${{ matrix.test.full_name }}${{ env.folder_suffix }}*/run/*.log.*
/projects/e3sm/scratch/${{ matrix.test.full_name }}${{ env.folder_suffix }}*/run/case2run/*.log.*
/projects/e3sm/scratch/${{ matrix.test.full_name }}${{ env.folder_suffix }}*/run/*.cprnc.out
/projects/e3sm/scratch/${{ matrix.test.full_name }}${{ env.folder_suffix }}*/run/case2run/*.cprnc.out
env:
NODE_EXTRA_CA_CERTS: ${{ env.NODE_EXTRA_CA_CERTS }}
- name: Clean up
if: ${{ always() }}
run: |
rm -rf /projects/e3sm/scratch/${{ matrix.test.full_name }}*