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

added dynamically creating branches from PRs #303

Closed
wants to merge 17 commits into from
Closed
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
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,69 @@ on: [workflow_dispatch]
# ├── HOMEgfs
# └── RUNTESTS
# ├── COMROT
# │   └── ${pslot}
# │ └── ${pslot}
# └── EXPDIR
# └── ${pslot}

on:
workflow_dispatch:
inputs:
pr_number:
description: 'Pull Request Number'
required: true
default: ''
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 }}
branch=$(gh pr view $pr_number --repo $repo --json headRefName --jq '.headRefName')
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 +81,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,11 +104,11 @@ jobs:

run-experiments:
needs: create-experiments
runs-on: [self-hosted, aws, parallelworks, centos]
strategy:
max-parallel: 2
matrix:
case: ["C48_ATM"]
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
steps:
- name: Run Experiment ${{ matrix.case }}
run: |
Expand All @@ -81,9 +117,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 }}
Loading