Skip to content

Commit 34cbb8d

Browse files
authored
Clean up gha python setup (#214)
* Remove settings job Turns out the setup-python action already looks for and respects the `.python-version` pin. Easy mode. * Use correct python version * Remove python-setup * Remove only system flag * no-config parameter is not needed
1 parent d212a47 commit 34cbb8d

File tree

2 files changed

+2
-40
lines changed

2 files changed

+2
-40
lines changed

.github/workflows/python-tests.yml

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: "python tests and coverage"
22
# Uses:
3-
# https://github.com/actions/setup-python : v5.6.0 a26af69be951a213d495a4c3e4e4022e16d87065
43
# https://github.com/actions/checkout : v4.2.2 11bd71901bbe5b1630ceea73d27597364c9af683
54
# https://github.com/actions/download-artifact : v5.0.0 634f93cb2916e3fdff6788551b99b062d0335ce0
65
# https://github.com/actions/upload-artifact : v4.6.2 ea165f8d65b6e75b540449e92b4886f43607fa02
@@ -14,24 +13,9 @@ on:
1413
branches:
1514
- "main"
1615

17-
env:
18-
UV_PYTHON_PREFERENCE: "only-system"
19-
2016
jobs:
21-
settings:
22-
runs-on: "ubuntu-latest"
23-
name: "Define workflow settings"
24-
steps:
25-
- name: "Repo checkout"
26-
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
27-
28-
- name: "Define settings"
29-
run: |
30-
echo "python_version=$(<.python-version)" >> $GITHUB_OUTPUT
31-
3217
run-tests-and-coverage:
3318
name: "Run nox for tests and coverage"
34-
needs: "settings"
3519
runs-on: "${{ matrix.os }}"
3620
strategy:
3721
fail-fast: false
@@ -51,12 +35,6 @@ jobs:
5135
- name: "Repo checkout"
5236
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
5337

54-
- name: "Set up Python ${{ matrix.python-version }}"
55-
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
56-
with:
57-
python-version: "${{ matrix.python-version }}"
58-
allow-prereleases: true
59-
6038
- name: "Install the latest version of uv"
6139
uses: "astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc"
6240
with:
@@ -65,7 +43,7 @@ jobs:
6543
enable-cache: true
6644

6745
- name: "Run tests and coverage via nox"
68-
run: "uvx nox --session test -- partial-coverage no-config"
46+
run: "uvx nox --session test -- partial-coverage"
6947

7048
- name: "Save coverage artifact"
7149
uses: "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
@@ -77,22 +55,16 @@ jobs:
7755

7856
coverage-compile:
7957
name: "coverage compile"
80-
needs: ["settings", "run-tests-and-coverage"]
58+
needs: "run-tests-and-coverage"
8159
runs-on: "ubuntu-latest"
8260
steps:
8361
- name: "Repo checkout"
8462
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
8563

86-
- name: "Set up Python"
87-
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
88-
with:
89-
python-version: ${{ steps.settings.outputs.python_version }}
90-
9164
- name: "Install the latest version of uv"
9265
uses: "astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc"
9366
with:
9467
version: "latest"
95-
python-version: ${{ steps.settings.outputs.python_version }}
9668
enable-cache: true
9769

9870
- name: "Download coverage artifacts"
@@ -117,22 +89,15 @@ jobs:
11789
11890
linters-and-formatters:
11991
name: "linters and formatters"
120-
needs: "settings"
12192
runs-on: "ubuntu-latest"
12293
steps:
12394
- name: "Repo checkout"
12495
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
12596

126-
- name: "Set up Python"
127-
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
128-
with:
129-
python-version: ${{ steps.settings.outputs.python_version }}
130-
13197
- name: "Install the latest version of uv"
13298
uses: "astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc"
13399
with:
134100
version: "latest"
135-
python-version: ${{ steps.settings.outputs.python_version }}
136101
enable-cache: true
137102

138103
- name: "Run linters and formatters"

noxfile.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ def run_tests_with_coverage(session: nox.Session) -> None:
6666
"""Run pytest in isolated environment, display coverage. Extra arguements passed to pytest."""
6767
partial = "partial-coverage" in session.posargs
6868
extra: list[str] = []
69-
if "no-config" in session.posargs:
70-
session.posargs.remove("no-config")
71-
extra = ["--no-config"]
7269

7370
session.run_install("uv", "sync", *SYNC_ARGS, *extra)
7471

0 commit comments

Comments
 (0)