Skip to content

Commit

Permalink
GitHub Actions Pipeline Updates for Self-Hosted Runners on PW (NOAA-E…
Browse files Browse the repository at this point in the history
…MC#3018)

Updates to the GItHub Self-hosted Runner Pipelines for Parallel Works:
- User now inputs PR number when dispatching the CI workflow
- User can also select which operating system to test on during the
transition to Rocky 8

**NOTE:** When this pipeline is dispatched it should be run with [PR
3023](NOAA-EMC#3023) to
demonstrate that it can pass an end-to-end case.
  • Loading branch information
TerrenceMcGuinness-NOAA authored Oct 29, 2024
1 parent b56f633 commit 00f567c
Showing 1 changed file with 68 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
name: gw-ci-aws-centos

on: [workflow_dispatch]

name: gw-ci-aws
# TEST_DIR contains 2 directories;
# 1. HOMEgfs: clone of the global-workflow
# 2. RUNTESTS: A directory containing EXPDIR and COMROT for experiments
Expand All @@ -10,33 +7,73 @@ on: [workflow_dispatch]
# ├── HOMEgfs
# └── RUNTESTS
# ├── COMROT
#   └── ${pslot}
# └── ${pslot}
# └── EXPDIR
# └── ${pslot}

on:
workflow_dispatch:
inputs:
pr_number:
description: 'Pull Request Number (use 0 for non-PR)'
required: true
default: '0'
os:
description: 'Operating System'
required: true
type: choice
options:
- rocky
- centos

env:
TEST_DIR: ${{ github.workspace }}/${{ github.run_id }}
MACHINE_ID: noaacloud

jobs:
fetch-branch:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUBTOKEN }}
outputs:
branch: ${{ steps.get-branch.outputs.branch }}
steps:
- name: Fetch branch name for PR
id: get-branch
run: |
pr_number=${{ github.event.inputs.pr_number }}
repo=${{ github.repository }}
if [ "$pr_number" -eq "0" ]; then
branch=${{ github.event.inputs.ref }}
else
branch=$(gh pr view $pr_number --repo $repo --json headRefName --jq '.headRefName')
fi
echo "::set-output name=branch::$branch"
checkout:
runs-on: [self-hosted, aws, parallelworks, centos]
needs: fetch-branch
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
timeout-minutes: 600

steps:

- name: Checkout global-workflow
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}/HOMEgfs
submodules: 'recursive'
ref: ${{ github.event.pull_request.head.ref }}
ref: ${{ needs.fetch-branch.outputs.branch }}

build-link:
runs-on: [self-hosted, aws, parallelworks, centos]
needs: checkout

runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
steps:

- name: Build components
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs/sorc
Expand All @@ -48,12 +85,15 @@ jobs:
./link_workflow.sh
create-experiments:
needs: checkout
runs-on: [self-hosted, aws, parallelworks, centos]
needs: build-link
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
strategy:
matrix:
case: ["C48_ATM"]

steps:
- name: Create Experiments ${{ matrix.case }}
env:
Expand All @@ -68,9 +108,12 @@ jobs:
run-experiments:
needs: create-experiments
runs-on: [self-hosted, aws, parallelworks, centos]
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
strategy:
max-parallel: 2
matrix:
case: ["C48_ATM"]
steps:
Expand All @@ -81,9 +124,13 @@ jobs:
clean-up:
needs: run-experiments
runs-on: [self-hosted, aws, parallelworks, centos]
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
steps:
- name: Clean-up
- name: Clean up workspace
run: |
cd ${{ github.workspace }}
rm -rf ${{ github.run_id }}
echo "Cleaning up workspace"
rm -rf ${{ env.TEST_DIR }}

0 comments on commit 00f567c

Please sign in to comment.