Skip to content

Commit b4e7c69

Browse files
[pre-commit.ci] pre-commit autoupdate (#34)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](pre-commit/pre-commit-hooks@v4.6.0...v5.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.3 → v0.6.9](astral-sh/ruff-pre-commit@v0.6.3...v0.6.9) * Migrate GHA to uv --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: S. Co1 <sco1.git@gmail.com>
1 parent b44450c commit b4e7c69

File tree

6 files changed

+261
-1274
lines changed

6 files changed

+261
-1274
lines changed

.github/workflows/lint_test.yml

+50-21
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,83 @@ jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414

15+
env:
16+
UV_CACHE_DIR: /tmp/.uv-cache
17+
1518
steps:
1619
- uses: actions/checkout@v4
17-
- name: Install Poetry for caching
18-
run: pipx install poetry
20+
21+
- name: Set up uv
22+
run: curl -LsSf https://astral.sh/uv/0.4.18/install.sh | sh
23+
1924
- name: Set up Python
2025
uses: actions/setup-python@v5
2126
with:
22-
python-version: '3.x'
23-
cache: 'poetry'
27+
python-version-file: "pyproject.toml"
28+
29+
- name: Restore uv cache
30+
uses: actions/cache@v4
31+
with:
32+
path: /tmp/.uv-cache
33+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
34+
restore-keys: |
35+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
36+
uv-${{ runner.os }}
2437
2538
- name: Install dependencies
26-
run: |
27-
python -m pip install -U pip setuptools importlib-metadata
28-
python -m pip install poetry
29-
poetry install
39+
run: uv sync --all-extras --dev
3040

3141
- name: Run mypy
32-
run: poetry run mypy .
42+
run: uv run mypy .
3343
if: always()
3444

45+
- name: Minimize uv cache
46+
run: uv cache prune --ci
47+
3548
test:
3649
runs-on: ubuntu-latest
3750
strategy:
3851
matrix:
3952
python-version: ["3.10", "3.11", "3.12", "3.13-dev"]
4053
fail-fast: false
4154

55+
env:
56+
UV_CACHE_DIR: /tmp/.uv-cache
57+
4258
steps:
4359
- uses: actions/checkout@v4
44-
- name: Install Poetry for caching
45-
run: pipx install poetry
60+
61+
- name: Set up uv
62+
run: curl -LsSf https://astral.sh/uv/0.4.18/install.sh | sh
4663

4764
- name: Set up (release) Python ${{ matrix.python-version }}
4865
uses: actions/setup-python@v5
4966
if: "!endsWith(matrix.python-version, '-dev')"
5067
with:
5168
python-version: ${{ matrix.python-version }}
52-
cache: 'poetry'
5369

5470
- name: Set up (deadsnakes) Python ${{ matrix.python-version }}
5571
uses: deadsnakes/action@v3.1.0
5672
if: endsWith(matrix.python-version, '-dev')
5773
with:
5874
python-version: ${{ matrix.python-version }}
5975

76+
- name: Restore uv cache
77+
uses: actions/cache@v4
78+
with:
79+
path: /tmp/.uv-cache
80+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
81+
restore-keys: |
82+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
83+
uv-${{ runner.os }}
84+
6085
- name: Install dependencies
6186
run: |
62-
python -m pip install -U pip setuptools importlib-metadata
63-
pip install tox-gh-actions
87+
uv venv
88+
uv pip install tox-gh-actions tox-uv
6489
6590
- name: Run tests w/tox
66-
run: tox
91+
run: uv run tox
6792

6893
- name: Cache coverage for ${{ matrix.python-version }}
6994
uses: actions/upload-artifact@v4
@@ -73,16 +98,20 @@ jobs:
7398
if-no-files-found: error
7499
include-hidden-files: true
75100

101+
- name: Minimize uv cache
102+
run: uv cache prune --ci
103+
76104
combine-cov:
77105
runs-on: ubuntu-latest
78106
needs: test
79107

80108
steps:
81109
- uses: actions/checkout@v4
110+
82111
- name: Set up Python
83112
uses: actions/setup-python@v5
84113
with:
85-
python-version: '3.x'
114+
python-version-file: "pyproject.toml"
86115

87116
- name: Pull coverage workflow artifacts
88117
uses: actions/download-artifact@v4
@@ -91,17 +120,17 @@ jobs:
91120

92121
- name: Install cov & combine
93122
run: |
94-
pip install coverage
123+
python -m pip install coverage
95124
coverage combine ./cov_cache/**/.coverage
96125
97126
- name: Report coverage
98127
run: |
99-
echo '**Combined Coverage**' >> $GITHUB_STEP_SUMMARY
100-
echo '```' >> $GITHUB_STEP_SUMMARY
101-
coverage report -m --skip-covered >> $GITHUB_STEP_SUMMARY
102-
echo '```' >> $GITHUB_STEP_SUMMARY
103128
coverage html
104129
130+
# Report a markdown version to the action summary
131+
echo '**Combined Coverage**' >> $GITHUB_STEP_SUMMARY
132+
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
133+
105134
- name: Publish cov HTML
106135
uses: actions/upload-artifact@v4
107136
with:

.github/workflows/pypi_release.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,22 @@ jobs:
88
build:
99
name: Build dist & publish
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
1113

1214
steps:
1315
- uses: actions/checkout@v4
16+
17+
- name: Set up uv
18+
run: curl -LsSf https://astral.sh/uv/0.4.18/install.sh | sh
19+
1420
- name: Set up Python
1521
uses: actions/setup-python@v5
1622
with:
17-
python-version: '3.x'
23+
python-version-file: "pyproject.toml"
1824

19-
- name: Install build dependencies & build
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install poetry
23-
poetry build
25+
- name: Build package
26+
run: uvx --from build pyproject-build --installer uv
2427

2528
- name: Publish to PyPI
2629
uses: pypa/gh-action-pypi-publish@release/v1.9

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ci:
33

44
repos:
55
- repo: https://github.com/psf/black
6-
rev: 24.8.0
6+
rev: 24.10.0
77
hooks:
88
- id: black
99
- repo: https://github.com/pycqa/isort
@@ -18,7 +18,7 @@ repos:
1818
additional_dependencies:
1919
- flake8-annotations
2020
- repo: https://github.com/pre-commit/pre-commit-hooks
21-
rev: v4.6.0
21+
rev: v5.0.0
2222
hooks:
2323
- id: check-case-conflict
2424
- id: check-json
@@ -35,6 +35,6 @@ repos:
3535
- id: python-check-blanket-type-ignore
3636
- id: python-use-type-annotations
3737
- repo: https://github.com/astral-sh/ruff-pre-commit
38-
rev: v0.6.3
38+
rev: v0.6.9
3939
hooks:
4040
- id: ruff

0 commit comments

Comments
 (0)