11name : " python tests and coverage"
22# Uses:
3- # https://github.com/actions/setup-python : a26af69be951a213d495a4c3e4e4022e16d87065
4- # https://github.com/actions/checkout : 11bd71901bbe5b1630ceea73d27597364c9af683
5- # https://github.com/actions/download-artifact : d3f86a106a0bac45b974a628896c90dbdf5c8093
6- # https://github.com/actions/upload-artifact : ea165f8d65b6e75b540449e92b4886f43607fa02
3+ # https://github.com/actions/setup-python : v5.6.0 a26af69be951a213d495a4c3e4e4022e16d87065
4+ # https://github.com/actions/checkout : v4.2.2 11bd71901bbe5b1630ceea73d27597364c9af683
5+ # https://github.com/actions/download-artifact : v5.0.0 634f93cb2916e3fdff6788551b99b062d0335ce0
6+ # https://github.com/actions/upload-artifact : v4.6.2 ea165f8d65b6e75b540449e92b4886f43607fa02
7+ # https://github.com/astral-sh/setup-uv : v6.4.3 e92bafb6253dcd438e0484186d7669ea7a8ca1cc
78
89on :
910 pull_request :
1314 branches :
1415 - " main"
1516
17+ env :
18+ UV_PYTHON_PREFERENCE : " only-system"
19+ UV_LOCKED : " true"
20+
1621jobs :
1722 settings :
1823 runs-on : " ubuntu-latest"
1924 name : " Define workflow settings"
20- outputs :
21- default-python-version : " 3.12"
2225 steps :
2326 - name : " Define settings"
24- run : " "
27+ run : |
28+ echo "python_version=$(<.python-version)" >> $GITHUB_OUTPUT
2529
2630 run-tests-and-coverage :
27- name : " Run pytest with coverage."
28- needs : ["settings"]
31+ name : " Run nox for tests and coverage"
2932 runs-on : " ${{ matrix.os }}"
3033 strategy :
3134 fail-fast : false
3235 matrix :
3336 os :
34- - " macos-latest"
35- - " windows-latest"
37+ # - "macos-latest"
38+ # - "windows-latest"
3639 - " ubuntu-latest"
3740 python-version :
3841 - " 3.9"
@@ -52,13 +55,15 @@ jobs:
5255 python-version : " ${{ matrix.python-version }}"
5356 allow-prereleases : true
5457
55- - name : " Install nox"
56- run : |
57- python -m pip install --upgrade nox
58+ - name : " Install the latest version of uv"
59+ uses : " astral-sh/setup-uv@v6.4.3 e92bafb6253dcd438e0484186d7669ea7a8ca1cc"
60+ with :
61+ version : " latest"
62+ python-version : " ${{ matrix.python-version }}"
63+ enable-cache : true
5864
5965 - name : " Run tests and coverage via nox"
60- run : |
61- nox --session test -- partial-coverage
66+ run : " uv run nox --session test -- partial-coverage no-config"
6267
6368 - name : " Save coverage artifact"
6469 uses : " actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
6974 include-hidden-files : true
7075
7176 coverage-compile :
72- name : " Compile coverage reports. "
73- needs : ["settings", " run-tests-and-coverage"]
77+ name : " coverage compile "
78+ needs : " run-tests-and-coverage"
7479 runs-on : " ubuntu-latest"
7580 steps :
7681 - name : " Repo checkout"
@@ -79,28 +84,32 @@ jobs:
7984 - name : " Set up Python"
8085 uses : " actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
8186 with :
82- python-version : " ${{ needs .settings.outputs.default-python-version }}"
87+ python-version : ${{ steps .settings.outputs.python_version }}
8388
84- - name : " Install nox"
85- run : |
86- python -m pip install --upgrade nox
89+ - name : " Install the latest version of uv"
90+ uses : " astral-sh/setup-uv@v6.4.3 e92bafb6253dcd438e0484186d7669ea7a8ca1cc"
91+ with :
92+ version : " latest"
93+ python-version : ${{ steps.settings.outputs.python_version }}
94+ enable-cache : true
8795
8896 - name : " Download coverage artifacts"
89- uses : " actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 "
97+ uses : " actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 "
9098 with :
9199 pattern : " coverage-artifact-*"
92100 merge-multiple : true
93101
94- - name : " Compile coverage data, print report"
102+ - name : " Compile coverage data"
103+ run : " uv run nox --session combine"
104+
105+ - name : " Post summary to step summary."
95106 run : |
96- nox --session coverage_combine
97107 export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
98108 echo "TOTAL=$TOTAL" >> $GITHUB_ENV
99109 echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
100110
101- linting :
102- name : " Check linting and formatting requirements"
103- needs : ["settings"]
111+ linters-and-formatters :
112+ name : " linters and formattrs"
104113 runs-on : " ubuntu-latest"
105114 steps :
106115 - name : " Repo checkout"
@@ -109,12 +118,14 @@ jobs:
109118 - name : " Set up Python"
110119 uses : " actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
111120 with :
112- python-version : " ${{ needs .settings.outputs.default-python-version }}"
121+ python-version : ${{ steps .settings.outputs.python_version }}
113122
114- - name : " Install nox"
115- run : |
116- python -m pip install --upgrade nox
123+ - name : " Install the latest version of uv"
124+ uses : " astral-sh/setup-uv@v6.4.3 e92bafb6253dcd438e0484186d7669ea7a8ca1cc"
125+ with :
126+ version : " latest"
127+ python-version : ${{ steps.settings.outputs.python_version }}
128+ enable-cache : true
117129
118- - name : " Run formatters and linters"
119- run : |
120- nox --session lint
130+ - name : " Enforce strict type annotations with mypy"
131+ run : " uv run nox --session lint"
0 commit comments