diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e4422ce --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,67 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + name: Test (Python ${{ matrix.python-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: ${{ matrix.python-version }} + enable-cache: true + + - name: Install dependencies + run: uv sync --extra dev + + - name: Run tests + run: uv run python -m pytest tests/ --no-cov -q + + - name: Run tests with coverage (3.11 only) + if: matrix.python-version == '3.11' + run: uv run python -m pytest tests/ --cov=fastapi_correlation --cov-report=xml -q + + - name: Upload coverage + if: matrix.python-version == '3.11' + uses: codecov/codecov-action@v4 + with: + file: coverage.xml + fail_ci_if_error: false + + lint: + name: Lint & type check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.11" + enable-cache: true + + - name: Install dependencies + run: uv sync --extra dev + + - name: Ruff lint + run: uv run ruff check fastapi_correlation/ tests/ + + - name: Ruff format check + run: uv run ruff format --check fastapi_correlation/ tests/ + + - name: mypy + run: uv run python -m mypy fastapi_correlation/ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..cc63dbb --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*.*.*" + +jobs: + publish: + name: Build and publish + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write # required for trusted publishing + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.11" + enable-cache: true + + - name: Install dependencies + run: uv sync --extra dev + + - name: Run tests + run: uv run python -m pytest tests/ --no-cov -q + + - name: Build + run: uv build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1