diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6f56b2..2244b1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,38 +12,61 @@ env: FORCE_COLOR: "1" jobs: + get-environments: + runs-on: ubuntu-latest + outputs: + envs: ${{ steps.get-envs.outputs.envs }} + pythons: ${{ steps.get-pythons.outputs.pythons }} + 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=$( + 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 + - 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 + 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" + env: ${{ 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: | + uvx hatch run ${{ matrix.env.name }}:run-cov # https://github.com/codecov/codecov-cli/issues/648 - coverage xml + uvx hatch run ${{ matrix.env.name }}:coverage xml 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 }} @@ -84,10 +107,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: @@ -99,3 +123,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