Skip to content

[pre-commit.ci] pre-commit autoupdate #716

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #716

Workflow file for this run

# This workflow will install Python dependencies,
# run tests and lint with a variety of Python versions
---
name: Tests
on: [push, pull_request]
jobs:
cpython:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13', '3.14', '3.15-dev']
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[tests]"
- name: Test with pytest
run: |
pytest tests --cov=tests --cov=crepr --cov-report=xml
- name: "Upload coverage to Codecov"
if: ${{ matrix.python-version==3.12 }}
uses: codecov/codecov-action@v7
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
static-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[typing, complexity, linting]"
- name: Typecheck
run: |
mypy crepr tests
- name: Linting
run: |
ruff check --no-fix crepr tests
ruff format --check crepr tests
yamllint .github/workflows/
- name: Check complexity
run: |
radon cc --min B crepr
radon mi --min B crepr
lizard -l python -w crepr
complexipy crepr
build-package:
name: Build & inspect our package.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: hynek/build-and-inspect-python-package@v3.0.1
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Check with pyroma
run: |
python -m pip install pyroma
pyroma .
- name: Check tag name
if: >-
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags')
run: |
python -m pip install vercheck
vercheck $GITHUB_REF_NAME crepr/about.py
test-publish:
if: >-
github.event_name == 'push' &&
github.repository == 'cleder/crepr' &&
startsWith(github.ref, 'refs/tags')
needs: [build-package, cpython, static-tests]
name: Test install on TestPyPI
runs-on: ubuntu-latest
environment: release-test
permissions:
id-token: write
steps:
- name: Download packages built by build-package
uses: actions/download-artifact@v8
with:
name: Packages
path: dist
- name: Upload package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish:
if: >-
github.event_name == 'push' &&
github.repository == 'cleder/crepr' &&
github.ref == 'refs/heads/main'
needs: [build-package, cpython, static-tests]
name: Publish to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Download packages built by build-package
uses: actions/download-artifact@v8
with:
name: Packages
path: dist
- name: Publish distribution 📦 to PyPI for push to main
uses: pypa/gh-action-pypi-publish@release/v1
...