Skip to content

Move to hatchling build system (#55) #282

Move to hatchling build system (#55)

Move to hatchling build system (#55) #282

# based on https://github.com/pypa/hatch/blob/master/.github/workflows/test.yml
name: tests
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
STABLE_PYTHON_VERSION: '3.11'
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
jobs:
build:
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Ensure latest pip
run: python -m pip install --upgrade pip
- name: Install Hatch
run: pip install hatch
- name: Install vflow
run: python -m pip install -e .
- name: Check styles
run: hatch run style:check
- name: Test with pytest
run: hatch run full
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: .coverage.*
coverage:
name: Report coverage
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.STABLE_PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- name: Install Hatch
run: pip install hatch
- name: Download coverage data
uses: actions/download-artifact@v3
with:
name: coverage-data
- name: Combine coverage data
run: hatch run coverage:combine
- name: Export coverage reports
run: hatch run coverage:report-xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true