Skip to content

Commit 6b7de33

Browse files
committed
Use uv in Github actions
1 parent 65b8000 commit 6b7de33

File tree

3 files changed

+61
-82
lines changed

3 files changed

+61
-82
lines changed

.github/actions/build-package/action.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,60 @@
11
name: release
22

3-
on:
3+
on:
44
push:
55
tags:
6-
- '*'
6+
- "*"
77

88
jobs:
9-
release-test:
10-
runs-on: ubuntu-22.04
11-
steps:
12-
- uses: actions/checkout@v4
13-
14-
- uses: ./.github/actions/build-package
15-
16-
- name: Set up a fresh environment and run tests
17-
run: |
18-
python -m venv venv
19-
source venv/bin/activate
20-
pip install dist/*.tar.gz
21-
pip install dist/*.whl
22-
pip install -e .[test]
23-
pytest
24-
25-
release:
26-
runs-on: ubuntu-22.04
27-
needs: release-test
28-
29-
steps:
30-
- uses: actions/checkout@v4
31-
32-
- name: Set up Python 3.8
33-
uses: actions/setup-python@v5
34-
with:
35-
python-version: 3.8
36-
37-
- name: Compare tags
38-
run: |
39-
PKG_VERSION=`grep '__version__' mapbox_tilesets/__init__.py | sed -E "s/^.*['\"](.*)['\"].*$/\1/"`
40-
echo "Checking that package version [v$PKG_VERSION] matches release tag [${{ github.ref_name }}]"
41-
[ "${{ github.ref_type }}" = "tag" ] && [ "${{ github.ref_name }}" = "v$PKG_VERSION" ]
42-
43-
- uses: ./.github/actions/build-package
44-
45-
- name: Run deployment
46-
run:
47-
twine upload dist/* -r pypi -u __token__ -p ${{ secrets.PYPI_PASSWORD }}
9+
release-test:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up uv
15+
uses: astral-sh/setup-uv@v4
16+
with:
17+
python-version: "3.10"
18+
19+
- name: Build package
20+
run: uv build
21+
22+
- name: Set up a fresh environment and run tests
23+
run: |
24+
uv venv
25+
uv pip install dist/*.tar.gz
26+
uv pip install dist/*.whl
27+
uv pip install pytest
28+
uv run pytest
29+
30+
release:
31+
runs-on: ubuntu-22.04
32+
needs: release-test
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Set up uv
38+
uses: astral-sh/setup-uv@v4
39+
with:
40+
python-version: "3.10"
41+
42+
- name: Compare tags
43+
run: |
44+
PKG_VERSION=`grep '__version__' mapbox_tilesets/__init__.py | sed -E "s/^.*['\"](.*)['\"].*$/\1/"`
45+
echo "Checking that package version [v$PKG_VERSION] matches release tag [${{ github.ref_name }}]"
46+
[ "${{ github.ref_type }}" = "tag" ] && [ "${{ github.ref_name }}" = "v$PKG_VERSION" ]
47+
48+
- name: Build package
49+
run: uv build
50+
51+
- name: Install Twine
52+
run: |
53+
uv venv
54+
uv pip install twine
55+
56+
- name: Validate deployment
57+
run: uv run twine check dist/*
58+
59+
- name: Run deployment
60+
run: uv run twine upload dist/* -r pypi -u __token__ -p ${{ secrets.PYPI_PASSWORD }}

.github/workflows/test.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,24 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919

20-
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v5
20+
- name: Set up uv
21+
uses: astral-sh/setup-uv@v4
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

2525
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install -e '.[estimate-area]'
29-
pip install pytest pytest-cov pre-commit codecov
26+
run: uv sync --group dev --extra estimate-area
3027

3128
- name: Show Python and pytest versions
3229
run: |
33-
python --version
34-
pytest --version
30+
uv run python --version
31+
uv run pytest --version
3532
3633
- name: Run pre-commit checks
37-
run: pre-commit run --all-files
34+
run: uv run pre-commit run --all-files
3835

3936
- name: Run tests with coverage
40-
run: pytest --cov --cov-config=.coveragerc --cov-report=xml
37+
run: uv run pytest --cov --cov-config=.coveragerc --cov-report=xml
4138

4239
- name: List all files in current directory
4340
run: ls -la

0 commit comments

Comments
 (0)