[pre-commit.ci] pre-commit autoupdate #145
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: Python CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
CI-Python: | |
runs-on: ${{ matrix.os }} | |
env: | |
PYTHONDEVMODE: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
pdm-version: [""] | |
os: [ubuntu-latest] | |
include: | |
- os: macOS-latest | |
python-version: '3.12' | |
pdm-version: "" | |
- os: windows-latest | |
python-version: '3.12' | |
pdm-version: "" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
cache: true | |
python-version: ${{ matrix.python-version }} | |
version: ${{ matrix.pdm-version }} | |
allow-python-prereleases: true | |
- name: Set Cache Variables | |
id: set_variables | |
run: | | |
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT | |
echo "PDM_CACHE=$(pdm config cache_dir)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache PIP and PDM | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.set_variables.outputs.PIP_CACHE }} | |
${{ steps.set_variables.outputs.PDM_CACHE }} | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.pdm-version }} | |
- name: Install dependencies | |
run: | | |
pdm install -G :all --dev | |
- name: Run Test with tox | |
run: pdm run tox | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests | |
- name: Type check with mypy | |
run: | | |
pdm run lint-mypy | |
- name: Lint with ruff | |
run: | | |
pdm run lint-ruff --output-format=github --exit-non-zero-on-fix | |
- name: Build with pdm | |
run: | | |
pdm build | |
# Do not upload to PyPI, here we only want to check that the build works |