@@ -12,13 +12,14 @@ name: unittest
1212permissions :
1313 contents : read
1414
15+
1516jobs :
1617 unit :
1718 runs-on : ubuntu-22.04
1819 strategy :
1920 fail-fast : true
2021 matrix :
21- python : ['3.9', '3.10' , "3.11", "3.12", "3.13", "3.14", "3.15"]
22+ python : ["3.10" , "3.11", "3.12", "3.13", "3.14", "3.15"]
2223 steps :
2324 - name : Checkout
2425 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
@@ -33,22 +34,46 @@ jobs:
3334 with :
3435 python-version : ${{ matrix.python }}
3536 allow-prereleases : true
36- # Caches compiled wheels locally to prevent building heavy libraries
37- # such as grpcio, which we build from scratch on every run for Python 3.15+.
38- # Follow https://github.com/grpc/grpc/issues/41010 for updates.
39- cache : ' pip'
37+ - name : Setup uv
38+ uses : astral-sh/setup-uv@v5
39+ with :
40+ enable-cache : true
41+ cache-dependency-glob : ' packages/**/testing/constraints*.txt'
4042 - name : Install nox
4143 run : |
42- python -m pip install --upgrade setuptools pip wheel
43- python -m pip install nox
44+ uv pip install --system nox nox-uv
45+ # Caches compiled wheels locally to prevent building heavy libraries
46+ # such as grpcio, which we build from scratch on every run for Python 3.15+.
47+ # Follow https://github.com/grpc/grpc/issues/41010 for updates.
48+ - name : Cache Built Python 3.15 Wheels
49+ if : matrix.python == '3.15'
50+ uses : actions/cache@v4
51+ with :
52+ path : .uv-wheel-cache
53+ key : ${{ runner.os }}-uv-wheels-3.15-${{ hashFiles('packages/**/testing/constraints*.txt') }}
54+ restore-keys : |
55+ ${{ runner.os }}-uv-wheels-3.15-
4456 - name : Run unit tests
4557 env :
4658 COVERAGE_FILE : ${{ github.workspace }}/.coverage-${{ matrix.python }}
4759 BUILD_TYPE : presubmit
4860 TARGET_BRANCH : ${{ github.base_ref || github.event.merge_group.base_ref }}
4961 TEST_TYPE : unit
5062 PY_VERSION : ${{ matrix.python }}
63+ # Workaround: Allows libcst to compile on Python 3.15+ while PyO3 catches up
64+ # Can be removed once libcst releases a version with native Python 3.15 wheels
65+ # Follow https://github.com/Instagram/LibCST/issues/1445 for updates.
66+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY : " 1"
5167 run : |
68+ # Only inject overrides if we are strictly on the 3.15 pre-release
69+ # This is needed to speed up builds
70+ if [ "${{ matrix.python }}" = "3.15" ]; then
71+ # Tell uv it is allowed to use the pre-release 3.15 toolchain
72+ export UV_PRERELEASE="allow"
73+
74+ # Route uv's wheel and environment cache to our persistent workspace directory
75+ export UV_CACHE_DIR="${{ github.workspace }}/.uv-wheel-cache"
76+ fi
5277 ci/run_conditional_tests.sh
5378 - name : Upload coverage results
5479 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
0 commit comments