Skip to content

Commit

Permalink
Set hatch env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrjones committed Feb 13, 2025
1 parent 41b4596 commit 2cb0d44
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -99,7 +118,6 @@ jobs:
test-complete:
name: Test complete

needs:
[
test,
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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"


Expand Down

0 comments on commit 2cb0d44

Please sign in to comment.