Removes all fortran from SHOC #99
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: eamxx-scripts | |
on: | |
# Runs on PRs against master, but only if they touch eamxx scripts | |
pull_request: | |
branches: [ master ] | |
types: [opened, synchronize, ready_for_review, reopened] | |
# Manual run for debug purposes only | |
workflow_dispatch: | |
inputs: | |
submit: | |
description: 'Force cdash submission' | |
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 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 | |
env: | |
# Submit to cdash only for nightlies or if the user explicitly forced a submission via workflow dispatch | |
submit: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.submit) }} | |
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/scripts | |
components/eamxx/cime_config/eamxx | |
components/eamxx/cime_config/build | |
components/eamxx/cime_config/yaml_utils.py | |
.github/workflows/eamxx-scripts-tests.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 != 'pull_request' || | |
( | |
needs.pre_process_pr.outputs.relevant_paths == 'true' && | |
!contains(needs.pre_process_pr.outputs.labels, 'CI: skip eamxx-all') | |
) | |
) | |
runs-on: [self-hosted, gcc, ghci-snl-cpu] | |
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: Run test | |
run: | | |
cd components/eamxx | |
if [ "${{ env.submit }}" == "true" ]; then | |
./scripts/scripts-ctest-driver -s -m ghci-snl-cpu | |
else | |
./scripts/scripts-tests -f -m ghci-snl-cpu | |
./scripts/cime-nml-tests | |
fi |