Skip to content

CI設定

CI設定 #1

Workflow file for this run

# GitHub Actions CI Pipeline for c2.pas.aal2
#
# This workflow runs on every push and pull request to ensure code quality
# and compatibility across Python 3.11, 3.12, and 3.13.
#
# Design Decisions:
# - Linting and type checking run on Python 3.11 only (results are version-independent)
# - Tests run on all three Python versions in parallel (verifies runtime compatibility)
# - UV package manager with lockfile-based caching for fast, reproducible builds
# - Parallel test execution (pytest -n auto) for 60-80% performance improvement
# - Target: Complete CI in 3-5 minutes (requirement: <10 minutes)
name: CI
on:
push:
branches: ['**'] # Run on all branches to catch issues early
pull_request:
types: [opened, synchronize, reopened]
env:
UV_CACHE_DIR: /tmp/.uv-cache # Centralized cache location for uv
jobs:
lint-and-typecheck:
name: Lint and Type Check (Python 3.11)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Set up Python 3.11
run: uv python install 3.11
# Cache Strategy: Lockfile-based keys for automatic invalidation
# Cache hit saves 1-2 minutes per run
- name: Cache uv dependencies
uses: actions/cache@v4
with:
path: |
/tmp/.uv-cache
.venv
key: ${{ runner.os }}-py3.11-uv-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-py3.11-uv-
- name: Install dependencies
run: uv sync --frozen --all-extras
- name: Run ruff linting
run: uv run ruff check .
- name: Run pyright type checking
run: uv run pyright
- name: Prune cache
run: uv cache prune --ci
test:
name: Test (Python ${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Cache uv dependencies
uses: actions/cache@v4
with:
path: |
/tmp/.uv-cache
.venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-uv-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-uv-
- name: Install dependencies
run: uv sync --frozen --all-extras
- name: Run tests with coverage
run: uv run pytest --cov --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Prune cache
run: uv cache prune --ci