Skip to content

WIP: Consolidate workflows for GitHub actions #2827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 26 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ jobs:
numpy-version: '2.1'
dependency-set: 'optional'
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 @@ -56,53 +62,36 @@ 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)

test-upstream-and-min-deps:
name: py=${{ matrix.python-version }}-${{ matrix.dependency-set }}

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', "3.13"]
dependency-set: ["upstream", "min_deps"]
exclude:
- python-version: "3.13"
dependency-set: min_deps
- python-version: "3.11"
dependency-set: upstream
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Hatch
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Set Up Hatch Env
run: |
hatch env create ${{ matrix.dependency-set }}
hatch env run -e ${{ matrix.dependency-set }} list-env
- name: Run Tests
run: |
hatch env run --env ${{ matrix.dependency-set }} run

doctests:
name: doctests
runs-on: ubuntu-latest
Expand All @@ -129,11 +118,9 @@ jobs:

test-complete:
name: Test complete

needs:
[
test,
test-upstream-and-min-deps,
doctests
]
if: always()
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
Loading