Skip to content

pace main unit tests #305

pace main unit tests

pace main unit tests #305

name: "pace main unit tests"
# Run these these whenever ...
on:
workflow_call: # ... called from a downstream repo
inputs:
component_trigger:
type: boolean
default: false
required: false
component_name:
type: string
default: ''
required: false
python_version:
type: string
default: ''
required: false
pull_request: # ... a PR is opened / updated
merge_group: # ... the PR is added to the merge queue
push:
branches:
- main # ... when merging into the main branch
# cancel running jobs if theres a newer push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pace_main_unit_tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
env:
python_default: '3.12'
steps:
- name: "External trigger: Checkout pace/develop"
if: ${{ inputs.component_name }}
uses: actions/checkout@v6
with:
submodules: 'recursive'
repository: NOAA-GFDL/pace
path: pace
- name: 'Setup Python ${{ inputs.python_version && inputs.python_version || env.python_default }}'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python_version && inputs.python_version || env.python_default }}
- name: Install mpi (MPICH flavor)
run: pip install mpich
- name: "External trigger: Remove existing component in pace/develop"
if: ${{ inputs.component_name }}
run: rm -rf ${GITHUB_WORKSPACE}/pace/${{inputs.component_name}}
- name: Checkout out hash that triggered CI
uses: actions/checkout@v6
with:
submodules: 'recursive'
path: pace/${{inputs.component_name}}
- name: Install packages
run: |
cd ${GITHUB_WORKSPACE}/pace
pip install .[test]
- name: Print versions
run: |
python --version
pip --version
pip list
- name: Run tests
run: |
cd ${GITHUB_WORKSPACE}/pace
python -m pytest -x tests/main
- name: Run baroclinic test case
run: |
cd ${GITHUB_WORKSPACE}/pace
mpiexec -np 6 python -m pace.run examples/configs/baroclinic_c48_no_out.yaml