Skip to content

Commit 1a5ca7c

Browse files
committed
Use uv
1 parent 9556025 commit 1a5ca7c

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

.github/workflows/main.yml

+12-15
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
# This fails in pytest with:
3838
# CSC : error CS4023: /platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe [D:\a\pythonnet\pythonnet\src\runtime\Python.Runtime.csproj]
3939
exclude:
40-
- os:
40+
- os:
4141
category: windows
4242
platform: x86
4343
python: "3.13"
@@ -58,8 +58,10 @@ jobs:
5858
dotnet-version: '6.0.x'
5959

6060
- name: Install the latest version of uv
61-
uses: astral-sh/setup-uv@v3
61+
uses: astral-sh/setup-uv@v4
6262
with:
63+
architecture: ${{ matrix.os.platform }}
64+
python-version: ${{ matrix.python }}
6365
enable-cache: true
6466

6567
- name: Install dependencies
@@ -70,42 +72,37 @@ jobs:
7072
- name: Set Python DLL path and PYTHONHOME (non Windows)
7173
if: ${{ matrix.os.category != 'windows' }}
7274
run: |
73-
echo PYTHONNET_PYDLL=$(uv run find_libpython) >> $GITHUB_ENV
74-
echo PYTHONHOME=$(uv run python -c 'import sys; print(sys.prefix)') >> $GITHUB_ENV
75+
echo PYTHONNET_PYDLL=$(uv run python -m find_libpython) >> $GITHUB_ENV
7576
7677
- name: Set Python DLL path and PYTHONHOME (Windows)
7778
if: ${{ matrix.os.category == 'windows' }}
7879
run: |
79-
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONNET_PYDLL=$(uv run find_libpython)"
80-
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONHOME=$(uv run python -c 'import sys; print(sys.prefix)')"
80+
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONNET_PYDLL=$(uv run python -m find_libpython)"
8181
8282
- name: Embedding tests
83-
if: ${{ matrix.python != '3.13' }}
84-
run: dotnet test --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/embed_tests/
83+
run: uv run dotnet test --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/embed_tests/
8584
env:
8685
MONO_THREADS_SUSPEND: preemptive # https://github.com/mono/mono/issues/21466
8786

8887
- name: Python Tests (Mono)
8988
if: ${{ matrix.os.category != 'windows' }}
90-
run: uv run pytest --runtime mono
89+
run: uv run python -m pytest --runtime mono
9190

9291
# TODO: Run these tests on Windows x86
9392
- name: Python Tests (.NET Core)
9493
if: ${{ matrix.os.platform == 'x64' }}
95-
run: uv run pytest --runtime coreclr
94+
run: uv run python -m pytest --runtime coreclr
9695

9796
- name: Python Tests (.NET Framework)
9897
if: ${{ matrix.os.category == 'windows' }}
99-
run: uv run pytest --runtime netfx
98+
run: uv run python -m pytest --runtime netfx
10099

101100
- name: Python tests run from .NET
102-
if: ${{ matrix.python != '3.13' }}
103-
run: dotnet test --runtime any-${{ matrix.os.platform }} src/python_tests_runner/
101+
run: uv run dotnet test --runtime any-${{ matrix.os.platform }} src/python_tests_runner/
104102

105103
- name: Perf tests
106104
if: ${{ (matrix.python == '3.8') && (matrix.os.platform == 'x64') }}
107105
run: |
108106
uv pip install --force --no-deps --target src/perf_tests/baseline/ pythonnet==2.5.2
109-
dotnet test --configuration Release --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/perf_tests/
110-
107+
uv run dotnet test --configuration Release --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/perf_tests/
111108
# TODO: Run mono tests on Windows?

0 commit comments

Comments
 (0)