Skip to content

Backend-Agnostic Refactor Using Array API Compatibility #609

Backend-Agnostic Refactor Using Array API Compatibility

Backend-Agnostic Refactor Using Array API Compatibility #609

Workflow file for this run

name: CI
on:
push:
branches:
- main
- "[0-9]+.[0-9]+.x"
pull_request:
env:
FORCE_COLOR: "1"
defaults:
run:
shell: bash -el {0}
# Cancel the job if new commits are pushed
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
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, python: .value.python }
)')
echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT
test:
needs: get-environments
runs-on: ubuntu-latest
strategy:
matrix:
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.env.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.env.python }}
- name: Install UV
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Install dependencies
run: uvx hatch -v env create ${{ matrix.env.name }}
- name: Run tests
run: uvx hatch run ${{ matrix.env.name }}:run-cov -v --color=yes -n auto --cov --cov-report=xml --junitxml=test-data/test-results.xml
- name: Upload coverage data
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: ENV_NAME
fail_ci_if_error: true
files: test-data/coverage.xml
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: blob:none
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install build tools and requirements
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Display installed versions
run: pip list
- name: Build & Twine check
run: |
python -m build --sdist --wheel .
twine check dist/*
- name: Check runtime version
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) }}