Replace pip with uv for test workflow #1510
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: Test | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
pull_request: | |
branches: "*" | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -e {0} # -e to fail on error | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.10", "3.12"] | |
os: [ubuntu-latest] | |
include: | |
- os: macos-latest | |
python: "3.10" | |
- os: macos-latest | |
python: "3.12" | |
pip-flags: "--pre" | |
name: "Python 3.12 (pre-release)" | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: astral-sh/setup-uv@v5 | |
id: setup-uv | |
with: | |
version: "latest" | |
python-version: ${{ matrix.python }} | |
enable-cache: true | |
cache-suffix: "${{ runner.os }}-${{ matrix.python }}" | |
cache-dependency-glob: | | |
**/pyproject.toml | |
- name: Clean uv cache | |
# uncomment this step if you want to clean the cache | |
run: "uv cache clean -v" | |
- name: Install dependencies | |
run: | | |
if [ "${{ steps.setup-uv.outputs.cache-hit }}" == "true" ]; then | |
echo "uv cache hit" | |
else | |
echo "uv cache miss" | |
uv sync --optional dev --optional test | |
fi | |
- name: Test | |
env: | |
MPLBACKEND: agg | |
PLATFORM: ${{ matrix.os }} | |
DISPLAY: :42 | |
run: | | |
uv run pytest --cov --color=yes --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
name: coverage | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |