|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - "*.*.x" |
| 8 | + pull_request: |
| 9 | + |
| 10 | +env: |
| 11 | + PYTEST_ADDOPTS: "-v --color=yes" |
| 12 | + FORCE_COLOR: "1" |
| 13 | + |
| 14 | +defaults: |
| 15 | + run: |
| 16 | + shell: bash -el {0} |
| 17 | + |
| 18 | +# Cancel the job if new commits are pushed |
| 19 | +# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre |
| 20 | +concurrency: |
| 21 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + pytest: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + include: |
| 30 | + - python-version: '3.12' |
| 31 | + test-type: coverage |
| 32 | + - python-version: '3.10' |
| 33 | + test-type: standard |
| 34 | + - python-version: '3.12' |
| 35 | + dependencies-version: pre-release |
| 36 | + test-type: strict-warning |
| 37 | + - python-version: '3.10' |
| 38 | + dependencies-version: minimum |
| 39 | + test-type: coverage |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + filter: blob:none |
| 45 | + |
| 46 | + - name: Set up Python ${{ matrix.python-version }} |
| 47 | + uses: actions/setup-python@v5 |
| 48 | + with: |
| 49 | + python-version: ${{ matrix.python-version }} |
| 50 | + |
| 51 | + - name: Install UV |
| 52 | + uses: astral-sh/setup-uv@v5 |
| 53 | + with: |
| 54 | + enable-cache: true |
| 55 | + cache-dependency-glob: pyproject.toml |
| 56 | + |
| 57 | + - name: Install dependencies |
| 58 | + if: matrix.dependencies-version == null |
| 59 | + run: uv pip install --system --compile "anndata[dev,test] @ ." -c ci/constraints.txt |
| 60 | + |
| 61 | + - name: Install minimum dependencies |
| 62 | + if: matrix.dependencies-version == 'minimum' |
| 63 | + run: | |
| 64 | + uv pip install --system --compile tomli packaging |
| 65 | +
|
| 66 | + deps=$(python3 ci/scripts/min-deps.py pyproject.toml --extra dev test) |
| 67 | + uv pip install --system --compile $deps "anndata @ ." |
| 68 | +
|
| 69 | + - name: Install dependencies release candidates |
| 70 | + if: matrix.dependencies-version == 'pre-release' |
| 71 | + run: uv pip install -v --system --compile --pre "anndata[dev,test] @ ." -c ci/constraints.txt |
| 72 | + |
| 73 | + - name: Display installed versions |
| 74 | + run: uv pip list |
| 75 | + |
| 76 | + - name: Run Pytest |
| 77 | + if: matrix.test-type == 'standard' |
| 78 | + run: pytest -n auto |
| 79 | + |
| 80 | + - name: Run Pytest (coverage) |
| 81 | + if: matrix.test-type == 'coverage' |
| 82 | + run: coverage run -m pytest -n auto --cov --cov-report=xml |
| 83 | + |
| 84 | + - name: Run Pytest (treat warnings as errors) |
| 85 | + if: matrix.test-type == 'strict-warning' |
| 86 | + run: pytest --strict-warnings -n auto |
| 87 | + |
| 88 | + - uses: codecov/codecov-action@v4 |
| 89 | + if: matrix.test-type == 'coverage' |
| 90 | + with: |
| 91 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 92 | + fail_ci_if_error: true |
| 93 | + files: test-data/coverage.xml |
| 94 | + |
| 95 | + check-build: |
| 96 | + runs-on: ubuntu-22.04 |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@v4 |
| 99 | + with: |
| 100 | + fetch-depth: 0 |
| 101 | + filter: blob:none |
| 102 | + |
| 103 | + - name: Set up Python 3.12 |
| 104 | + uses: actions/setup-python@v5 |
| 105 | + with: |
| 106 | + python-version: '3.12' |
| 107 | + |
| 108 | + - name: Install build tools and requirements |
| 109 | + run: | |
| 110 | + python -m pip install --upgrade pip |
| 111 | + pip install build twine |
| 112 | +
|
| 113 | + - name: Display installed versions |
| 114 | + run: pip list |
| 115 | + |
| 116 | + - name: Build & Twine check |
| 117 | + run: | |
| 118 | + python -m build --sdist --wheel . |
| 119 | + twine check dist/* |
| 120 | +
|
| 121 | + - name: Check runtime version |
| 122 | + run: | |
| 123 | + pip install dist/*.whl |
| 124 | + python -c 'import anndata; print(anndata.__version__)' |
0 commit comments