Skip to content

Code Quality and Testing #58

Code Quality and Testing

Code Quality and Testing #58

name: Code Quality and Testing
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
schedule:
- cron: "9 2 * * 0" # at 9:02 on sunday
workflow_dispatch:
env:
UV_SYSTEM_PYTHON: 1
jobs:
quality:
uses: ecmwf/reusable-workflows/.github/workflows/qa-precommit-run.yml@v2
with:
skip-hooks: "no-commit-to-branch"
pytest:
strategy:
fail-fast: false
matrix:
platform: ["ubuntu-latest", "macos-latest"]
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: 0.7.19 # use same version as the one in ecmwf/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml
- name: Install packages
run: |
# Install all packages from local
uv pip install -e ./training[all,tests] -e ./graphs[all,tests] -e ./models[all,tests] pytest pytest-md pytest-emoji
- name: Run pytest for training package
uses: pavelzw/pytest-action@v2
with:
report-title: "Test report Anemoi Training (python ${{ matrix.python-version }} on ${{ matrix.platform }})"
custom-pytest: pytest ./training
- name: Run pytest for graphs package
uses: pavelzw/pytest-action@v2
with:
report-title: "Test report Anemoi Graphs (python ${{ matrix.python-version }} on ${{ matrix.platform }})"
custom-pytest: pytest ./graphs
- name: Run pytest for models package
uses: pavelzw/pytest-action@v2
with:
report-title: "Test report Anemoi Models (python ${{ matrix.python-version }} on ${{ matrix.platform }})"
custom-pytest: pytest ./models