Files
takopi/.github/workflows/ci.yml
T
2026-01-15 22:20:04 +04:00

93 lines
2.5 KiB
YAML

name: CI
on:
push:
branches:
- "master"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
checks:
name: ${{ matrix.task }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- task: format
do_sync: true
command: uv run --no-sync ruff format --check --diff src tests
sync_args: --no-install-project
- task: ruff
do_sync: true
command: uv run --no-sync ruff check src tests --output-format=github
sync_args: --no-install-project
- task: ty
do_sync: true
command: uv run --no-sync ty check src tests
sync_args: --no-install-project
- task: pytest
do_sync: true
command: uv run --no-sync pytest
sync_args: ""
- task: build
do_sync: false
command: uv build
sync_args: ""
- task: docs
do_sync: true
command: uv run --no-sync python scripts/docs_prebuild.py && uv run --no-sync zensical build --clean
sync_args: --no-install-project --group docs
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14"
enable-cache: true
- name: Install dependencies
if: matrix.do_sync
run: uv sync --frozen ${{ matrix.sync_args }}
- name: Run check
run: ${{ matrix.command }}
- name: Add coverage to summary
if: ${{ always() && matrix.task == 'pytest' }}
run: |
{
echo "## Coverage"
echo ""
uv run --no-sync python -m coverage report || true
} >> "$GITHUB_STEP_SUMMARY"
notify-commit:
name: notify-commit
runs-on: ubuntu-latest
needs: checks
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.checks.result == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.14"
enable-cache: true
- name: Send Telegram notification
run: uv run scripts/commit_notify.py
env:
REPO: ${{ github.repository }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}