Skip to content

CI

CI #294

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: [v*]
pull_request:
workflow_dispatch:
schedule:
# run every week (for --pre release tests)
- cron: "0 0 * * 0"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-manifest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: pipx run check-manifest
check-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"
- run: uv run ty check -vv
test:
name: ${{ matrix.platform }} (${{ matrix.python-version }}) [${{ matrix.resolution }}] ${{ matrix.group == 'test-full' && '(full)' || '' }}
runs-on: ${{ matrix.platform }}
env:
UV_PRERELEASE: ${{ github.event_name == 'schedule' && 'allow' || 'if-necessary-or-explicit' }}
UV_RESOLUTION: ${{ matrix.resolution }}
PYTEST_ADDOPTS: ${{ matrix.resolution == 'lowest-direct' && '-W ignore' || '' }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
platform: [ubuntu-latest, macos-latest, windows-latest]
resolution: ["highest", "lowest-direct"]
group: ["test-full"]
include:
- python-version: "3.10"
platform: ubuntu-latest
resolution: lowest-direct
group: test
- python-version: "3.11"
platform: windows-latest
resolution: highest
group: test
- python-version: "3.11"
platform: macos-latest
resolution: lowest-direct
group: test
- python-version: "3.13"
platform: ubuntu-latest
resolution: highest
group: test
- python-version: "3.13"
platform: ubuntu-latest
resolution: lowest-direct
group: test
- python-version: "3.14"
platform: ubuntu-latest
resolution: lowest-direct
group: test
- python-version: "3.14"
platform: ubuntu-latest
resolution: highest
group: test
steps:
- uses: actions/checkout@v6
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- uses: actions/setup-node@v6
with:
node-version: "22"
- name: 🧪 Run Tests
run: uv run --no-dev --group ${{ matrix.group }} coverage run -p -m pytest -v
# If something goes wrong with --pre tests, we can open an issue in the repo
- name: 📝 Report --pre Failures
if: failure() && github.event_name == 'schedule'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.platform }}
PYTHON: ${{ matrix.python-version }}
RUN_ID: ${{ github.run_id }}
TITLE: "[test-bot] pip install --pre is failing"
with:
filename: .github/TEST_FAIL_TEMPLATE.md
update_existing: true
- name: Upload coverage
uses: actions/upload-artifact@v6
with:
name: covreport-${{ matrix.platform }}-py${{ matrix.python-version }}-${{ matrix.resolution }}-${{ matrix.group }}
path: ./.coverage*
include-hidden-files: true
test-realworld:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"
enable-cache: true
- name: 🧪 Run Tests
run: uv run --no-dev --group test --extra io coverage run -p -m pytest tests/test_realworld.py
- name: Upload coverage
uses: actions/upload-artifact@v6
with:
name: covreport-realworld
path: ./.coverage*
include-hidden-files: true
upload_coverage:
if: always()
needs: [test, test-realworld]
uses: pyapp-kit/workflows/.github/workflows/upload-coverage.yml@v2
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
test_demo_script:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- run: |
for ome_type in "image" "labels" "plate"; do
for ome_version in "0.4" "0.5"; do
DEST="${ome_type}.ome.zarr"
# remove existing demo file if any
rm -rf "${DEST}"
echo "Writing type $ome_type version $ome_version"
uv run scripts/write_demo_zarr.py --version "$ome_version" --overwrite "$ome_type" "${DEST}"
# ensure it was written
ls -lh "${DEST}"
done
done
build-and-inspect-package:
name: Build & inspect package.
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
upload-to-pypi:
name: Upload package to PyPI
needs: build-and-inspect-package
if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Download built artifact to dist/
uses: actions/download-artifact@v7
with:
name: Packages
path: dist
- name: 🚢 Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: "./dist/*"