Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
89 lines
2.9 KiB
YAML
89 lines
2.9 KiB
YAML
name: CI
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, edited] # edited: un-WIP starts CI
|
|
push:
|
|
branches: [develop, main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
# Cancel superseded PR runs. Never cancel a push run.
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
lint:
|
|
if: >-
|
|
github.event_name != 'pull_request' || (
|
|
!startsWith(github.event.pull_request.title, 'WIP:') &&
|
|
!startsWith(github.event.pull_request.title, '[WIP]')
|
|
)
|
|
runs-on: ubuntu-latest
|
|
container: python:3.14
|
|
env:
|
|
UV_PYTHON_DOWNLOADS: never
|
|
steps:
|
|
- name: Install node (Gitea actions are node programs)
|
|
run: apt-get update && apt-get install -y --no-install-recommends nodejs
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- run: git config --global --add safe.directory "$PWD"
|
|
- run: pip install uv
|
|
- run: uv sync --locked
|
|
- run: uv run ruff check
|
|
- run: uv run ruff format --check
|
|
|
|
test:
|
|
if: >-
|
|
github.event_name != 'pull_request' || (
|
|
!startsWith(github.event.pull_request.title, 'WIP:') &&
|
|
!startsWith(github.event.pull_request.title, '[WIP]')
|
|
)
|
|
runs-on: ubuntu-latest
|
|
container: python:${{ matrix.python }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
env:
|
|
UV_PYTHON: ${{ matrix.python }}
|
|
UV_PYTHON_DOWNLOADS: never
|
|
steps:
|
|
- name: Install node (Gitea actions are node programs)
|
|
run: apt-get update && apt-get install -y --no-install-recommends nodejs
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # setuptools_scm needs tags
|
|
- run: git config --global --add safe.directory "$PWD"
|
|
- run: pip install uv
|
|
- run: uv sync --locked
|
|
- run: uv run pytest
|
|
- name: Build, install and smoke-test the wheel and the sdist
|
|
run: |
|
|
rm -rf dist && uv build
|
|
for dist in dist/*.whl dist/*.tar.gz; do
|
|
rm -rf /tmp/smoke && uv venv /tmp/smoke
|
|
uv pip install --python /tmp/smoke "$dist"
|
|
(cd / && /tmp/smoke/bin/python "$GITHUB_WORKSPACE/scripts/smoke_import.py")
|
|
done
|
|
|
|
ci-ok:
|
|
needs: [lint, test]
|
|
# always(): a plain needs: aggregate would be *skipped* when a gate fails,
|
|
# and Gitea reports skipped as success. The WIP gate stays.
|
|
if: >-
|
|
always() && (
|
|
github.event_name != 'pull_request' || (
|
|
!startsWith(github.event.pull_request.title, 'WIP:') &&
|
|
!startsWith(github.event.pull_request.title, '[WIP]')
|
|
)
|
|
)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Require every gate to have succeeded
|
|
run: |
|
|
echo "lint=${{ needs.lint.result }} test=${{ needs.test.result }}"
|
|
test "${{ needs.lint.result }}" = success
|
|
test "${{ needs.test.result }}" = success
|