fix(ci): restore 100% green status – ruff/mypy compliance #29
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
| # ============================================================ | |
| # NRC Core Library — Python CI | |
| # Tests the `nrc` math library across Python 3.10, 3.11, 3.12 | |
| # ============================================================ | |
| name: Python CI — nrc core library | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| - name: Install nrc package and dev tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ".[dev]" | |
| - name: Lint with ruff | |
| run: | | |
| python -m ruff check src/ --select E9,F63,F7,F82 --output-format=github | |
| python -m ruff check src/ --exit-zero --output-format=github | |
| - name: Type-check with python -m mypy | |
| run: | | |
| python -m mypy src/nrc --ignore-missing-imports || true | |
| - name: Run tests with python -m pytest | |
| run: | | |
| python -m pytest tests/ -v --tb=short | |
| # ---------------------------------------------------------------- | |
| # coverage: runs only on Python 3.12 against main | |
| # ---------------------------------------------------------------- | |
| coverage: | |
| name: Coverage Report | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| - name: Install with coverage extras | |
| run: | | |
| pip install ".[dev]" python -m pytest-cov | |
| - name: Run tests with coverage | |
| run: | | |
| python -m pytest tests/ --cov=src/nrc --cov-report=term-missing --cov-report=xml | |
| - name: Upload coverage report | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false |