diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 146acadde..b8ce2b9a3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,6 +58,9 @@ jobs: - name: Checkout code uses: actions/checkout@v7 + - name: Setup just + uses: extractions/setup-just@v4 + # Use main until support for architecture lands - name: Setup .NET uses: actions/setup-dotnet@main @@ -85,23 +88,23 @@ jobs: - name: Embedding tests (Mono/.NET Framework) if: always() - run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net472 --logger "console;verbosity=detailed" src/embed_tests/ + run: just test-embed-mono ${{ matrix.os.platform }} - name: Embedding tests (.NET Core) if: always() - run: dotnet test --runtime any-${{ matrix.os.platform }} --framework net10.0 --logger "console;verbosity=detailed" src/embed_tests/ + run: just test-embed-core ${{ matrix.os.platform }} - name: Python Tests (.NET Core) if: always() - run: pytest --runtime coreclr + run: just test-python-coreclr - name: Python Tests (Mono) if: always() - run: uv run pytest --runtime mono -v -o faulthandler_timeout=60 + run: just test-python-mono - name: Python Tests (.NET Framework) if: ${{ matrix.os.category == 'windows' }} - run: pytest --runtime netfx + run: just test-python-netfx - name: Python tests run from .NET - run: dotnet test --runtime any-${{ matrix.os.platform }} src/python_tests_runner/ + run: just test-python-from-dotnet ${{ matrix.os.platform }} diff --git a/.github/workflows/nuget-preview.yml b/.github/workflows/nuget-preview.yml index ec39c8d8a..75e8206f6 100644 --- a/.github/workflows/nuget-preview.yml +++ b/.github/workflows/nuget-preview.yml @@ -23,6 +23,9 @@ jobs: - name: Checkout code uses: actions/checkout@v7 + - name: Setup just + uses: extractions/setup-just@v4 + - name: Setup .NET uses: actions/setup-dotnet@v6 with: @@ -44,10 +47,10 @@ jobs: echo PYTHONNET_PYDLL=$(python -m find_libpython) >> $GITHUB_ENV - name: Python Tests - run: pytest + run: just test-python - name: Embedding tests - run: dotnet test --runtime any-ubuntu src/embed_tests/ + run: just test-embed any-ubuntu - name: Pack run: dotnet pack --configuration Release --version-suffix preview${{env.DATE_VER}} --output "Release-Preview" diff --git a/Justfile b/Justfile index b5228e2e0..be0696141 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,8 @@ default: @just --choose +default_platform := if arch() == "x86_64" { "x64" } else if arch() == "aarch64" { "arm64" } else { arch() } + setup: dotnet restore uv sync @@ -11,4 +13,40 @@ docs: build-wheels: uv build - uv build --wheel -C="--global-option=--net46-support" \ No newline at end of file + uv build --wheel -C="--global-option=--net46-support" + +# Run default tests (.NET Core Python and embedding tests) +test: test-python-coreclr test-embed-core + +# Run Python tests (default or pass options like --runtime coreclr) +test-python *args: + uv run pytest {{ args }} + +# Run Python tests with .NET Core +test-python-coreclr *args: + uv run pytest --runtime coreclr {{ args }} + +# Run Python tests with Mono +test-python-mono *args: + uv run pytest --runtime mono {{ args }} + +# Run Python tests with .NET Framework +test-python-netfx *args: + uv run pytest --runtime netfx {{ args }} + +# Run Python tests executed via .NET test runner +test-python-from-dotnet platform=default_platform *args: + dotnet test --runtime any-{{ platform }} src/python_tests_runner/ {{ args }} + +# Run embedding tests +test-embed runtime=("any-" + default_platform) *args: + dotnet test --runtime {{ runtime }} src/embed_tests/ {{ args }} + +# Run embedding tests with .NET Core +test-embed-core platform=default_platform *args: + dotnet test --runtime any-{{ platform }} --framework net10.0 --logger "console;verbosity=detailed" src/embed_tests/ {{ args }} + +# Run embedding tests with Mono / .NET Framework +[env("MONO_THREADS_SUSPEND", "preemptive")] +test-embed-mono platform=default_platform *args: + dotnet test --runtime any-{{ platform }} --framework net472 --logger "console;verbosity=detailed" src/embed_tests/ {{ args }}