From aa00afbf967d2160470db2b6999dd88f3a6e7937 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Fri, 9 May 2025 12:56:12 +0200 Subject: [PATCH 1/8] Derive test configs from hatch --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++++++++++---------- pyproject.toml | 6 ++--- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6f56b2..94a524c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,34 +12,48 @@ env: FORCE_COLOR: "1" jobs: + get-environments: + runs-on: ubuntu-latest + outputs: + envs: ${{ steps.get-envs.outputs.envs }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + filter: blob:none + - name: Install uv + uses: astral-sh/setup-uv@v5 + - name: Get test environments + id: get-envs + run: | + ENVS_JSON=$( + uvx hatch env show --json | + jq -c 'to_entries | map(select(.key | startswith("hatch-test")) | { name: .key, python: .value.python })' + ) + echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT test: name: Tests + needs: get-environments runs-on: ubuntu-latest strategy: - matrix: - include: - - python-version: "3.13" - test-extra: test-min - - python-version: "3.11" - - python-version: "3.13" + matrix: ${{ fromJSON(needs.get-environments.outputs.envs) }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 filter: blob:none - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - uses: astral-sh/setup-uv@v5 with: enable-cache: true cache-dependency-glob: pyproject.toml - - run: uv pip install --system -e .[${{ matrix.test-extra || 'test' }}] - - run: | - coverage run -m pytest -m "not benchmark" - coverage report + python-version: ${{ matrix.env.python }} + - name: create environment + run: uvx hatch env create ${{ matrix.env.name }} + - name: run tests with coverage + run: | + hatch run ${{ matrix.env.name }}:run-cov # https://github.com/codecov/codecov-cli/issues/648 - coverage xml + hatch run ${{ matrix.env.name }}:coverage xml rm test-data/.coverage - uses: codecov/codecov-action@v5 with: @@ -99,3 +113,17 @@ jobs: with: python-version: ${{ matrix.python-version }} - uses: pre-commit/action@v3.0.1 + pass: + name: All Checks + if: always() + needs: + - get-environments + - test + - bench + - import + - check + runs-on: ubuntu-latest + steps: + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/pyproject.toml b/pyproject.toml index 51657f6..e340a75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,7 @@ extra-dependencies = [ "ipykernel", "ipycytoscape" ] env-vars.CODSPEED_PROFILE_FOLDER = "test-data/codspeed" overrides.matrix.extras.features = [ { if = [ "full" ], value = "full" }, - { if = [ "default", "full" ], value = "test" }, + { if = [ "full" ], value = "test" }, ] overrides.matrix.extras.dependencies = [ { if = [ "full" ], value = "scipy-stubs" }, @@ -89,8 +89,8 @@ overrides.matrix.extras.dependencies = [ ] [[tool.hatch.envs.hatch-test.matrix]] -python = [ "3.13", "3.12", "3.11" ] -extras = [ "full", "default", "min" ] +python = [ "3.13", "3.11" ] +extras = [ "full", "min" ] [tool.ruff] line-length = 160 From 38f9f0a1817976cf9b9c3c6d34864b96e289e960 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Fri, 9 May 2025 12:58:17 +0200 Subject: [PATCH 2/8] dbg --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94a524c..6a4a5f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: filter: blob:none - name: Install uv uses: astral-sh/setup-uv@v5 + - run: uvx hatch env show --json - name: Get test environments id: get-envs run: | From 4379f43a599d4edca07b615087a3672d7c6be456 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Fri, 9 May 2025 12:59:24 +0200 Subject: [PATCH 3/8] unset force color --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a4a5f7..52db2ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,12 +23,11 @@ jobs: filter: blob:none - name: Install uv uses: astral-sh/setup-uv@v5 - - run: uvx hatch env show --json - name: Get test environments id: get-envs run: | ENVS_JSON=$( - uvx hatch env show --json | + FORCE_COLOR= uvx hatch env show --json | jq -c 'to_entries | map(select(.key | startswith("hatch-test")) | { name: .key, python: .value.python })' ) echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT From bd0dd0b710fa9b30d0984f69f71d5014ee7de684 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Fri, 9 May 2025 13:02:44 +0200 Subject: [PATCH 4/8] oops --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52db2ce..0454af8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,8 @@ jobs: needs: get-environments runs-on: ubuntu-latest strategy: - matrix: ${{ fromJSON(needs.get-environments.outputs.envs) }} + matrix: + env: ${{ fromJSON(needs.get-environments.outputs.envs) }} steps: - uses: actions/checkout@v4 with: From 1b66b6f267655f45545650415c3845cfc8975765 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Fri, 9 May 2025 13:06:07 +0200 Subject: [PATCH 5/8] uvx --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0454af8..43a1abc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,9 +52,9 @@ jobs: run: uvx hatch env create ${{ matrix.env.name }} - name: run tests with coverage run: | - hatch run ${{ matrix.env.name }}:run-cov + uvx hatch run ${{ matrix.env.name }}:run-cov # https://github.com/codecov/codecov-cli/issues/648 - hatch run ${{ matrix.env.name }}:coverage xml + uvx hatch run ${{ matrix.env.name }}:coverage xml rm test-data/.coverage - uses: codecov/codecov-action@v5 with: @@ -125,6 +125,6 @@ jobs: - check runs-on: ubuntu-latest steps: - - uses: re-actors/alls-green@release/v1 - with: - jobs: ${{ toJSON(needs) }} + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} From 4dcca2ac1780553fdff419e3762b1605113522b0 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Fri, 9 May 2025 13:16:40 +0200 Subject: [PATCH 6/8] derive Pythons too --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43a1abc..27d68f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: runs-on: ubuntu-latest outputs: envs: ${{ steps.get-envs.outputs.envs }} + pythons: ${{ steps.get-envs.outputs.pythons }} steps: - uses: actions/checkout@v4 with: @@ -30,7 +31,8 @@ jobs: FORCE_COLOR= uvx hatch env show --json | jq -c 'to_entries | map(select(.key | startswith("hatch-test")) | { name: .key, python: .value.python })' ) - echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT + echo "envs=$ENVS_JSON" | tee $GITHUB_OUTPUT + echo "pythons=$(echo $ENVS_JSON | jq -c 'map(.python) | unique')" | tee $GITHUB_OUTPUT test: name: Tests needs: get-environments @@ -58,7 +60,7 @@ jobs: rm test-data/.coverage - uses: codecov/codecov-action@v5 with: - name: Min Tests + name: ${{ matrix.env.name }} fail_ci_if_error: true files: test-data/coverage.xml token: ${{ secrets.CODECOV_TOKEN }} @@ -99,10 +101,11 @@ jobs: - run: python -c 'import testing.fast_array_utils as tfau; print(tfau.ArrayType("numpy", "ndarray"))' check: name: Static Checks + needs: get-environments runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11", "3.13"] + python-version: ${{ fromJSON(needs.get-environments.outputs.pythons) }} env: SKIP: no-commit-to-branch # this CI runs on the main branch steps: From c940755f39d5e037ee36c6468f5d0d2cadf9f58d Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Fri, 9 May 2025 15:22:37 +0200 Subject: [PATCH 7/8] cleaner --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27d68f1..f27c76e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,8 +31,10 @@ jobs: FORCE_COLOR= uvx hatch env show --json | jq -c 'to_entries | map(select(.key | startswith("hatch-test")) | { name: .key, python: .value.python })' ) + PYTHONS_JSON=$(echo "$ENVS_JSON" | jq -c 'map(.python) | unique') + echo "envs=$ENVS_JSON" | tee $GITHUB_OUTPUT - echo "pythons=$(echo $ENVS_JSON | jq -c 'map(.python) | unique')" | tee $GITHUB_OUTPUT + echo "pythons=$PYTHONS_JSON" | tee $GITHUB_OUTPUT test: name: Tests needs: get-environments From b59ef96d102119aaee38aa4ff54143fecb379589 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Fri, 9 May 2025 15:27:30 +0200 Subject: [PATCH 8/8] hm --- .github/workflows/ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f27c76e..2244b1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest outputs: envs: ${{ steps.get-envs.outputs.envs }} - pythons: ${{ steps.get-envs.outputs.pythons }} + pythons: ${{ steps.get-pythons.outputs.pythons }} steps: - uses: actions/checkout@v4 with: @@ -31,9 +31,13 @@ jobs: FORCE_COLOR= uvx hatch env show --json | jq -c 'to_entries | map(select(.key | startswith("hatch-test")) | { name: .key, python: .value.python })' ) - PYTHONS_JSON=$(echo "$ENVS_JSON" | jq -c 'map(.python) | unique') - echo "envs=$ENVS_JSON" | tee $GITHUB_OUTPUT + - name: Get python versions + id: get-pythons + env: + ENVS_JSON: ${{ steps.get-envs.outputs.envs }} + run: | + PYTHONS_JSON=$(echo "$ENVS_JSON" | jq -c 'map(.python) | unique') echo "pythons=$PYTHONS_JSON" | tee $GITHUB_OUTPUT test: name: Tests