Skip to content

Update GitHub CI Workflow for dispatching PRs #9

Update GitHub CI Workflow for dispatching PRs

Update GitHub CI Workflow for dispatching PRs #9

name: gw-ci-orion
on:
pull_request:
types: [opened, labeled]
workflow_dispatch:
# TEST_DIR contains 2 directories;
# 1. HOMEgfs: clone of the global-workflow
# 2. RUNTESTS: A directory containing EXPDIR and COMROT for experiments
# e.g. $> tree ./TEST_DIR
# ./TEST_DIR
# ├── HOMEgfs
# └── RUNTESTS
# ├── COMROT
# │   └── ${pslot}
# └── EXPDIR
# └── ${pslot}
env:
TEST_DIR: ${{ github.workspace }}/${{ github.run_id }}
MACHINE_ID: orion
jobs:
checkout-build-link:
if: github.event.label.name == 'CI-Orion-Dispatch' || github.event_name == 'workflow_dispatch'
runs-on: [self-hosted, orion-ready]
timeout-minutes: 600
steps:
- name: Checkout global-workflow
uses: actions/checkout@v3
with:
path: ${{ github.run_id }}/HOMEgfs # This path needs to be relative
- name: Checkout components
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs/sorc
./checkout.sh -c -g # Options e.g. -u can be added late
- name: Build components
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs/sorc
./build_all.sh
- name: Link artifacts
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs/sorc
./link_workflow.sh
create-experiments:
needs: checkout-build-link
runs-on: [self-hosted, orion-ready]
strategy:
matrix:
case: ["C48_S2S", "C96_atm3DVar"]
steps:
- name: Create Experiments ${{ matrix.case }}
env:
HOMEgfs_PR: ${{ env.TEST_DIR }}/HOMEgfs
RUNTESTS: ${{ env.TEST_DIR }}/RUNTESTS
pslot: ${{ matrix.case }}.${{ github.run_id }}
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs
source workflow/gw_setup.sh
source ci/platforms/orion.sh
./ci/scripts/create_experiment.py --yaml ci/cases/${{ matrix.case }}.yaml --dir ${{ env.HOMEgfs_PR }}
run-experiments:
needs: create-experiments
runs-on: [self-hosted, orion-ready]
strategy:
max-parallel: 2
matrix:
case: ["C48_S2S", "C96_atm3DVar"]
steps:
- name: Run Experiment ${{ matrix.case }}
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs
./ci/scripts/run-check_ci.sh ${{ env.TEST_DIR }} ${{ matrix.case }}.${{ github.run_id }}
clean-up:
needs: run-experiments
runs-on: [self-hosted, orion-ready]
steps:
- name: Clean-up
run: |
cd ${{ github.workspace }}
rm -rf ${{ github.run_id }}