From 2cb0d4457fbd0b6e55c5ccdfcd9733cbb8acaa63 Mon Sep 17 00:00:00 2001 From: Max Jones <14077947+maxrjones@users.noreply.github.com> Date: Thu, 13 Feb 2025 14:53:22 -0500 Subject: [PATCH] Set hatch env variable --- .github/workflows/test.yml | 26 ++++++++++++++++++++++---- pyproject.toml | 2 ++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1adb410da1..fb7e6fdb06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,8 +43,10 @@ jobs: os: 'windows-latest' - python-version: '3.11' dependency-set: 'min_deps' + os: 'ubuntu-latest' - python-version: '3.13' dependency-set: 'upstream' + os: 'ubuntu-latest' runs-on: ${{ matrix.os }} steps: @@ -60,15 +62,32 @@ jobs: run: | python -m pip install --upgrade pip pip install hatch + - name: Set environment name + id : hatch-env-name + run : | + if [[ ${{ matrix.dependency-set }} = 'upstream' ]]; then + HATCH_ENV="upstream" + elif [[ ${{ matrix.dependency-set }} = 'min_deps' ]]; then + HATCH_ENV="min_deps" + else + HATCH_ENV="test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }}" + fi + echo "HATCH_ENV=${HATCH_ENV}" >> "$GITHUB_OUTPUT" + - name: Set Up Hatch Env + env: + HATCH_ENV: ${{ steps.hatch-env-name.outputs.HATCH_ENV }} run: | - hatch env create test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} - hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} list-env + hatch env create ${HATCH_ENV} + hatch env run -e ${HATCH_ENV} list-env - name: Run Tests + env: + HATCH_ENV: ${{ steps.hatch-env-name.outputs.HATCH_ENV }} run: | - hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run-coverage + hatch env run --env ${HATCH_ENV} run-coverage - name: Upload coverage uses: codecov/codecov-action@v5 + if: ${{ !env.ACT }} # Skip during local testing with: token: ${{ secrets.CODECOV_TOKEN }} verbose: true # optional (default = false) @@ -99,7 +118,6 @@ jobs: test-complete: name: Test complete - needs: [ test, diff --git a/pyproject.toml b/pyproject.toml index ab285ff7ff..2ae307a453 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -228,6 +228,7 @@ PIP_PRE = "1" run = "pytest --verbose" run-mypy = "mypy src" run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*" +run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy" list-env = "pip list" [tool.hatch.envs.min_deps] @@ -257,6 +258,7 @@ dependencies = [ [tool.hatch.envs.min_deps.scripts] run = "pytest --verbose" run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*" +run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov-report xml --cov=src --junitxml=junit.xml -o junit_family=legacy" list-env = "pip list"