Use .NET 8.0 and uv in CI #1521
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Main | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| build-test: | |
| name: Build and Test | |
| runs-on: ${{ matrix.os.instance }} | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - category: windows | |
| platform: x86 | |
| instance: windows-latest | |
| - category: windows | |
| platform: x64 | |
| instance: windows-latest | |
| - category: ubuntu | |
| platform: x64 | |
| instance: ubuntu-22.04 | |
| - category: macos | |
| platform: x64 | |
| instance: macos-13 | |
| python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| # This fails in pytest with: | |
| # 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] | |
| exclude: | |
| - os: | |
| category: windows | |
| platform: x86 | |
| python: "3.13" | |
| steps: | |
| - name: Set Environment on macOS | |
| uses: maxim-lobanov/setup-xamarin@v1 | |
| if: ${{ matrix.os.category == 'macos' }} | |
| with: | |
| mono-version: latest | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| architecture: ${{ matrix.os.platform }} | |
| python-version: ${{ matrix.python }} | |
| activate-environment: true | |
| enable-cache: true | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Set Python DLL path and PYTHONHOME (non Windows) | |
| if: ${{ matrix.os.category != 'windows' }} | |
| run: | | |
| echo PYTHONNET_PYDLL=$(find_libpython) >> $GITHUB_ENV | |
| echo PYTHONHOME=.venv >> $GITHUB_ENV | |
| - name: Set Python DLL path and PYTHONHOME (Windows) | |
| if: ${{ matrix.os.category == 'windows' }} | |
| run: | | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONNET_PYDLL=$(find_libpython)" | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONHOME=.venv" | |
| # - name: Embedding tests | |
| # run: dotnet test --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/embed_tests/ | |
| # env: | |
| # MONO_THREADS_SUSPEND: preemptive # https://github.com/mono/mono/issues/21466 | |
| - name: Python Tests (Mono) | |
| if: ${{ matrix.os.category != 'windows' }} | |
| run: pytest --runtime mono | |
| # TODO: Run these tests on Windows x86 | |
| - name: Python Tests (.NET Core) | |
| if: ${{ matrix.os.platform == 'x64' }} | |
| run: pytest --runtime coreclr | |
| - name: Python Tests (.NET Framework) | |
| if: ${{ matrix.os.category == 'windows' }} | |
| run: pytest --runtime netfx | |
| - name: Python tests run from .NET | |
| run: dotnet test --runtime any-${{ matrix.os.platform }} src/python_tests_runner/ |