|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + lint: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + - uses: astral-sh/setup-uv@v5 |
| 20 | + - uses: actions/setup-python@v5 |
| 21 | + with: |
| 22 | + python-version: "3.12" |
| 23 | + - run: uv sync --extra dev |
| 24 | + - name: Ruff check |
| 25 | + run: uv run ruff check src/ tests/ |
| 26 | + - name: Ruff format check |
| 27 | + run: uv run ruff format --check src/ tests/ |
| 28 | + |
| 29 | + typecheck: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - uses: astral-sh/setup-uv@v5 |
| 34 | + - uses: actions/setup-python@v5 |
| 35 | + with: |
| 36 | + python-version: "3.12" |
| 37 | + - run: uv sync --extra dev |
| 38 | + - name: Mypy type check |
| 39 | + run: uv run mypy src/ |
| 40 | + |
| 41 | + test: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + strategy: |
| 44 | + matrix: |
| 45 | + python-version: ["3.11", "3.12"] |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - uses: astral-sh/setup-uv@v5 |
| 49 | + - uses: actions/setup-python@v5 |
| 50 | + with: |
| 51 | + python-version: ${{ matrix.python-version }} |
| 52 | + - run: uv sync --extra dev |
| 53 | + - name: Run unit tests |
| 54 | + run: > |
| 55 | + uv run pytest tests/ -v --tb=short |
| 56 | + -m "not database and not integration" |
| 57 | + --cov=src/neuralnav |
| 58 | + --cov-report=xml |
| 59 | + --cov-report=term |
| 60 | +
|
| 61 | + ci-status: |
| 62 | + if: always() |
| 63 | + needs: [lint, typecheck, test] |
| 64 | + runs-on: ubuntu-latest |
| 65 | + steps: |
| 66 | + - name: Check CI status |
| 67 | + run: | |
| 68 | + if [[ "${{ needs.lint.result }}" != "success" || |
| 69 | + "${{ needs.typecheck.result }}" != "success" || |
| 70 | + "${{ needs.test.result }}" != "success" ]]; then |
| 71 | + echo "CI failed" |
| 72 | + exit 1 |
| 73 | + fi |
| 74 | + echo "CI passed" |
0 commit comments