Skip to content

Merge branch 'NOAA-EMC:develop' into develop #60

Merge branch 'NOAA-EMC:develop' into develop

Merge branch 'NOAA-EMC:develop' into develop #60

name: CI Unit Tests
on: [pull_request, push, workflow_dispatch]
env:
ROCOTO_VERSION: "1.3.7"
HPC_ACCOUNT: "fv3-cpu"
jobs:
ci_pytest:
runs-on: ubuntu-22.04
steps:
- name: Checkout global-workflow
uses: actions/checkout@v4
with:
path: global-workflow
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11.8
- name: Install APT packages
id: install-apt
run: |
sudo apt-get update
sudo apt-get install -y perl libxml-libxml-perl libxml-libxslt-perl libdatetime-perl
- name: Install python dependencies
id: install-pydeps
run: |
python -m pip install --upgrade pip
python -m pip install -r global-workflow/dev/workflow/requirements.txt
pip install pytest pytest-cov wget
- name: Cache Rocoto
id: cache-rocoto
uses: actions/cache@v4
with:
path: |
rocoto-${{ env.ROCOTO_VERSION }}
key: ${{ runner.os }}-rocoto-${{ env.ROCOTO_VERSION }}
- name: Install Rocoto
id: install-rocoto
if: steps.cache-rocoto.outputs.cache-hit != 'true'
run: |
git clone https://github.com/christopherwharrop/rocoto.git rocoto-${{ env.ROCOTO_VERSION }}
cd rocoto-${{ env.ROCOTO_VERSION }}
git checkout ${{ env.ROCOTO_VERSION }}
./INSTALL
echo "export PATH=${PWD}/bin:\$PATH" >> rocoto_path.sh
chmod +x rocoto_path.sh
- name: Run tests
shell: bash
run: |
sudo mkdir -p /scratch3/NCEPDEV
sudo mkdir -p /scratch3/NCEPDEV/stmp
sudo mkdir -p /scratch3/NCEPDEV/global
sudo chmod -R a+w /scratch3/NCEPDEV
source rocoto-${{ env.ROCOTO_VERSION }}/rocoto_path.sh
cd global-workflow/sorc
git submodule update --init -j 2 ufs_model.fd gsi_monitor.fd
./link_workflow.sh
# Create test data directory for unit tests
mkdir -p ../dev/ci/scripts/unittests/test_data
echo "Creating test directories and files for CI tests"
cd ../dev/ci/scripts/unittests
pytest -v --junitxml test-results.xml
- name: Publish Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: global-workflow/dev/ci/scripts/unittests/test-results.xml
job_summary: true
comment_mode: off