From 195b6ff09d88151710cd149f14f75dc1d2be4ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 15:29:59 +0100 Subject: [PATCH 01/27] ci: Use PYTHON_VERSION consistently in tests workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee628ee3..4b7b1689 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,15 +19,17 @@ jobs: matrix: python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] os: [ubuntu-latest, macOS-latest, windows-latest] + env: + PYTHON_VERSION: ${{ matrix.python-version }} # Override the PYTHON_VERSION of the global env steps: - uses: actions/checkout@v4 - name: Set up uv uses: astral-sh/setup-uv@v5 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ env.PYTHON_VERSION }} - name: Install default (with full options) and test dependencies - run: uv pip install --python-version=${{ matrix.python-version }} -e '.[full]' --group test + run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group test - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - name: Upload results to Codecov From f1f83e70b08840a7843e5619fa6872e49e5565ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 15:48:53 +0100 Subject: [PATCH 02/27] Factorize some steps in tests.yml --- .github/workflows/tests.yml | 70 +++++++++++++++---------------------- 1 file changed, 28 insertions(+), 42 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4b7b1689..e8fd65ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,6 +10,20 @@ env: UV_NO_SYNC: 1 PYTHON_VERSION: 3.14 +x-common-steps: + - &checkout + uses: actions/checkout@v4 + - &setup-uv + name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + - &upload-codecov + name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + jobs: tests-full-install: name: Run tests with full install @@ -23,29 +37,20 @@ jobs: PYTHON_VERSION: ${{ matrix.python-version }} # Override the PYTHON_VERSION of the global env steps: - - uses: actions/checkout@v4 - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} + - *checkout + - *setup-uv - name: Install default (with full options) and test dependencies run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group test - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - - name: Upload results to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} + - *upload-codecov tests-default-install: name: Run (most) tests with default install runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} + - *checkout + - *setup-uv - name: Install default (without any option) and test dependencies run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e . --group test - name: Run unit and doc tests with coverage report @@ -55,43 +60,29 @@ jobs: --ignore tests/unit/aggregation/test_nash_mtl.py \ --ignore tests/doc/test_aggregation.py \ --cov=src --cov-report=xml - - name: Upload results to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} + + - *upload-codecov tests-float64: name: Run tests on float64 dtype runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} + - *checkout + - *setup-uv - name: Install default (with full options) and test dependencies run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group test - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml env: PYTEST_TORCH_DTYPE: float64 - - name: Upload results to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} + - *upload-codecov build-doc: name: Build doc runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - + - *checkout + - *setup-uv - name: Install dependencies (default with full options & doc) run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group doc @@ -103,13 +94,8 @@ jobs: name: Run mypy runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} + - *checkout + - *setup-uv - name: Install dependencies (default with full options & check) run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group check From 3a4e57d30f0e91aaf6695b0f007a5f26baf62972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 15:49:26 +0100 Subject: [PATCH 03/27] Add name to checkout step --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e8fd65ee..cb03c937 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,6 +12,7 @@ env: x-common-steps: - &checkout + name: Checkout repository uses: actions/checkout@v4 - &setup-uv name: Set up uv From 041d5091340df2a5830170f6a8ce3ceaa6141c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 15:55:39 +0100 Subject: [PATCH 04/27] Stop using x-common-steps --- .github/workflows/tests.yml | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cb03c937..c63bf8d8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,21 +10,6 @@ env: UV_NO_SYNC: 1 PYTHON_VERSION: 3.14 -x-common-steps: - - &checkout - name: Checkout repository - uses: actions/checkout@v4 - - &setup-uv - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - &upload-codecov - name: Upload results to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - jobs: tests-full-install: name: Run tests with full install @@ -38,13 +23,23 @@ jobs: PYTHON_VERSION: ${{ matrix.python-version }} # Override the PYTHON_VERSION of the global env steps: - - *checkout - - *setup-uv + - &checkout + name: Checkout repository + uses: actions/checkout@v4 + - &setup-uv + name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} - name: Install default (with full options) and test dependencies run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group test - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - - *upload-codecov + - &upload-codecov + name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} tests-default-install: name: Run (most) tests with default install From 95a237eaf48d5e4edf40d5f4fd1905c47aece7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 16:00:23 +0100 Subject: [PATCH 05/27] Remove possibly redundant --python-version when installing deps --- .github/workflows/build-deploy-docs.yml | 2 +- .github/workflows/tests.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-deploy-docs.yml b/.github/workflows/build-deploy-docs.yml index 891e42f5..8d02bd87 100644 --- a/.github/workflows/build-deploy-docs.yml +++ b/.github/workflows/build-deploy-docs.yml @@ -27,7 +27,7 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} - name: Install dependencies (default with full options & doc) - run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group doc + run: uv pip install -e '.[full]' --group doc - name: Determine deployment folder id: deploy_folder diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c63bf8d8..8b505713 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,7 +32,7 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Install default (with full options) and test dependencies - run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group test + run: uv pip install -e '.[full]' --group test - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - &upload-codecov @@ -48,7 +48,7 @@ jobs: - *checkout - *setup-uv - name: Install default (without any option) and test dependencies - run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e . --group test + run: uv pip install -e . --group test - name: Run unit and doc tests with coverage report run: | uv run pytest -W error tests/unit tests/doc \ @@ -66,7 +66,7 @@ jobs: - *checkout - *setup-uv - name: Install default (with full options) and test dependencies - run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group test + run: uv pip install -e '.[full]' --group test - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml env: @@ -80,7 +80,7 @@ jobs: - *checkout - *setup-uv - name: Install dependencies (default with full options & doc) - run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group doc + run: uv pip install -e '.[full]' --group doc - name: Build Documentation working-directory: docs @@ -94,7 +94,7 @@ jobs: - *setup-uv - name: Install dependencies (default with full options & check) - run: uv pip install --python-version=${{ env.PYTHON_VERSION }} -e '.[full]' --group check + run: uv pip install -e '.[full]' --group check - name: Run mypy run: uv run mypy src/torchjd From c6106e0d12159db733d914182ab40dc89054d92b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 17:04:32 +0100 Subject: [PATCH 06/27] Refactor ci: use composite actions --- .github/actions/install-deps/action.yml | 38 ++++++++++++ .github/actions/setup/action.yml | 18 ++++++ .github/actions/upload-codecov/action.yml | 10 +++ .github/workflows/build-deploy-docs.yml | 13 ++-- .github/workflows/release.yml | 11 +--- .github/workflows/tests.yml | 76 ++++++++++++----------- 6 files changed, 110 insertions(+), 56 deletions(-) create mode 100644 .github/actions/install-deps/action.yml create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/actions/upload-codecov/action.yml diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml new file mode 100644 index 00000000..e5f34fc7 --- /dev/null +++ b/.github/actions/install-deps/action.yml @@ -0,0 +1,38 @@ +name: Install Dependencies +description: Install package dependencies using uv + +inputs: + options: + description: 'Package options to install (space-separated, e.g., "full")' + required: false + default: '' + groups: + description: 'Dependency groups to install (space-separated, e.g., "test doc")' + required: false + default: '' + +runs: + using: composite + steps: + - name: Install dependencies (options=[${{ inputs.options }}], groups=[${{ inputs.groups }}]) + shell: bash + run: | + # Build the install command + cmd="uv pip install -e" + + # Add options if provided + if [ -n "${{ inputs.options }}" ]; then + # Convert space-separated options to comma-separated for brackets + options=$(echo "${{ inputs.options }}" | tr ' ' ',') + cmd="$cmd '.[$options]'" + else + cmd="$cmd ." + fi + + # Add groups + for group in ${{ inputs.groups }}; do + cmd="$cmd --group $group" + done + + # Execute the command + eval $cmd diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..479af0eb --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,18 @@ +name: Setup +description: Checkout repository and set up uv + +inputs: + python-version: + description: Python version to use + required: false + default: '3.14' + +runs: + using: composite + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ inputs.python-version }} diff --git a/.github/actions/upload-codecov/action.yml b/.github/actions/upload-codecov/action.yml new file mode 100644 index 00000000..b10b99b9 --- /dev/null +++ b/.github/actions/upload-codecov/action.yml @@ -0,0 +1,10 @@ +name: Upload to Codecov +description: Upload coverage results to Codecov + +runs: + using: composite + steps: + - name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/build-deploy-docs.yml b/.github/workflows/build-deploy-docs.yml index 8d02bd87..fb3dd035 100644 --- a/.github/workflows/build-deploy-docs.yml +++ b/.github/workflows/build-deploy-docs.yml @@ -8,7 +8,6 @@ on: env: UV_NO_SYNC: 1 - PYTHON_VERSION: '3.14' jobs: build-deploy-doc: @@ -18,16 +17,12 @@ jobs: permissions: contents: write steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: ./.github/actions/setup - - name: Set up uv - uses: astral-sh/setup-uv@v5 + - uses: ./.github/actions/install-deps with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Install dependencies (default with full options & doc) - run: uv pip install -e '.[full]' --group doc + options: full + groups: doc - name: Determine deployment folder id: deploy_folder diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 282ac671..8b49f07b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,9 +4,6 @@ on: release: types: [published] -env: - PYTHON_VERSION: 3.14 - jobs: pypi-publish: name: Publish to PyPI @@ -16,13 +13,7 @@ jobs: # IMPORTANT: this permission is mandatory for trusted publishing id-token: write steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} + - uses: ./.github/actions/setup - name: Build run: uv build diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8b505713..bb8a24b6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,6 @@ on: env: UV_NO_SYNC: 1 - PYTHON_VERSION: 3.14 jobs: tests-full-install: @@ -19,36 +18,32 @@ jobs: matrix: python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] os: [ubuntu-latest, macOS-latest, windows-latest] - env: - PYTHON_VERSION: ${{ matrix.python-version }} # Override the PYTHON_VERSION of the global env steps: - - &checkout - name: Checkout repository - uses: actions/checkout@v4 - - &setup-uv - name: Set up uv - uses: astral-sh/setup-uv@v5 + - uses: ./.github/actions/setup with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Install default (with full options) and test dependencies - run: uv pip install -e '.[full]' --group test + python-version: ${{ matrix.python-version }} + + - uses: ./.github/actions/install-deps + with: + options: full + groups: test + - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - - &upload-codecov - name: Upload results to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} + + - uses: ./.github/actions/upload-codecov tests-default-install: name: Run (most) tests with default install runs-on: ubuntu-latest steps: - - *checkout - - *setup-uv - - name: Install default (without any option) and test dependencies - run: uv pip install -e . --group test + - uses: ./.github/actions/setup + + - uses: ./.github/actions/install-deps + with: + groups: test + - name: Run unit and doc tests with coverage report run: | uv run pytest -W error tests/unit tests/doc \ @@ -57,30 +52,36 @@ jobs: --ignore tests/doc/test_aggregation.py \ --cov=src --cov-report=xml - - *upload-codecov + - uses: ./.github/actions/upload-codecov tests-float64: name: Run tests on float64 dtype runs-on: ubuntu-latest steps: - - *checkout - - *setup-uv - - name: Install default (with full options) and test dependencies - run: uv pip install -e '.[full]' --group test + - uses: ./.github/actions/setup + + - uses: ./.github/actions/install-deps + with: + options: full + groups: test + - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml env: PYTEST_TORCH_DTYPE: float64 - - *upload-codecov + + - uses: ./.github/actions/upload-codecov build-doc: name: Build doc runs-on: ubuntu-latest steps: - - *checkout - - *setup-uv - - name: Install dependencies (default with full options & doc) - run: uv pip install -e '.[full]' --group doc + - uses: ./.github/actions/setup + + - uses: ./.github/actions/install-deps + with: + options: full + groups: doc - name: Build Documentation working-directory: docs @@ -90,11 +91,12 @@ jobs: name: Run mypy runs-on: ubuntu-latest steps: - - *checkout - - *setup-uv + - uses: ./.github/actions/setup - - name: Install dependencies (default with full options & check) - run: uv pip install -e '.[full]' --group check + - uses: ./.github/actions/install-deps + with: + options: full + groups: check - - name: Run mypy - run: uv run mypy src/torchjd + - name: Run mypy + run: uv run mypy src/torchjd From e76503b45eeb26defed8832abc5cce20a6b6ea7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 17:10:55 +0100 Subject: [PATCH 07/27] Fix --- .../actions/{setup => setup-uv}/action.yml | 2 -- .github/workflows/build-deploy-docs.yml | 5 +++- .github/workflows/release.yml | 6 ++++- .github/workflows/tests.yml | 25 +++++++++++++++---- 4 files changed, 29 insertions(+), 9 deletions(-) rename .github/actions/{setup => setup-uv}/action.yml (83%) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup-uv/action.yml similarity index 83% rename from .github/actions/setup/action.yml rename to .github/actions/setup-uv/action.yml index 479af0eb..519104f8 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup-uv/action.yml @@ -10,8 +10,6 @@ inputs: runs: using: composite steps: - - name: Checkout repository - uses: actions/checkout@v4 - name: Set up uv uses: astral-sh/setup-uv@v5 with: diff --git a/.github/workflows/build-deploy-docs.yml b/.github/workflows/build-deploy-docs.yml index fb3dd035..fdaab4ea 100644 --- a/.github/workflows/build-deploy-docs.yml +++ b/.github/workflows/build-deploy-docs.yml @@ -17,7 +17,10 @@ jobs: permissions: contents: write steps: - - uses: ./.github/actions/setup + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-uv - uses: ./.github/actions/install-deps with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b49f07b..89d67d3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,11 @@ jobs: # IMPORTANT: this permission is mandatory for trusted publishing id-token: write steps: - - uses: ./.github/actions/setup + - name: Checkout repository + uses: actions/checkout@v4 + + + - uses: ./.github/actions/setup-uv - name: Build run: uv build diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bb8a24b6..2c182829 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,10 @@ jobs: os: [ubuntu-latest, macOS-latest, windows-latest] steps: - - uses: ./.github/actions/setup + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-uv with: python-version: ${{ matrix.python-version }} @@ -38,7 +41,10 @@ jobs: name: Run (most) tests with default install runs-on: ubuntu-latest steps: - - uses: ./.github/actions/setup + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-uv - uses: ./.github/actions/install-deps with: @@ -58,7 +64,10 @@ jobs: name: Run tests on float64 dtype runs-on: ubuntu-latest steps: - - uses: ./.github/actions/setup + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-uv - uses: ./.github/actions/install-deps with: @@ -76,7 +85,10 @@ jobs: name: Build doc runs-on: ubuntu-latest steps: - - uses: ./.github/actions/setup + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-uv - uses: ./.github/actions/install-deps with: @@ -91,7 +103,10 @@ jobs: name: Run mypy runs-on: ubuntu-latest steps: - - uses: ./.github/actions/setup + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-uv - uses: ./.github/actions/install-deps with: From 04f57809bd96f1bdb774cf228cc53f2b59ec9b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 17:19:07 +0100 Subject: [PATCH 08/27] Go back to using anchor for codecov --- .github/actions/upload-codecov/action.yml | 10 ---------- .github/workflows/tests.yml | 10 +++++++--- 2 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 .github/actions/upload-codecov/action.yml diff --git a/.github/actions/upload-codecov/action.yml b/.github/actions/upload-codecov/action.yml deleted file mode 100644 index b10b99b9..00000000 --- a/.github/actions/upload-codecov/action.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: Upload to Codecov -description: Upload coverage results to Codecov - -runs: - using: composite - steps: - - name: Upload results to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2c182829..65b2bced 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,7 +35,11 @@ jobs: - name: Run unit and doc tests with coverage report run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - - uses: ./.github/actions/upload-codecov + - &upload-codecov + name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} tests-default-install: name: Run (most) tests with default install @@ -58,7 +62,7 @@ jobs: --ignore tests/doc/test_aggregation.py \ --cov=src --cov-report=xml - - uses: ./.github/actions/upload-codecov + - *upload-codecov tests-float64: name: Run tests on float64 dtype @@ -79,7 +83,7 @@ jobs: env: PYTEST_TORCH_DTYPE: float64 - - uses: ./.github/actions/upload-codecov + - *upload-codecov build-doc: name: Build doc From 36fcb9297b59fb7caf01aa9904451a309deec375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 17:41:28 +0100 Subject: [PATCH 09/27] Factorize run-tests into its own composite action --- .github/actions/run-tests/action.yml | 41 ++++++++++++++++++++++++++++ .github/workflows/tests.yml | 20 +++++--------- 2 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 .github/actions/run-tests/action.yml diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml new file mode 100644 index 00000000..b77f67db --- /dev/null +++ b/.github/actions/run-tests/action.yml @@ -0,0 +1,41 @@ +name: Run Tests +description: Run unit and doc tests with coverage + +inputs: + ignores: + description: 'Space-separated list of test files to ignore' + required: false + default: '' + dtype: + description: 'Torch dtype to use for tests' + required: false + default: 'float32' + device: + description: 'Torch device to use for tests' + required: false + default: 'cpu' + +runs: + using: composite + steps: + - name: Run unit and doc tests with coverage report + shell: bash + env: + PYTEST_TORCH_DTYPE: ${{ inputs.dtype }} + PYTEST_TORCH_DEVICE: ${{ inputs.device }} + run: | + # Build the pytest command + cmd="uv run pytest -W error tests/unit tests/doc" + + # Add ignore flags for each file + if [ -n "${{ inputs.ignores }}" ]; then + for file in ${{ inputs.ignores }}; do + cmd="$cmd --ignore $file" + done + fi + + # Add coverage options + cmd="$cmd --cov=src --cov-report=xml" + + # Execute the command + eval $cmd diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 65b2bced..279de9b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,8 +32,7 @@ jobs: options: full groups: test - - name: Run unit and doc tests with coverage report - run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml + - uses: ./.github/actions/run-tests - &upload-codecov name: Upload results to Codecov @@ -54,13 +53,9 @@ jobs: with: groups: test - - name: Run unit and doc tests with coverage report - run: | - uv run pytest -W error tests/unit tests/doc \ - --ignore tests/unit/aggregation/test_cagrad.py \ - --ignore tests/unit/aggregation/test_nash_mtl.py \ - --ignore tests/doc/test_aggregation.py \ - --cov=src --cov-report=xml + - uses: ./.github/actions/run-tests + with: + ignores: tests/unit/aggregation/test_cagrad.py tests/unit/aggregation/test_nash_mtl.py tests/doc/test_aggregation.py - *upload-codecov @@ -78,10 +73,9 @@ jobs: options: full groups: test - - name: Run unit and doc tests with coverage report - run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - env: - PYTEST_TORCH_DTYPE: float64 + - uses: ./.github/actions/run-tests + with: + dtype: float64 - *upload-codecov From fff23ae7bbdae3e9a79ca45d05114d935e3fb70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 17:52:04 +0100 Subject: [PATCH 10/27] Add xfail_if_xyz_not_installed markers and use them instead of ignoring entire test files --- .github/actions/run-tests/action.yml | 20 +------------------- .github/workflows/tests.yml | 4 +--- tests/conftest.py | 20 ++++++++++++++++++++ tests/unit/aggregation/test_cagrad.py | 2 ++ tests/unit/aggregation/test_nash_mtl.py | 2 ++ tests/unit/aggregation/test_values.py | 23 ++++++++++++++++++++--- 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index b77f67db..66fdd770 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -2,10 +2,6 @@ name: Run Tests description: Run unit and doc tests with coverage inputs: - ignores: - description: 'Space-separated list of test files to ignore' - required: false - default: '' dtype: description: 'Torch dtype to use for tests' required: false @@ -24,18 +20,4 @@ runs: PYTEST_TORCH_DTYPE: ${{ inputs.dtype }} PYTEST_TORCH_DEVICE: ${{ inputs.device }} run: | - # Build the pytest command - cmd="uv run pytest -W error tests/unit tests/doc" - - # Add ignore flags for each file - if [ -n "${{ inputs.ignores }}" ]; then - for file in ${{ inputs.ignores }}; do - cmd="$cmd --ignore $file" - done - fi - - # Add coverage options - cmd="$cmd --cov=src --cov-report=xml" - - # Execute the command - eval $cmd + uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 279de9b2..31bad163 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,7 +41,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} tests-default-install: - name: Run (most) tests with default install + name: Run tests with default install runs-on: ubuntu-latest steps: - name: Checkout repository @@ -54,8 +54,6 @@ jobs: groups: test - uses: ./.github/actions/run-tests - with: - ignores: tests/unit/aggregation/test_cagrad.py tests/unit/aggregation/test_nash_mtl.py tests/doc/test_aggregation.py - *upload-codecov diff --git a/tests/conftest.py b/tests/conftest.py index a2921520..68f5a7a7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ import random as rand from contextlib import nullcontext +from importlib.util import find_spec import torch from pytest import RaisesExc, fixture, mark @@ -30,16 +31,35 @@ def pytest_addoption(parser): def pytest_configure(config): config.addinivalue_line("markers", "slow: mark test as slow to run") config.addinivalue_line("markers", "xfail_if_cuda: mark test as xfail if running on cuda") + config.addinivalue_line( + "markers", "xfail_if_cagrad_not_installed: mark test as xfail if CAGrad is not installed" + ) + config.addinivalue_line( + "markers", + "xfail_if_nashmtl_not_installed: mark test as xfail if NashMTL is not installed", + ) def pytest_collection_modifyitems(config, items): skip_slow = mark.skip(reason="Slow test. Use --runslow to run it.") xfail_cuda = mark.xfail(reason=f"Test expected to fail on {DEVICE}") + + # Check if optional dependencies are installed + cagrad_installed = all(find_spec(name) is not None for name in ["cvxpy", "clarabel"]) + nashmtl_installed = all(find_spec(name) is not None for name in ["cvxpy", "ecos"]) + + xfail_cagrad = mark.xfail(reason="CAGrad dependencies not installed") + xfail_nashmtl = mark.xfail(reason="NashMTL dependencies not installed") + for item in items: if "slow" in item.keywords and not config.getoption("--runslow"): item.add_marker(skip_slow) if "xfail_if_cuda" in item.keywords and str(DEVICE).startswith("cuda"): item.add_marker(xfail_cuda) + if "xfail_if_cagrad_not_installed" in item.keywords and not cagrad_installed: + item.add_marker(xfail_cagrad) + if "xfail_if_nashmtl_not_installed" in item.keywords and not nashmtl_installed: + item.add_marker(xfail_nashmtl) def pytest_make_parametrize_id(config, val, argname): diff --git a/tests/unit/aggregation/test_cagrad.py b/tests/unit/aggregation/test_cagrad.py index e604c087..ed73f0b1 100644 --- a/tests/unit/aggregation/test_cagrad.py +++ b/tests/unit/aggregation/test_cagrad.py @@ -10,6 +10,8 @@ from ._asserts import assert_expected_structure, assert_non_conflicting, assert_non_differentiable from ._inputs import scaled_matrices, typical_matrices +pytestmark = mark.xfail_if_cagrad_not_installed + scaled_pairs = [(CAGrad(c=0.5), matrix) for matrix in scaled_matrices] typical_pairs = [(CAGrad(c=0.5), matrix) for matrix in typical_matrices] requires_grad_pairs = [(CAGrad(c=0.5), ones_(3, 5, requires_grad=True))] diff --git a/tests/unit/aggregation/test_nash_mtl.py b/tests/unit/aggregation/test_nash_mtl.py index ce343e5d..661f090e 100644 --- a/tests/unit/aggregation/test_nash_mtl.py +++ b/tests/unit/aggregation/test_nash_mtl.py @@ -8,6 +8,8 @@ from ._asserts import assert_expected_structure, assert_non_differentiable from ._inputs import nash_mtl_matrices +pytestmark = mark.xfail_if_nashmtl_not_installed + def _make_aggregator(matrix: Tensor) -> NashMTL: return NashMTL(n_tasks=matrix.shape[0]) diff --git a/tests/unit/aggregation/test_values.py b/tests/unit/aggregation/test_values.py index 5fed3869..cce451a2 100644 --- a/tests/unit/aggregation/test_values.py +++ b/tests/unit/aggregation/test_values.py @@ -87,8 +87,22 @@ try: from torchjd.aggregation import CAGrad, CAGradWeighting - AGGREGATOR_PARAMETRIZATIONS.append((CAGrad(c=0.5), J_base, tensor([0.1835, 1.2041, 1.2041]))) - WEIGHTING_PARAMETRIZATIONS.append((CAGradWeighting(c=0.5), G_base, tensor([0.7041, 0.5000]))) + AGGREGATOR_PARAMETRIZATIONS.append( + param( + CAGrad(c=0.5), + J_base, + tensor([0.1835, 1.2041, 1.2041]), + marks=mark.xfail_if_cagrad_not_installed, + ) + ) + WEIGHTING_PARAMETRIZATIONS.append( + param( + CAGradWeighting(c=0.5), + G_base, + tensor([0.7041, 0.5000]), + marks=mark.xfail_if_cagrad_not_installed, + ) + ) except ImportError: pass @@ -100,7 +114,10 @@ NashMTL(n_tasks=2), J_base, tensor([0.0542, 0.7061, 0.7061]), - marks=mark.filterwarnings("ignore::UserWarning"), + marks=[ + mark.filterwarnings("ignore::UserWarning"), + mark.xfail_if_nashmtl_not_installed, + ], ) ) From 5ebe07776b66ee210137db30474671b29911cf97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 17:56:16 +0100 Subject: [PATCH 11/27] Revert "Add xfail_if_xyz_not_installed markers and use them instead of ignoring entire test files" This reverts commit fff23ae7bbdae3e9a79ca45d05114d935e3fb70c. --- .github/actions/run-tests/action.yml | 20 +++++++++++++++++++- .github/workflows/tests.yml | 4 +++- tests/conftest.py | 20 -------------------- tests/unit/aggregation/test_cagrad.py | 2 -- tests/unit/aggregation/test_nash_mtl.py | 2 -- tests/unit/aggregation/test_values.py | 23 +++-------------------- 6 files changed, 25 insertions(+), 46 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index 66fdd770..b77f67db 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -2,6 +2,10 @@ name: Run Tests description: Run unit and doc tests with coverage inputs: + ignores: + description: 'Space-separated list of test files to ignore' + required: false + default: '' dtype: description: 'Torch dtype to use for tests' required: false @@ -20,4 +24,18 @@ runs: PYTEST_TORCH_DTYPE: ${{ inputs.dtype }} PYTEST_TORCH_DEVICE: ${{ inputs.device }} run: | - uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml + # Build the pytest command + cmd="uv run pytest -W error tests/unit tests/doc" + + # Add ignore flags for each file + if [ -n "${{ inputs.ignores }}" ]; then + for file in ${{ inputs.ignores }}; do + cmd="$cmd --ignore $file" + done + fi + + # Add coverage options + cmd="$cmd --cov=src --cov-report=xml" + + # Execute the command + eval $cmd diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 31bad163..279de9b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,7 +41,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} tests-default-install: - name: Run tests with default install + name: Run (most) tests with default install runs-on: ubuntu-latest steps: - name: Checkout repository @@ -54,6 +54,8 @@ jobs: groups: test - uses: ./.github/actions/run-tests + with: + ignores: tests/unit/aggregation/test_cagrad.py tests/unit/aggregation/test_nash_mtl.py tests/doc/test_aggregation.py - *upload-codecov diff --git a/tests/conftest.py b/tests/conftest.py index 68f5a7a7..a2921520 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,5 @@ import random as rand from contextlib import nullcontext -from importlib.util import find_spec import torch from pytest import RaisesExc, fixture, mark @@ -31,35 +30,16 @@ def pytest_addoption(parser): def pytest_configure(config): config.addinivalue_line("markers", "slow: mark test as slow to run") config.addinivalue_line("markers", "xfail_if_cuda: mark test as xfail if running on cuda") - config.addinivalue_line( - "markers", "xfail_if_cagrad_not_installed: mark test as xfail if CAGrad is not installed" - ) - config.addinivalue_line( - "markers", - "xfail_if_nashmtl_not_installed: mark test as xfail if NashMTL is not installed", - ) def pytest_collection_modifyitems(config, items): skip_slow = mark.skip(reason="Slow test. Use --runslow to run it.") xfail_cuda = mark.xfail(reason=f"Test expected to fail on {DEVICE}") - - # Check if optional dependencies are installed - cagrad_installed = all(find_spec(name) is not None for name in ["cvxpy", "clarabel"]) - nashmtl_installed = all(find_spec(name) is not None for name in ["cvxpy", "ecos"]) - - xfail_cagrad = mark.xfail(reason="CAGrad dependencies not installed") - xfail_nashmtl = mark.xfail(reason="NashMTL dependencies not installed") - for item in items: if "slow" in item.keywords and not config.getoption("--runslow"): item.add_marker(skip_slow) if "xfail_if_cuda" in item.keywords and str(DEVICE).startswith("cuda"): item.add_marker(xfail_cuda) - if "xfail_if_cagrad_not_installed" in item.keywords and not cagrad_installed: - item.add_marker(xfail_cagrad) - if "xfail_if_nashmtl_not_installed" in item.keywords and not nashmtl_installed: - item.add_marker(xfail_nashmtl) def pytest_make_parametrize_id(config, val, argname): diff --git a/tests/unit/aggregation/test_cagrad.py b/tests/unit/aggregation/test_cagrad.py index ed73f0b1..e604c087 100644 --- a/tests/unit/aggregation/test_cagrad.py +++ b/tests/unit/aggregation/test_cagrad.py @@ -10,8 +10,6 @@ from ._asserts import assert_expected_structure, assert_non_conflicting, assert_non_differentiable from ._inputs import scaled_matrices, typical_matrices -pytestmark = mark.xfail_if_cagrad_not_installed - scaled_pairs = [(CAGrad(c=0.5), matrix) for matrix in scaled_matrices] typical_pairs = [(CAGrad(c=0.5), matrix) for matrix in typical_matrices] requires_grad_pairs = [(CAGrad(c=0.5), ones_(3, 5, requires_grad=True))] diff --git a/tests/unit/aggregation/test_nash_mtl.py b/tests/unit/aggregation/test_nash_mtl.py index 661f090e..ce343e5d 100644 --- a/tests/unit/aggregation/test_nash_mtl.py +++ b/tests/unit/aggregation/test_nash_mtl.py @@ -8,8 +8,6 @@ from ._asserts import assert_expected_structure, assert_non_differentiable from ._inputs import nash_mtl_matrices -pytestmark = mark.xfail_if_nashmtl_not_installed - def _make_aggregator(matrix: Tensor) -> NashMTL: return NashMTL(n_tasks=matrix.shape[0]) diff --git a/tests/unit/aggregation/test_values.py b/tests/unit/aggregation/test_values.py index cce451a2..5fed3869 100644 --- a/tests/unit/aggregation/test_values.py +++ b/tests/unit/aggregation/test_values.py @@ -87,22 +87,8 @@ try: from torchjd.aggregation import CAGrad, CAGradWeighting - AGGREGATOR_PARAMETRIZATIONS.append( - param( - CAGrad(c=0.5), - J_base, - tensor([0.1835, 1.2041, 1.2041]), - marks=mark.xfail_if_cagrad_not_installed, - ) - ) - WEIGHTING_PARAMETRIZATIONS.append( - param( - CAGradWeighting(c=0.5), - G_base, - tensor([0.7041, 0.5000]), - marks=mark.xfail_if_cagrad_not_installed, - ) - ) + AGGREGATOR_PARAMETRIZATIONS.append((CAGrad(c=0.5), J_base, tensor([0.1835, 1.2041, 1.2041]))) + WEIGHTING_PARAMETRIZATIONS.append((CAGradWeighting(c=0.5), G_base, tensor([0.7041, 0.5000]))) except ImportError: pass @@ -114,10 +100,7 @@ NashMTL(n_tasks=2), J_base, tensor([0.0542, 0.7061, 0.7061]), - marks=[ - mark.filterwarnings("ignore::UserWarning"), - mark.xfail_if_nashmtl_not_installed, - ], + marks=mark.filterwarnings("ignore::UserWarning"), ) ) From fa2f872edaf57e53a50734efa41d21b0ccf7c19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 17:57:45 +0100 Subject: [PATCH 12/27] Remove unnecessary ignore from tests.yml default deps test --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 279de9b2..5f8112b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,7 +55,7 @@ jobs: - uses: ./.github/actions/run-tests with: - ignores: tests/unit/aggregation/test_cagrad.py tests/unit/aggregation/test_nash_mtl.py tests/doc/test_aggregation.py + ignores: tests/unit/aggregation/test_cagrad.py tests/unit/aggregation/test_nash_mtl.py - *upload-codecov From ec839877ef0b60c11b8b2e393b7feeb36d1ef7de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:02:40 +0100 Subject: [PATCH 13/27] Change the way nashmtl and cagrad tests are skipped --- .github/actions/run-tests/action.yml | 20 +------------------- .github/workflows/tests.yml | 2 -- tests/unit/aggregation/test_cagrad.py | 7 ++++++- tests/unit/aggregation/test_nash_mtl.py | 7 ++++++- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index b77f67db..66fdd770 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -2,10 +2,6 @@ name: Run Tests description: Run unit and doc tests with coverage inputs: - ignores: - description: 'Space-separated list of test files to ignore' - required: false - default: '' dtype: description: 'Torch dtype to use for tests' required: false @@ -24,18 +20,4 @@ runs: PYTEST_TORCH_DTYPE: ${{ inputs.dtype }} PYTEST_TORCH_DEVICE: ${{ inputs.device }} run: | - # Build the pytest command - cmd="uv run pytest -W error tests/unit tests/doc" - - # Add ignore flags for each file - if [ -n "${{ inputs.ignores }}" ]; then - for file in ${{ inputs.ignores }}; do - cmd="$cmd --ignore $file" - done - fi - - # Add coverage options - cmd="$cmd --cov=src --cov-report=xml" - - # Execute the command - eval $cmd + uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f8112b7..96435bd4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,8 +54,6 @@ jobs: groups: test - uses: ./.github/actions/run-tests - with: - ignores: tests/unit/aggregation/test_cagrad.py tests/unit/aggregation/test_nash_mtl.py - *upload-codecov diff --git a/tests/unit/aggregation/test_cagrad.py b/tests/unit/aggregation/test_cagrad.py index e604c087..e77cb729 100644 --- a/tests/unit/aggregation/test_cagrad.py +++ b/tests/unit/aggregation/test_cagrad.py @@ -5,7 +5,12 @@ from utils.contexts import ExceptionContext from utils.tensors import ones_ -from torchjd.aggregation import CAGrad +try: + from torchjd.aggregation import CAGrad +except ImportError: + import pytest + + pytest.skip("CAGrad dependencies not installed", allow_module_level=True) from ._asserts import assert_expected_structure, assert_non_conflicting, assert_non_differentiable from ._inputs import scaled_matrices, typical_matrices diff --git a/tests/unit/aggregation/test_nash_mtl.py b/tests/unit/aggregation/test_nash_mtl.py index ce343e5d..e4a47642 100644 --- a/tests/unit/aggregation/test_nash_mtl.py +++ b/tests/unit/aggregation/test_nash_mtl.py @@ -3,7 +3,12 @@ from torch.testing import assert_close from utils.tensors import ones_, randn_ -from torchjd.aggregation import NashMTL +try: + from torchjd.aggregation import NashMTL +except ImportError: + import pytest + + pytest.skip("NashMTL dependencies not installed", allow_module_level=True) from ._asserts import assert_expected_structure, assert_non_differentiable from ._inputs import nash_mtl_matrices From 057f1ddafc3d176d1239dcc945462201168e9605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:07:02 +0100 Subject: [PATCH 14/27] Remove now quite useless run-tests composite action --- .github/actions/run-tests/action.yml | 23 ----------------------- .github/workflows/tests.yml | 15 +++++++++------ 2 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 .github/actions/run-tests/action.yml diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml deleted file mode 100644 index 66fdd770..00000000 --- a/.github/actions/run-tests/action.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Run Tests -description: Run unit and doc tests with coverage - -inputs: - dtype: - description: 'Torch dtype to use for tests' - required: false - default: 'float32' - device: - description: 'Torch device to use for tests' - required: false - default: 'cpu' - -runs: - using: composite - steps: - - name: Run unit and doc tests with coverage report - shell: bash - env: - PYTEST_TORCH_DTYPE: ${{ inputs.dtype }} - PYTEST_TORCH_DEVICE: ${{ inputs.device }} - run: | - uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 96435bd4..f0e6b375 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,7 +32,8 @@ jobs: options: full groups: test - - uses: ./.github/actions/run-tests + - name: Run tests + run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - &upload-codecov name: Upload results to Codecov @@ -41,7 +42,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} tests-default-install: - name: Run (most) tests with default install + name: Run tests with default install runs-on: ubuntu-latest steps: - name: Checkout repository @@ -53,7 +54,8 @@ jobs: with: groups: test - - uses: ./.github/actions/run-tests + - name: Run tests + run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - *upload-codecov @@ -71,9 +73,10 @@ jobs: options: full groups: test - - uses: ./.github/actions/run-tests - with: - dtype: float64 + - name: Run tests + run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml + env: + PYTEST_TORCH_DTYPE: float64 - *upload-codecov From 0d24c97297277598206d56b74920698bf5ea3e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:17:42 +0100 Subject: [PATCH 15/27] Use variation-based config in tests.yml --- .github/workflows/tests.yml | 46 +++++++++++++++---------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f0e6b375..86edb4ab 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,14 +10,23 @@ env: UV_NO_SYNC: 1 jobs: - tests-full-install: - name: Run tests with full install - runs-on: ${{ matrix.os }} + tests: + name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}) + runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: - fail-fast: false # Ensure matrix jobs keep running even if one fails + fail-fast: false matrix: - python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] - os: [ubuntu-latest, macOS-latest, windows-latest] + include: + # Python version variations + - python-version: '3.10' + - python-version: '3.11' + - python-version: '3.12' + - python-version: '3.13' + # OS variations + - os: macOS-latest + - os: windows-latest + # dtype variation + - dtype: float64 steps: - name: Checkout repository @@ -25,7 +34,7 @@ jobs: - uses: ./.github/actions/setup-uv with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python-version || '3.14' }} - uses: ./.github/actions/install-deps with: @@ -34,6 +43,8 @@ jobs: - name: Run tests run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml + env: + PYTEST_TORCH_DTYPE: ${{ matrix.dtype || 'float32' }} - &upload-codecov name: Upload results to Codecov @@ -59,27 +70,6 @@ jobs: - *upload-codecov - tests-float64: - name: Run tests on float64 dtype - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: ./.github/actions/setup-uv - - - uses: ./.github/actions/install-deps - with: - options: full - groups: test - - - name: Run tests - run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - env: - PYTEST_TORCH_DTYPE: float64 - - - *upload-codecov - build-doc: name: Build doc runs-on: ubuntu-latest From 1b296b2fc0f80f26324437b06f81a48d538cfc03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:22:36 +0100 Subject: [PATCH 16/27] Add default config testing --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 86edb4ab..ca2eb21d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,6 +17,8 @@ jobs: fail-fast: false matrix: include: + # Default configuration + - {} # Python version variations - python-version: '3.10' - python-version: '3.11' From 3d5a58f7805878bbb129a6c626c1a4c61c424792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:28:58 +0100 Subject: [PATCH 17/27] Fix default config and add options variation --- .github/workflows/tests.yml | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ca2eb21d..085a87a8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,24 +11,25 @@ env: jobs: tests: - name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}) + name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, options=[${{ matrix.options || 'full' }}]) runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false matrix: include: - # Default configuration - - {} # Python version variations - python-version: '3.10' - python-version: '3.11' - python-version: '3.12' - python-version: '3.13' + - python-version: '3.14' # OS variations - os: macOS-latest - os: windows-latest # dtype variation - dtype: float64 + # Options variation + - options: '' steps: - name: Checkout repository @@ -40,7 +41,7 @@ jobs: - uses: ./.github/actions/install-deps with: - options: full + options: ${{ matrix.options || 'full' }} groups: test - name: Run tests @@ -54,24 +55,6 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} - tests-default-install: - name: Run tests with default install - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - uses: ./.github/actions/setup-uv - - - uses: ./.github/actions/install-deps - with: - groups: test - - - name: Run tests - run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml - - - *upload-codecov - build-doc: name: Build doc runs-on: ubuntu-latest From 1488520b50867dd2f89cc20b826a42b48be087bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:35:32 +0100 Subject: [PATCH 18/27] Fix installation options variations --- .github/workflows/tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 085a87a8..83f499d0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ env: jobs: tests: - name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, options=[${{ matrix.options || 'full' }}]) + name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, options=[${{ matrix.options == 'none' && '' || (matrix.options || 'full') }}]) runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false @@ -26,10 +26,10 @@ jobs: # OS variations - os: macOS-latest - os: windows-latest - # dtype variation + # dtype variations - dtype: float64 - # Options variation - - options: '' + # Installation options variations + - options: none steps: - name: Checkout repository @@ -41,7 +41,7 @@ jobs: - uses: ./.github/actions/install-deps with: - options: ${{ matrix.options || 'full' }} + options: ${{ matrix.options == 'none' && '' || (matrix.options || 'full') }} groups: test - name: Run tests From 8fbc97c6294b2f4d99b01b15aac2219dbf636c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:45:09 +0100 Subject: [PATCH 19/27] Add comments --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83f499d0..492665d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,8 @@ env: jobs: tests: + # Default config: py3.14, ubuntu-latest, float32, full options. + # The idea is to make each of those params vary one by one, to limit the number of tests to run. name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, options=[${{ matrix.options == 'none' && '' || (matrix.options || 'full') }}]) runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: @@ -22,7 +24,7 @@ jobs: - python-version: '3.11' - python-version: '3.12' - python-version: '3.13' - - python-version: '3.14' + - python-version: '3.14' # To actually run the default config # OS variations - os: macOS-latest - os: windows-latest From 8901660b64a624ba9849f59a567fb4ccf56241a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:48:46 +0100 Subject: [PATCH 20/27] Remove setup-uv composite action --- .github/actions/setup-uv/action.yml | 16 ---------------- .github/workflows/build-deploy-docs.yml | 5 ++++- .github/workflows/release.yml | 6 ++++-- .github/workflows/tests.yml | 13 ++++++++++--- 4 files changed, 18 insertions(+), 22 deletions(-) delete mode 100644 .github/actions/setup-uv/action.yml diff --git a/.github/actions/setup-uv/action.yml b/.github/actions/setup-uv/action.yml deleted file mode 100644 index 519104f8..00000000 --- a/.github/actions/setup-uv/action.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Setup -description: Checkout repository and set up uv - -inputs: - python-version: - description: Python version to use - required: false - default: '3.14' - -runs: - using: composite - steps: - - name: Set up uv - uses: astral-sh/setup-uv@v5 - with: - python-version: ${{ inputs.python-version }} diff --git a/.github/workflows/build-deploy-docs.yml b/.github/workflows/build-deploy-docs.yml index fdaab4ea..c324fd37 100644 --- a/.github/workflows/build-deploy-docs.yml +++ b/.github/workflows/build-deploy-docs.yml @@ -20,7 +20,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: ./.github/actions/setup-uv + - name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: '3.14' - uses: ./.github/actions/install-deps with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 89d67d3a..02cc877d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,8 +16,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - - uses: ./.github/actions/setup-uv + - name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: '3.14' - name: Build run: uv build diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 492665d3..27954d92 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: ./.github/actions/setup-uv + - name: Set up uv + uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version || '3.14' }} @@ -64,7 +65,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: ./.github/actions/setup-uv + - name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: '3.14' - uses: ./.github/actions/install-deps with: @@ -82,7 +86,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: ./.github/actions/setup-uv + - name: Set up uv + uses: astral-sh/setup-uv@v5 + with: + python-version: '3.14' - uses: ./.github/actions/install-deps with: From a8ef620811e7c1de53d0c953e8b9bfa3f4d7c6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 18:56:58 +0100 Subject: [PATCH 21/27] Simplify optional deps logic, make full the default in the action --- .github/actions/install-deps/action.yml | 2 +- .github/workflows/build-deploy-docs.yml | 1 - .github/workflows/tests.yml | 8 +++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index e5f34fc7..f9703975 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -5,7 +5,7 @@ inputs: options: description: 'Package options to install (space-separated, e.g., "full")' required: false - default: '' + default: 'full' groups: description: 'Dependency groups to install (space-separated, e.g., "test doc")' required: false diff --git a/.github/workflows/build-deploy-docs.yml b/.github/workflows/build-deploy-docs.yml index c324fd37..337b143b 100644 --- a/.github/workflows/build-deploy-docs.yml +++ b/.github/workflows/build-deploy-docs.yml @@ -27,7 +27,6 @@ jobs: - uses: ./.github/actions/install-deps with: - options: full groups: doc - name: Determine deployment folder diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 27954d92..ba7a3699 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: tests: # Default config: py3.14, ubuntu-latest, float32, full options. # The idea is to make each of those params vary one by one, to limit the number of tests to run. - name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, options=[${{ matrix.options == 'none' && '' || (matrix.options || 'full') }}]) + name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}${{ matrix.options != null && ', default install'}}) runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false @@ -31,7 +31,7 @@ jobs: # dtype variations - dtype: float64 # Installation options variations - - options: none + - options: '' steps: - name: Checkout repository @@ -44,7 +44,7 @@ jobs: - uses: ./.github/actions/install-deps with: - options: ${{ matrix.options == 'none' && '' || (matrix.options || 'full') }} + options: ${{ matrix.options }} groups: test - name: Run tests @@ -72,7 +72,6 @@ jobs: - uses: ./.github/actions/install-deps with: - options: full groups: doc - name: Build Documentation @@ -93,7 +92,6 @@ jobs: - uses: ./.github/actions/install-deps with: - options: full groups: check - name: Run mypy From e1ac5d17139b1888d927b6c2bce450c1ec115257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Sun, 28 Dec 2025 19:06:29 +0100 Subject: [PATCH 22/27] Fix none options --- .github/actions/install-deps/action.yml | 12 +++++++++--- .github/workflows/tests.yml | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index f9703975..8386cbee 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -3,7 +3,7 @@ description: Install package dependencies using uv inputs: options: - description: 'Package options to install (space-separated, e.g., "full")' + description: 'Package options to install (space-separated, e.g., "full"). "none is an alias for empty string.' required: false default: 'full' groups: @@ -17,13 +17,19 @@ runs: - name: Install dependencies (options=[${{ inputs.options }}], groups=[${{ inputs.groups }}]) shell: bash run: | + # Handle "none" as alias for empty string + options_input="${{ inputs.options }}" + if [ "$options_input" = "none" ]; then + options_input="" + fi + # Build the install command cmd="uv pip install -e" # Add options if provided - if [ -n "${{ inputs.options }}" ]; then + if [ -n "$options_input" ]; then # Convert space-separated options to comma-separated for brackets - options=$(echo "${{ inputs.options }}" | tr ' ' ',') + options=$(echo "$options_input" | tr ' ' ',') cmd="$cmd '.[$options]'" else cmd="$cmd ." diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba7a3699..6b604fa3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: tests: # Default config: py3.14, ubuntu-latest, float32, full options. # The idea is to make each of those params vary one by one, to limit the number of tests to run. - name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}${{ matrix.options != null && ', default install'}}) + name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options || 'full' }}) runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false @@ -31,7 +31,7 @@ jobs: # dtype variations - dtype: float64 # Installation options variations - - options: '' + - options: 'none' steps: - name: Checkout repository @@ -44,7 +44,7 @@ jobs: - uses: ./.github/actions/install-deps with: - options: ${{ matrix.options }} + options: ${{ matrix.options || 'full' }} groups: test - name: Run tests From b09a5d5af999ea2f925dc77726cdb97d82044379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Mon, 29 Dec 2025 20:19:50 +0100 Subject: [PATCH 23/27] Simplify options --- .github/actions/install-deps/action.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index 8386cbee..688d7a88 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -26,14 +26,10 @@ runs: # Build the install command cmd="uv pip install -e" - # Add options if provided - if [ -n "$options_input" ]; then - # Convert space-separated options to comma-separated for brackets - options=$(echo "$options_input" | tr ' ' ',') - cmd="$cmd '.[$options]'" - else - cmd="$cmd ." - fi + # Convert space-separated options to comma-separated for brackets + # E.g. "abc def" => '.[abc,def]' + options=$(echo "$options_input" | tr ' ' ',') + cmd="$cmd '.[$options]'" # Add groups for group in ${{ inputs.groups }}; do From c973ff430d1be46fc3daf65f1d79f119cb9a900d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Mon, 29 Dec 2025 20:44:03 +0100 Subject: [PATCH 24/27] Try to simplify none string logic --- .github/actions/install-deps/action.yml | 10 ++-------- .github/workflows/tests.yml | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index 688d7a88..1f1db37c 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -3,7 +3,7 @@ description: Install package dependencies using uv inputs: options: - description: 'Package options to install (space-separated, e.g., "full"). "none is an alias for empty string.' + description: 'Package options to install (space-separated, e.g., "full").' required: false default: 'full' groups: @@ -17,18 +17,12 @@ runs: - name: Install dependencies (options=[${{ inputs.options }}], groups=[${{ inputs.groups }}]) shell: bash run: | - # Handle "none" as alias for empty string - options_input="${{ inputs.options }}" - if [ "$options_input" = "none" ]; then - options_input="" - fi - # Build the install command cmd="uv pip install -e" # Convert space-separated options to comma-separated for brackets # E.g. "abc def" => '.[abc,def]' - options=$(echo "$options_input" | tr ' ' ',') + options=$(echo "${{ inputs.options }}" | tr ' ' ',') cmd="$cmd '.[$options]'" # Add groups diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6b604fa3..9f797e3d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: tests: # Default config: py3.14, ubuntu-latest, float32, full options. # The idea is to make each of those params vary one by one, to limit the number of tests to run. - name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options || 'full' }}) + name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options == null && 'full' || matrix.options }}) runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false @@ -31,7 +31,7 @@ jobs: # dtype variations - dtype: float64 # Installation options variations - - options: 'none' + - options: '' steps: - name: Checkout repository @@ -44,7 +44,7 @@ jobs: - uses: ./.github/actions/install-deps with: - options: ${{ matrix.options || 'full' }} + options: ${{ matrix.options == null && 'full' || matrix.options }} groups: test - name: Run tests From da78ec129ac96db4c55d9a1ceca10338575f6d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Mon, 29 Dec 2025 20:48:14 +0100 Subject: [PATCH 25/27] Revert "Try to simplify none string logic" This reverts commit c973ff430d1be46fc3daf65f1d79f119cb9a900d. --- .github/actions/install-deps/action.yml | 10 ++++++++-- .github/workflows/tests.yml | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index 1f1db37c..688d7a88 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -3,7 +3,7 @@ description: Install package dependencies using uv inputs: options: - description: 'Package options to install (space-separated, e.g., "full").' + description: 'Package options to install (space-separated, e.g., "full"). "none is an alias for empty string.' required: false default: 'full' groups: @@ -17,12 +17,18 @@ runs: - name: Install dependencies (options=[${{ inputs.options }}], groups=[${{ inputs.groups }}]) shell: bash run: | + # Handle "none" as alias for empty string + options_input="${{ inputs.options }}" + if [ "$options_input" = "none" ]; then + options_input="" + fi + # Build the install command cmd="uv pip install -e" # Convert space-separated options to comma-separated for brackets # E.g. "abc def" => '.[abc,def]' - options=$(echo "${{ inputs.options }}" | tr ' ' ',') + options=$(echo "$options_input" | tr ' ' ',') cmd="$cmd '.[$options]'" # Add groups diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9f797e3d..6b604fa3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: tests: # Default config: py3.14, ubuntu-latest, float32, full options. # The idea is to make each of those params vary one by one, to limit the number of tests to run. - name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options == null && 'full' || matrix.options }}) + name: Run tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options || 'full' }}) runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false @@ -31,7 +31,7 @@ jobs: # dtype variations - dtype: float64 # Installation options variations - - options: '' + - options: 'none' steps: - name: Checkout repository @@ -44,7 +44,7 @@ jobs: - uses: ./.github/actions/install-deps with: - options: ${{ matrix.options == null && 'full' || matrix.options }} + options: ${{ matrix.options || 'full' }} groups: test - name: Run tests From 36355e1a4702b02d7d961cc6c8b2c6e786db7f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Mon, 29 Dec 2025 20:52:06 +0100 Subject: [PATCH 26/27] Improve explanation about none option string --- .github/actions/install-deps/action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index 688d7a88..1f0f1d57 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -3,7 +3,9 @@ description: Install package dependencies using uv inputs: options: - description: 'Package options to install (space-separated, e.g., "full"). "none is an alias for empty string.' + # We can't directly provide the empty string for no options because it would be mapped to the + # default value thanks to github's weird logic (https://github.com/actions/toolkit/issues/940) + description: 'Package options to install (space-separated, e.g., "full"). Use "none" for no options.' required: false default: 'full' groups: @@ -17,7 +19,7 @@ runs: - name: Install dependencies (options=[${{ inputs.options }}], groups=[${{ inputs.groups }}]) shell: bash run: | - # Handle "none" as alias for empty string + # Map "none" to the empty string options_input="${{ inputs.options }}" if [ "$options_input" = "none" ]; then options_input="" From 573588bf6a91175626ea22af1a8f7bba4d3f5128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Mon, 29 Dec 2025 20:53:34 +0100 Subject: [PATCH 27/27] Add echo of the install deps command --- .github/actions/install-deps/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index 1f0f1d57..fadc7f4a 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -38,5 +38,6 @@ runs: cmd="$cmd --group $group" done - # Execute the command + # Print and execute the command + echo $cmd eval $cmd