Fix custom package install in CI is not working #3234
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] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: test-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: >- | |
Test ${{ matrix.py || matrix.tox_env }} on | |
${{ matrix.os == 'windows-latest' && 'Windows' || (matrix.os == 'macos-latest' && 'macOS' || 'Ubuntu') }} | |
strategy: | |
fail-fast: false | |
matrix: | |
py: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"] | |
os: [ubuntu-24.04, windows-latest, macos-latest] | |
tox_env: [''] | |
include: | |
- tox_env: py3.12-black24 | |
- tox_env: py3.12-black23 | |
- tox_env: py3.12-black22 | |
- tox_env: py3.9-black19 | |
- tox_env: py3.8-pydantic18 | |
- tox_env: py3.8-isort4 | |
runs-on: ${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os }} | |
env: | |
OS: ${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v5 | |
- name: Install tox | |
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv | |
- name: Setup Python test environment | |
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py || matrix.tox_env }} | |
env: | |
UV_PYTHON_PREFERENCE: "only-managed" | |
- name: Run test suite | |
run: tox run --skip-uv-sync --skip-pkg-install -e ${{ matrix.py || matrix.tox_env }} | |
env: | |
UV_PYTHON_PREFERENCE: "only-managed" | |
- name: Rename coverage report file | |
run: | | |
import os; import sys | |
os.rename(f".tox/.coverage.${{ matrix.py || matrix.tox_env }}", f".tox/.coverage.${{ matrix.py || matrix.tox_env}}-${{ matrix.os }}") | |
shell: python | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v4 | |
with: | |
include-hidden-files: true | |
name: .coverage.${{ matrix.py || matrix.tox_env }}-${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os }} | |
path: ".tox/.coverage.*" | |
retention-days: 3 | |
coverage: | |
name: Combine coverage | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "pyproject.toml" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install hatch | |
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv | |
- name: Build package to generate version | |
run: uv build --python 3.13 --python-preference only-managed --wheel . --out-dir dist | |
- name: Setup coverage tool | |
run: tox run -e coverage --notest | |
env: | |
UV_PYTHON_PREFERENCE: only-managed | |
- name: Download coverage data | |
uses: actions/download-artifact@v4 | |
with: | |
path: .tox | |
pattern: .coverage.* | |
merge-multiple: true | |
- name: Combine and report coverage | |
run: tox run -e coverage --skip-uv-sync --skip-pkg-install | |
env: | |
UV_PYTHON_PREFERENCE: only-managed | |
- name: Upload HTML report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html-report | |
path: .tox/htmlcov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
flags: unittests | |
files: .tox/coverage.xml | |
fail_ci_if_error: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
check: | |
name: Run ${{ matrix.tox_env }} check | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
tox_env: | |
- type | |
- dev | |
- docs | |
- pkg_meta | |
- readme | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v5 | |
- name: Install tox | |
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv | |
- name: Setup check suite | |
run: tox r -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }} | |
env: | |
UV_PYTHON_PREFERENCE: "only-managed" | |
- name: Run check for ${{ matrix.tox_env }} | |
run: tox run --skip-uv-sync --skip-pkg-install -e ${{ matrix.tox_env }} | |
env: | |
UV_PYTHON_PREFERENCE: "only-managed" |