From 45a7281cbbfd1fa11411190b3e0e641d9ab901d7 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Mon, 28 Sep 2026 12:53:52 +0200 Subject: [PATCH] Move test executions to Justfile --- .github/workflows/main.yml | 15 ++++++----- .github/workflows/nuget-preview.yml | 7 +++-- Justfile | 40 ++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bae02377f..9746390b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,6 +56,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 @@ -83,25 +86,25 @@ 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 }} env: MONO_THREADS_SUSPEND: preemptive # https://github.com/mono/mono/issues/21466 - 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: pytest --runtime mono + 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 }}