Skip to content

Use pyproject.toml with hatch #277

Use pyproject.toml with hatch

Use pyproject.toml with hatch #277

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master, dev, v0.2, v0.3, v0.4]
pull_request:
branches: [ master, dev, v0.2, v0.3, v0.4]
jobs:
check:
name: ${{ matrix.env.name }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
env:
- {"name": "pkg", "target": "show"}
- {"name": "lint", "target": "run"}
# - {"name": "type", "target": "run"}
- {"name": "docs", "target": "all"}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Hatch
uses: pypa/hatch@install
- name: Setup ${{ matrix.env.name }}
run: |
hatch -v env create ${{ matrix.env.name }}
hatch run ${{ matrix.env.name }}:pip freeze
- name: Run ${{ matrix.env.name }}
run: hatch -v run ${{ matrix.env.name }}:${{ matrix.env.target }}
test:
name: test ${{ matrix.py }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Setup python for tox
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Hatch
uses: pypa/hatch@install
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup test environment
run: |
hatch -v env create tests
hatch run tests:pip freeze
shell: bash
- name: Run test suite
run: hatch -v run tests:run-cov
env:
CI_RUN: "yes"
shell: bash
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
path: "report/.coverage.*"
coverage:
name: Combine coverage
runs-on: ubuntu-22.04
needs: test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Let us have colors
run: echo "FORCE_COLOR=true" >> "$GITHUB_ENV"
- name: Install Hatch
uses: pypa/hatch@install
- name: Setup coverage tool
run: |
hatch -v env create coverage
hatch run coverage:pip freeze
- name: Download coverage data
uses: actions/download-artifact@v4
with:
path: report
pattern: .coverage.*
merge-multiple: true
- name: Combine and report coverage
run: hatch run coverage:run
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
directory: report
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}