Skip to content

Commit 4164b5f

Browse files
nekealqwencoder
andcommitted
Migrate all GitHub workflows to uv and astral-sh/setup-uv
- Replace custom python-uv-env action with official astral-sh/setup-uv@v7 - Update test.yml, release.yml, draft_release.yml, cookiecutter.yml, dependencies.yml - Use uv for building, publishing, and running commands - Update actionlint version to 1.7.11 - Use prek for pre-commit checks (installed via pip) - Disable uv caching as requested Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent a3da9f1 commit 4164b5f

8 files changed

Lines changed: 65 additions & 77 deletions

File tree

.github/workflows/test.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
steps:
99
- uses: actions/checkout@v4
1010
- name: Download actionlint
11-
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.21
11+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.11
1212
shell: bash
1313
- name: Check workflow files
1414
run: ./actionlint -color
@@ -19,22 +19,28 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v4
22-
- uses: actions/setup-python@v5
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v7
2324
with:
25+
enable-cache: false
2426
python-version: "3.12"
25-
- run: python -m pip install pre-commit
26-
- run: pre-commit run --all-files
27+
- name: Install prek
28+
run: uv pip install prek
29+
- run: prek run --all-files
2730

2831
test:
2932
runs-on: ubuntu-latest
3033

3134
steps:
3235
- uses: actions/checkout@v4
33-
- uses: actions/setup-python@v5
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v7
3438
with:
39+
enable-cache: false
3540
python-version: "3.12"
36-
- run: python -m pip install cookiecutter pytest pyyaml toml uv
37-
- run: pytest
41+
- run: uv pip install cookiecutter pytest pyyaml toml
42+
- run: uv sync
43+
- run: uv run pytest
3844

3945
lint-generated-project:
4046
runs-on: ubuntu-latest
@@ -45,7 +51,7 @@ jobs:
4551
with:
4652
python-version: "3.12"
4753
- run: python -m pip install cookiecutter uv prek
48-
- run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.21
54+
- run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.11
4955
- name: Generate project
5056
run: |
5157
cookiecutter --config-file tests/context.yaml --no-input .

{{cookiecutter.project_slug}}/.github/actions/python-poetry-env/action.yml

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

{{cookiecutter.project_slug}}/.github/actions/python-uv-env/action.yml

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

{{cookiecutter.project_slug}}/.github/workflows/cookiecutter.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
python-version: "3.12"
1616

1717
- name: Install dependencies
18-
run: python -m pip install cruft poetry jello tabulate
18+
run: python -m pip install cruft jello tabulate prek
1919

2020
- name: Update project structure
2121
run: |
@@ -25,12 +25,12 @@ jobs:
2525
id: changes
2626
run: echo "::set-output name=changed::$(git status --porcelain | wc -l)"
2727

28-
- name: apply additional changes and fixes
28+
- name: Apply additional changes and fixes
2929
if: steps.changes.outputs.changed > 0
3030
run: |
31-
poetry lock --no-update # add new dependencies
32-
poetry install
33-
poetry run pre-commit run -a || true # we have to fix other issues manually
31+
uv lock # add new dependencies
32+
uv sync
33+
prek run --all-files
3434
3535
- name: Get template versions
3636
id: get_versions

{{cookiecutter.project_slug}}/.github/workflows/dependencies.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,29 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12-
- uses: ./.github/actions/python-poetry-env
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v7
14+
with:
15+
enable-cache: false
16+
python-version: "{{ cookiecutter._python_version_specs[cookiecutter.python_version]['versions'][0] }}"
1317

1418
- name: Install tabulate
15-
run: python -m pip install tabulate
19+
run: uv pip install tabulate
1620

