[pre-commit.ci] pre-commit autoupdate #142
This file contains hidden or 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: Test the library | |
on: | |
push: | |
branches: | |
- master # for legacy repos | |
- main | |
pull_request: | |
branches: | |
- master # for legacy repos | |
- main | |
workflow_dispatch: # Allow manually triggering the workflow | |
schedule: | |
# Run roughly every 15 days at 00:00 UTC | |
# (useful to check if updates on dependencies break the package) | |
- cron: "0 0 1,16 * *" | |
permissions: | |
contents: read | |
concurrency: | |
group: >- | |
${{ github.workflow }}-${{ github.ref_type }}- | |
${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
strategy: | |
matrix: | |
python: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
platform: | |
- ubuntu-latest | |
# - macos-latest | |
# - windows-latest | |
runs-on: ${{ matrix.platform }} | |
name: Python ${{ matrix.python }}, ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox coverage | |
- name: Run tests | |
run: >- | |
pipx run --python '${{ steps.setup-python.outputs.python-path }}' | |
tox | |
-- -rFEx --durations 10 --color yes --cov --cov-branch --cov-report=xml # pytest args | |
- name: Check for codecov token availability | |
id: codecov-check | |
shell: bash | |
run: | | |
if [ ${{ secrets.CODECOV_TOKEN }} != '' ]; then | |
echo "codecov=true" >> $GITHUB_OUTPUT; | |
else | |
echo "codecov=false" >> $GITHUB_OUTPUT; | |
fi | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v5 | |
if: ${{ steps.codecov-check.outputs.codecov == 'true' }} | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
slug: ${{ github.repository }} | |
flags: ${{ matrix.platform }} - py${{ matrix.python }} |