-
Notifications
You must be signed in to change notification settings - Fork 191
(chore): derive CI matrix from hatch env #1998
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
962b0e6
(chore): derive CI matrix from hatch env
ilan-gold 55992c1
(fix): addopts for parallel
ilan-gold 00637c0
(fix): remove internet-tests flag
ilan-gold 4f08945
(fix): scipy equality check
ilan-gold 182e5ca
(chore): add comment
ilan-gold 18a629f
Merge branch 'main' into ig/derive-matrix
ilan-gold d655fc2
Merge branch 'main' into ig/derive-matrix
ilan-gold a618a86
simplify
flying-sheep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ on: | |
| pull_request: | ||
|
|
||
| env: | ||
| PYTEST_ADDOPTS: "-v --color=yes" | ||
| PYTEST_ADDOPTS: "-v --color=yes -n auto --internet-tests --junitxml=test-data/test-results.xml" | ||
| FORCE_COLOR: "1" | ||
|
|
||
| defaults: | ||
|
|
@@ -22,31 +22,48 @@ concurrency: | |
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| pytest: | ||
| get-environments: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| envs: ${{ steps.get-envs.outputs.envs }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| filter: blob:none | ||
| fetch-depth: 0 | ||
| - uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: false | ||
| - id: get-envs | ||
| run: | | ||
| ENVS_JSON=$(NO_COLOR=1 uvx hatch env show --json | jq -c 'to_entries | ||
| | map( | ||
| select(.key | startswith("hatch-test")) | ||
| | { | ||
| name: .key, | ||
| "test-type": (if (.key | test("pre|min")) then "coverage" else null end), | ||
| python: .value.python, | ||
| } | ||
| )') | ||
| echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT | ||
| test: | ||
| needs: get-environments | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - python-version: '3.13' | ||
| test-type: coverage | ||
| - python-version: '3.11' | ||
| test-type: standard | ||
| - python-version: '3.13' | ||
| dependencies-version: pre-release | ||
| test-type: strict-warning | ||
| - python-version: '3.11' | ||
| dependencies-version: minimum | ||
| test-type: coverage | ||
| env: ${{ fromJSON(needs.get-environments.outputs.envs) }} | ||
| env: # environment variable for use in codecov’s env_vars tagging | ||
| ENV_NAME: ${{ matrix.env.name }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| filter: blob:none | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| - name: Set up Python ${{ matrix.env.python }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| python-version: ${{ matrix.env.python }} | ||
|
|
||
| - name: Install UV | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
@@ -55,43 +72,25 @@ jobs: | |
| cache-dependency-glob: pyproject.toml | ||
|
|
||
| - name: Install dependencies | ||
| if: matrix.dependencies-version == null | ||
| run: uv pip install --system --compile -r pyproject.toml --extra=dev --extra=test -e 'anndata @ .' -c ci/constraints.txt | ||
|
|
||
| - name: Install minimum dependencies | ||
| if: matrix.dependencies-version == 'minimum' | ||
| run: | | ||
| uv pip install --system --compile tomli packaging | ||
| deps=$(python3 ci/scripts/min-deps.py pyproject.toml --extras dev test-min) | ||
| uv pip install --system --compile $deps -e 'anndata @ .' | ||
|
|
||
| - name: Install dependencies release candidates | ||
| if: matrix.dependencies-version == 'pre-release' | ||
| run: uv pip install -v --system --compile --pre -r pyproject.toml --extra=dev --extra=test -e 'anndata @ .' -c ci/constraints.txt | ||
|
|
||
| - name: Display installed versions | ||
| run: uv pip list | ||
|
|
||
| - name: Run Pytest | ||
| if: matrix.test-type == 'standard' | ||
| run: pytest -n auto | ||
|
|
||
| - name: Run Pytest (coverage) | ||
| if: matrix.test-type == 'coverage' | ||
| run: coverage run -m pytest -n auto --cov --cov-report=xml | ||
|
|
||
| - name: Run Pytest (treat warnings as errors) | ||
| if: matrix.test-type == 'strict-warning' | ||
| run: pytest --strict-warnings -n auto | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oof, this should have stayed in. |
||
|
|
||
| - uses: codecov/codecov-action@v4 | ||
| if: matrix.test-type == 'coverage' | ||
| run: uvx hatch -v env create ${{ matrix.env.name }} | ||
|
|
||
| - name: Run tests | ||
| if: matrix.env.test-type == null | ||
| run: uvx hatch run ${{ matrix.env.name }}:run | ||
| - name: Run tests (coverage) | ||
| if: matrix.env.test-type == 'coverage' | ||
| run: uvx hatch run ${{ matrix.env.name }}:run-cov --cov --cov-report=xml | ||
|
|
||
| - name: Upload coverage data | ||
| uses: codecov/codecov-action@v5 | ||
| if: matrix.env.test-type == 'coverage' | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| env_vars: ENV_NAME | ||
| fail_ci_if_error: true | ||
| files: test-data/coverage.xml | ||
|
|
||
| check-build: | ||
| build: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
@@ -121,3 +120,15 @@ jobs: | |
| run: | | ||
| pip install dist/*.whl | ||
| python -c 'import anndata; print(anndata.__version__)' | ||
|
|
||
| check: | ||
| if: always() | ||
| needs: | ||
| - get-environments | ||
| - test | ||
| - build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: re-actors/alls-green@release/v1 | ||
| with: | ||
| jobs: ${{ toJSON(needs) }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.