1721
- name: Gather outdated dependencies
1822
id: check_for_outdated_dependencies
1923
run: |
20-
body=$(poetry show -o -n)
21-
echo ::set-output name="body::$body"
24+
body=$(uv pip list --outdated --format json)
25+
if [ "$body" != "[]" ]; then
26+
echo ::set-output name="body::$body"
27+
fi
2228
23-
- name: Format PR message
29+
- name: Format PR Message
2430
if: ${{ steps.check_for_outdated_dependencies.outputs.body != 0 }}
2531
id: get_outdated_dependencies
2632
shell: bash
2733
run: |
28-
body=$(poetry show -o -n | sed 's/(!)//' | awk 'BEGIN {print "Package","Used","Update"}; {print $1,$2,$3}' | tabulate --header --format github -)
34+
body=$(echo '${{ steps.check_for_outdated_dependencies.outputs.body }}' | jq -r '.[] | "\(.name) \(.version) \(.latest_version)"' | awk 'BEGIN {print "Package","Used","Latest"}; {print $1,$2,$3}' | tabulate --header --format github -)
2935
body=$(cat <<EOF
3036
The following packages are outdated
3137
@@ -39,7 +45,7 @@ jobs:
3945
4046
- name: Update outdated packages
4147
if: ${{ steps.check_for_outdated_dependencies.outputs.body != 0 }}
42-
run: poetry lock
48+
run: uv lock
4349

4450
# behaviour if PR already exists: https://github.com/marketplace/actions/create-pull-request#action-behaviour
4551
- name: Create Pull Request

{{cookiecutter.project_slug}}/.github/workflows/draft_release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,25 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: ./.github/actions/python-poetry-env
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v7
18+
with:
19+
enable-cache: false
20+
python-version: "{{ cookiecutter._python_version_specs[cookiecutter.python_version]['versions'][0] }}"
1721
- name: Update version
1822
id: updated_version
1923
shell: bash
2024
run: |
21-
poetry version ${{ github.event.inputs.version }}
22-
version=$(poetry version --short)
25+
uv version ${{ github.event.inputs.version }}
26+
version=$(uv version --short)
2327
echo ::set-output name="version::$version"
2428
- name: Update changelog
2529
id: changelog
2630
shell: bash
2731
run: |
28-
poetry run kacl-cli release ${{ steps.updated_version.outputs.version }} --modify --auto-link
32+
uv run kacl-cli release ${{ steps.updated_version.outputs.version }} --modify --auto-link
2933
echo "" >> CHANGELOG.md
30-
body=$(poetry run kacl-cli get ${{ steps.updated_version.outputs.version }})
34+
body=$(uv run kacl-cli get ${{ steps.updated_version.outputs.version }})
3135
body="${body//'%'/'%25'}"
3236
body="${body//$'\n'/'%0A'}"
3337
body="${body//$'\r'/'%0D'}"

{{cookiecutter.project_slug}}/.github/workflows/release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12-
- uses: ./.github/actions/python-poetry-env
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v7
14+
with:
15+
enable-cache: false
16+
python-version: "{{ cookiecutter._python_version_specs[cookiecutter.python_version]['versions'][0] }}"
1317
- name: Publish to pypi
14-
run: |
15-
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
16-
poetry publish --build --no-interaction
18+
run: uv publish --build
1719
- name: Deploy docs
18-
run: poetry run mkdocs gh-deploy --force{% endraw +%}
20+
run: uv run mkdocs gh-deploy --force{% endraw +%}

{{cookiecutter.project_slug}}/.github/workflows/test.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: Download actionlint
15-
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.21
15+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.11
1616
shell: bash
1717
- name: Check workflow files
1818
run: ./actionlint -color
@@ -30,9 +30,15 @@ jobs:
3030
runs-on: ubuntu-latest
3131
steps:
3232
- uses: actions/checkout@v4
33-
- uses: ./.github/actions/python-uv-env
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v7
35+
with:
36+
enable-cache: false
37+
python-version: "3.12"
38+
- name: Install prek
39+
run: uv pip install prek
3440
- run: prek run --all-files
35-
{%- endraw %}
41+
{%- endraw %}
3642

3743
test:
3844
runs-on: ubuntu-latest
@@ -42,14 +48,20 @@ jobs:
4248
python-version: {{ cookiecutter._python_version_specs[cookiecutter.python_version].versions }}
4349
steps:
4450
- uses: actions/checkout@v4
45-
- uses: ./.github/actions/python-uv-env
51+
- name: Install uv
52+
uses: astral-sh/setup-uv@v7
4653
with:
54+
enable-cache: false
4755
python-version: {% raw %}${{ matrix.python-version }}{% endraw +%}
4856
- run: uv run pytest
4957

5058
docs:
5159
runs-on: ubuntu-latest
5260
steps:
5361
- uses: actions/checkout@v4
54-
- uses: ./.github/actions/python-uv-env
62+
- name: Install uv
63+
uses: astral-sh/setup-uv@v7
64+
with:
65+
enable-cache: false
66+
python-version: "3.12"
5567
- run: uv run mkdocs build

0 commit comments

Comments
 (0)