Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always run eamxx workflows on PRs #3100

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .github/actions/check-skip-labels/README.md

This file was deleted.

48 changes: 0 additions & 48 deletions .github/actions/check-skip-labels/action.yml

This file was deleted.

102 changes: 71 additions & 31 deletions .github/workflows/eamxx-sa-testing.yml
Original file line number Diff line number Diff line change
@@ -5,17 +5,6 @@ on:
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/**
- .github/workflows/eamxx-standalone-testing.yml
- externals/ekat/**
- externals/scorpio/**
- externals/haero/**
- externals/YAKL/**
- components/eam/src/physics/rrtmgp/external/**

# Manual run is used to bless
workflow_dispatch:
@@ -48,15 +37,68 @@ env:
submit: ${{ github.event_name == 'schedule' && 'true' || 'false' }} # Submit to cdash only for nightlies

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:
- 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-sa-testing.yml
)
pattern=$(IFS=\|; echo "${paths[*]}")

# Use the GitHub API to get the list of changed files
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}/files")
changed_files=$(echo "$response" | grep -o '"filename": *"[^"]*"' | sed 's/"filename": *//; s/"//g')

# 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
- id: get_labels
run: |
labels="${{ join(github.event.pull_request.labels.*.name, ',') }}"
echo "labels=${labels}" >> $GITHUB_OUTPUT
gcc-openmp:
needs: [pre_process_pr]
if: |
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 openmp') &&
!contains(needs.pre_process_pr.outputs.labels,'CI: skip eamxx-sa') &&
!contains(needs.pre_process_pr.outputs.labels,'CI: skip eamxx-all')
) || (
github.event_name == 'workflow_dispatch' &&
github.event.inputs.job_to_run == 'gcc-openmp' ||
github.event.inputs.job_to_run == 'all'
)
runs-on: [self-hosted, ghci-snl-cpu, gcc]
strategy:
fail-fast: false
matrix:
build_type: [sp, dbg, fpe, opt]
if: ${{ github.event_name != 'workflow_dispatch' ||
github.event.inputs.job_to_run == 'gcc-openmp' ||
github.event.inputs.job_to_run == 'all' }}
name: gcc-openmp / ${{ matrix.build_type }}
steps:
- name: Check out the repository
@@ -67,13 +109,6 @@ jobs:
submodules: recursive
- name: Show action trigger
uses: ./.github/actions/show-workflow-trigger
- name: Check for skip labels
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_review' }}
uses: ./.github/actions/check-skip-labels
with:
skip_labels: 'AT: skip gcc,AT: skip openmp,AT: skip eamxx-sa,AT: skip eamxx-all'
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ github.event.pull_request.number }}
- name: Set test-all inputs based on event specs
run: |
echo "generate=false" >> $GITHUB_ENV
@@ -91,14 +126,26 @@ jobs:
submit: ${{ env.submit }}
cmake-configs: Kokkos_ENABLE_OPENMP=ON
gcc-cuda:
needs: [pre_process_pr]
if: |
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 cuda') &&
!contains(needs.pre_process_pr.outputs.labels,'CI: skip eamxx-sa') &&
!contains(needs.pre_process_pr.outputs.labels,'CI: skip eamxx-all')
) || (
github.event_name == 'workflow_dispatch' &&
github.event.inputs.job_to_run == 'gcc-cuda' ||
github.event.inputs.job_to_run == 'all'
)
runs-on: [self-hosted, ghci-snl-cuda, cuda, gcc]
strategy:
fail-fast: false
matrix:
build_type: [sp, dbg, opt]
if: ${{ github.event_name != 'workflow_dispatch' ||
github.event.inputs.job_to_run == 'gcc-cuda' ||
github.event.inputs.job_to_run == 'all' }}
name: gcc-cuda / ${{ matrix.build_type }}
steps:
- name: Check out the repository
@@ -109,13 +156,6 @@ jobs:
submodules: recursive
- name: Show action trigger
uses: ./.github/actions/show-workflow-trigger
- name: Check for skip labels
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_review' }}
uses: ./.github/actions/check-skip-labels
with:
skip_labels: 'AT: skip gcc,AT: skip cuda,AT: skip eamxx-sa,AT: skip eamxx-all'
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ github.event.pull_request.number }}
- name: Set test-all inputs based on event specs
run: |
echo "generate=false" >> $GITHUB_ENV
59 changes: 43 additions & 16 deletions .github/workflows/eamxx-scripts-tests.yml
Original file line number Diff line number Diff line change
@@ -5,15 +5,6 @@ on:
pull_request:
branches: [ master ]
types: [opened, synchronize, ready_for_review, reopened]
paths:
- components/eamxx/scripts/**
- components/eamxx/cime_config/*.py
- .github/workflows/eamxx-scripts-tests.yml
- externals/ekat/**
- externals/scorpio/**
- externals/haero/**
- externals/YAKL/**
- components/eam/src/physics/rrtmgp/external/**

# Manual run for debug purposes only
workflow_dispatch:
@@ -30,7 +21,50 @@ concurrency:
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:
- 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
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}/files")
changed_files=$(echo "$response" | grep -o '"filename": *"[^"]*"' | sed 's/"filename": *//; s/"//g')

# 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
- id: get_labels
run: |
labels="${{ join(github.event.pull_request.labels.*.name, ',') }}"
echo "labels=${labels}" >> $GITHUB_OUTPUT
cpu-gcc:
needs: [pre_process_pr]
if: |
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
@@ -41,13 +75,6 @@ jobs:
submodules: recursive
- name: Show action trigger
uses: ./.github/actions/show-workflow-trigger
- name: Check for skip labels
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_review' }}
uses: ./.github/actions/check-skip-labels
with:
skip_labels: 'AT: skip eamxx-all'
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ github.event.pull_request.number }}
- name: Run test
run: |
cd components/eamxx
Loading