Skip to content

Test and lint

Test and lint #165

Workflow file for this run

---
name: Test and lint
on:
push:
merge_group:
schedule:
- cron: 0 13 * * 1
#pull_request:
workflow_dispatch:
repository_dispatch:
types: [trigger_checks]
jobs:
lint:
name: Format, lint, and type check
runs-on: macos-15
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
uv sync --frozen
source .venv/bin/activate
uv pip install --compile-bytecode --editable .
- name: Run Ruff
if: always()
uses: astral-sh/ruff-action@v3
with:
args: check --exit-non-zero-on-fix --no-fix
- name: Run Ruff Format
if: always()
uses: astral-sh/ruff-action@v3
with:
args: format --check
- name: Run mypy
if: always()
run: uv run --frozen -- mypy --install-types --non-interactive
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
run: |
source .venv/bin/activate
uv run --frozen -- pre-commit run --all-files --show-diff-on-failure --color=always
pytest:
timeout-minutes: 120
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15]
python-version: ['3.10', '3.11', '3.12', '3.13']
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
name: pytest ${{ matrix.os }} python ${{ matrix.python-version }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Install pynonthermal
run: |
uv sync --frozen
uv pip install --compile-bytecode --editable .[dev]
- name: Test with pytest
run: uv run --frozen -- python3 -m pytest --cov=./ --cov-report=xml
- name: Report coverage
run: uv run --frozen -- python3 -m coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
# directory: ./coverage/reports/
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
verbose: true