CI: Use astral-sh/setup-uv action #53
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
# -- SOURCE: https://github.com/marketplace/actions/setup-python | |
# SEE: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
# SUPPORTED PYTHON VERSIONS: https://github.com/actions/python-versions | |
name: test | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main", "release/**" ] | |
pull_request: | |
types: [opened, reopened, review_requested] | |
branches: [ "main" ] | |
jobs: | |
test: | |
# -- EXAMPLE: runs-on: ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# PREPARED: os: [ubuntu-latest, macos-latest, windows-latest] | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.13.0-rc.3", "3.12", "3.11", "3.10"] | |
exclude: | |
- os: windows-latest | |
python-version: "2.7" | |
steps: | |
- uses: actions/checkout@v4 | |
# DISABLED: name: Setup Python ${{ matrix.python-version }} on platform=${{ matrix.os }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: 'py.requirements/*.txt' | |
- name: setup-uv -- Speed-up Python package installations ... | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: | | |
**/pyproject.toml | |
**/py.requirements/ci.github.testing.txt | |
**/py.requirements/basic.txt | |
- name: "Install Python package dependencies (with: uv)" | |
run: | | |
uv venv | |
uv pip install -U pip setuptools wheel | |
uv pip install -U -r py.requirements/ci.github.testing.txt | |
uv pip install -e . | |
- name: Run tests | |
run: uv run pytest | |
- name: Upload test reports | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test reports | |
path: | | |
build/testing/report.xml | |
build/testing/report.html | |
if: ${{ job.status == 'failure' }} | |
# MAYBE: if: ${{ always() }} |