Skip to content

Refactor optimisation args #307

Refactor optimisation args

Refactor optimisation args #307

name: Pull Request
on:
workflow_dispatch:
pull_request:
# Add colors to nox/pytest
env:
FORCE_COLOR: 3
concurrency:
# github.workflow: name of the workflow, so that we don't cancel other workflows
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Cancel in-progress runs when a new workflow with the same group name is triggered
# This avoids workflow runs on both pushes and PRs
cancel-in-progress: true
jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Check formatting with pre-commit
run: |
python -m pip install pre-commit
pre-commit run ruff
integration_tests:
needs: style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
python-version: ["3.12"]
name: Integration tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox[uv]
- name: Integration tests
run: |
nox -s integration
unit_tests:
needs: style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude: # We run the coverage tests on macos-14 with Python 3.12
- os: macos-14
python-version: "3.12"
name: Unit tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox[uv]
- name: Unit tests
run: |
nox -s unit
example_tests:
needs: style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
python-version: ["3.12"]
name: Test examples (${{ matrix.os }} / Python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox[uv]
- name: Run examples
run: |
nox -s examples
# Quick benchmarks on macos-14
benchmarks:
needs: style
runs-on: macos-14
strategy:
fail-fast: false
name: Benchmarks
steps:
- name: Check out PyBOP repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip asv[virtualenv]
- name: Run quick benchmarks
shell: bash
run: |
asv machine --machine "GitHubRunner"
asv run --machine "GitHubRunner" --quick --show-stderr
# Runs only on macos-14 with Python 3.12
check_coverage:
needs: style
runs-on: macos-14
strategy:
fail-fast: false
name: Coverage tests (macos-14 / Python 3.12)
steps:
- name: Check out PyBOP repository
uses: actions/checkout@v4
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.12
cache: 'pip'
cache-dependency-path: setup.py
- name: Install dependencies
run: python -m pip install --upgrade pip nox[uv]
- name: Run coverage tests for macos-14 with Python 3.12 and generate report
run: nox -s coverage
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}