Add executable API docs and Google-style util docstrings. #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test and coverage | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| code-style: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| # Pin ruff to the version in pyproject so CI formatting matches local usage. | |
| - uses: astral-sh/ruff-action@v3 | |
| with: | |
| version: "0.16.0" | |
| # Check only (no --fix / no in-place format): style and format violations must fail CI | |
| # rather than being silently auto-fixed in the runner and discarded. | |
| - run: ruff check | |
| - run: ruff format --check | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Add versions here to expand support matrix | |
| python-version: ["3.12", "3.13"] | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| PYTHON: ${{ matrix.python-version }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --locked | |
| - name: Run tests | |
| if: matrix.python-version != '3.12' || matrix.os != 'ubuntu-latest' | |
| run: uv run pytest -v | |
| - name: Run tests with coverage | |
| if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' | |
| run: | | |
| uv run pytest -v --cov-config=.coveragerc --cov=shadowsim \ | |
| --cov-report=xml --cov-report=term-missing:skip-covered | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| use_oidc: true | |
| # Coverage upload is informational; a transient codecov CLI/CDN or | |
| # signature-verification failure should not red an otherwise-green build. | |
| fail_ci_if_error: false | |
| files: ./coverage.xml | |
| verbose: true |