Skip to content

Commit

Permalink
reusable workflow CI - checkout corrrect repository (#90)
Browse files Browse the repository at this point in the history
* fix trigger mistake

* fix spacking

* update yaml files

* rename lint.yaml

* remove backup yaml file

* simply pull request trigger

* beloved lint

---------

Co-authored-by: mlee03 <[email protected]>
  • Loading branch information
mlee03 and mlee03 authored Jul 9, 2024
1 parent e7f5a48 commit ffbf851
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 39 deletions.
1 change: 0 additions & 1 deletion .github/workflows/lint.yml → .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: "Lint"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
lint:
Expand Down
55 changes: 17 additions & 38 deletions .github/workflows/main_unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,68 +1,46 @@
name: "Pace main unit tests"
name: "pace main unit tests"
on:
workflow_call:
inputs:
ndsl_trigger:
component_trigger:
type: boolean
default: false
required: false
fv3_trigger:
type: boolean
default: false
required: false
shield_trigger:
type: boolean
default: false
component_name:
type: string
default: ''
required: false
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]


# cancel running jobs if theres a newer push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
github_repository: ${{github.event.repository.name}}

jobs:
main_unit_tests:
pace_main_unit_tests:
runs-on: ubuntu-latest
container:
image: ghcr.io/noaa-gfdl/miniforge:mpich
steps:
- name: Checkout pace if externally triggered
if: ${{ inputs.fv3_trigger || inputs.ndsl_trigger || inputs.shield_trigger }}
- name: external trigger Checkout pace/develop
if: ${{ inputs.component_trigger }}
uses: actions/checkout@v4
with:
submodules: 'recursive'
repository: NOAA-GFDL/pace
path: pace
ref: develop

- name: external trigger Remove existing component in pace/develop
if: ${{ inputs.component_trigger }}
run: rm -rf ${GITHUB_WORKSPACE}/pace/${{inputs.component_name}}

- name: Checkout repo that triggered the workflow
- name: Checkout out hash that triggered CI
uses: actions/checkout@v4
with:
submodules: 'recursive'
path: ${{ env.github_repository }}

- name: mv PyFV3 to pace
if: ${{inputs.fv3_trigger}}
run: |
rm -r ${GITHUB_WORKSPACE}/pace/pyFV3
mv ${GITHUB_WORKSPACE}/${{env.github_repository}} ${GITHUB_WORKSPACE}/pace/pyFV3
- name: mv NDSL to pace
if: ${{inputs.ndsl_trigger}}
run: |
rm -r ${GITHUB_WORKSPACE}/pace/NDSL
mv ${GITHUB_WORKSPACE}/${{env.github_repository}} ${GITHUB_WORKSPACE}/pace/NDSL
- name: mv pyShield to pace
if: ${{inputs.shield_trigger}}
run: |
rm -r ${GITHUB_WORKSPACE}/pace/pySHiELD
mv ${GITHUB_WORKSPACE}/${{env.github_repository}} ${GITHUB_WORKSPACE}/pace/pySHiELD
path: pace/${{inputs.component_name}}

- name: install packages
run: |
Expand All @@ -73,8 +51,9 @@ jobs:
- name: prepare input files
run: |
cd ${GITHUB_WORKSPACE}/pace
mkdir tests/main/input
python3 examples/generate_eta_files.py
mkdir tests/main/input && mv eta*.nc tests/main/input/.
mv *eta*.nc tests/main/input
- name: run tests
run: |
Expand Down

0 comments on commit ffbf851

Please sign in to comment.