Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv in CI #72

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11" # XXX: change once interrogate works on 3.12
cache: pip
python-version-file: .python-version-default
- uses: hynek/setup-cached-uv@v2

- name: Install & run tox
run: |
python -Im pip install tox
python -Im tox run -e lint -- --show-diff-on-failure
- run: >
uvx --with tox-uv
tox run -e lint -- --show-diff-on-failure

tests:
name: Tests on ${{ matrix.python-version }}
Expand All @@ -50,7 +49,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip
- uses: hynek/setup-cached-uv@v2

- name: Prepare tox & run tests
run: |
Expand All @@ -62,11 +61,13 @@ jobs:
V=py$(echo $V | tr -d .)
fi

python -Im pip install tox
python -Im tox run -f "$V"
uvx --with tox-uv \
tox run -f "$V"

- name: Run Mypy on API
run: python -Im tox run -e mypy-api
run: >
uvx --with tox-uv
tox run -e mypy-api

- name: Upload coverage data
uses: actions/upload-artifact@v4
Expand All @@ -86,7 +87,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version-file: .python-version-default
cache: pip
- uses: hynek/setup-cached-uv@v2

- uses: actions/download-artifact@v4
with:
Expand All @@ -95,16 +96,16 @@ jobs:

- name: Combine coverage & fail if it's <100%
run: |
python -Im pip install coverage[toml]
uv tool install coverage[toml]

python -Im coverage combine
python -Im coverage html --skip-covered --skip-empty
coverage combine
coverage html --skip-covered --skip-empty

# Report and write to summary.
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY

# Report again and fail if under 100%.
python -Im coverage report --fail-under=100
coverage report --fail-under=100

- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v4
Expand All @@ -122,12 +123,11 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version-file: .python-version-default
cache: pip
- uses: hynek/setup-cached-uv@v2

- name: Install & run tox
run: |
python -Im pip install tox
python -Im tox run -e mypy-pkg
- run: >
uvx --with tox-uv
tox run -e mypy-pkg

install-dev:
strategy:
Expand Down Expand Up @@ -158,12 +158,11 @@ jobs:
with:
# Keep in sync with tox.ini/docs & .readthedocs.yaml
python-version: "3.12"
cache: pip
- uses: hynek/setup-cached-uv@v2

- name: Install & run tox
run: |
python -Im pip install tox
python -Im tox run -e docs
- run: >
uvx --with tox-uv
tox run -e docs

required-checks-pass:
name: Ensure everything required is passing for branch protection
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ commands =

[testenv:lint]
skip_install = true
deps = pre-commit
deps = pre-commit-uv
commands = pre-commit run --all-files {posargs}


Expand Down