Python 3.13 support #420
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
branches: [ "master"] | |
release: | |
types: | |
- "published" | |
jobs: | |
pre-commit: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
checks: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
- "3.9" | |
- "3.12" | |
- "3.13" | |
include: | |
- os: windows-latest | |
python-version: "3.9" | |
- os: macos-13 | |
python-version: "3.9" | |
- os: macos-14 | |
python-version: "3.12" # old versions not supported | |
name: Check Python ${{ matrix.python-version }} ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
# - name: Setup Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: pip cache | |
uses: actions/[email protected] | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }}-pip-${{ hashFiles('**/setup.py') }}-pip-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install package | |
run: | | |
uv pip install --system -e .[test] pytest-xdist # for multiprocessing | |
- name: Test package | |
run: python -m pytest --doctest-modules --cov=hepstats --cov-report=xml -n auto | |
- name: Upload coverage to Codecov | |
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # technically not needed, but prevents failures: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: false # flaky upload... | |
dist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
run: pipx run build | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/* | |
- name: Check metadata | |
run: pipx run twine check dist/* | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Set up Python 3.9 | |
run: uv python install 3.9 | |
- name: Install dependencies | |
run: | | |
uv pip install --system -e .[docs] | |
- name: build docs | |
run: | | |
sphinx-build -b html docs docs/_build/html | |
touch docs/_build/html/.nojekyll | |
- name: Deploy docs to GitHub Pages | |
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_build/html | |
force_orphan: true | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
commit_message: Deploy to GitHub pages | |
publish: | |
needs: [ dist ] | |
environment: pypi | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 |