|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - v2 |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + ruff: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + timeout-minutes: 10 |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + steps: |
| 25 | + - name: Check out code |
| 26 | + uses: actions/checkout@v5 |
| 27 | + |
| 28 | + - name: Set up Python 3.14 |
| 29 | + uses: actions/setup-python@v6 |
| 30 | + with: |
| 31 | + python-version: '3.14' |
| 32 | + - name: Set up uv |
| 33 | + uses: astral-sh/setup-uv@v7 |
| 34 | + with: |
| 35 | + enable-cache: true |
| 36 | + cache-dependency-glob: | |
| 37 | + pyproject.toml |
| 38 | + uv.lock |
| 39 | +
|
| 40 | + - name: Sync development environment |
| 41 | + run: uv sync --locked --extra development |
| 42 | + |
| 43 | + - name: Run ruff |
| 44 | + run: | |
| 45 | + uv run ruff format --check . |
| 46 | + uv run ruff check . |
| 47 | +
|
| 48 | + pyright: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + timeout-minutes: 10 |
| 51 | + permissions: |
| 52 | + contents: read |
| 53 | + steps: |
| 54 | + - name: Check out code |
| 55 | + uses: actions/checkout@v5 |
| 56 | + |
| 57 | + - name: Set up Python 3.14 |
| 58 | + uses: actions/setup-python@v6 |
| 59 | + with: |
| 60 | + python-version: '3.14' |
| 61 | + - name: Set up uv |
| 62 | + uses: astral-sh/setup-uv@v7 |
| 63 | + with: |
| 64 | + enable-cache: true |
| 65 | + cache-dependency-glob: | |
| 66 | + pyproject.toml |
| 67 | + uv.lock |
| 68 | +
|
| 69 | + - name: Sync development environment |
| 70 | + run: uv sync --locked --extra development |
| 71 | + |
| 72 | + - name: Run pyright |
| 73 | + run: uv run pyright |
| 74 | + |
| 75 | + tests: |
| 76 | + runs-on: ubuntu-latest |
| 77 | + timeout-minutes: 20 |
| 78 | + permissions: |
| 79 | + contents: read |
| 80 | + env: |
| 81 | + CODECOV_TOKEN: ${{ secrets.CODECOVEXCELALCHEMY }} |
| 82 | + strategy: |
| 83 | + fail-fast: false |
| 84 | + matrix: |
| 85 | + python-version: ['3.12', '3.13', '3.14'] |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Check out code |
| 89 | + uses: actions/checkout@v5 |
| 90 | + |
| 91 | + - name: Set up Python ${{ matrix.python-version }} |
| 92 | + uses: actions/setup-python@v6 |
| 93 | + with: |
| 94 | + python-version: ${{ matrix.python-version }} |
| 95 | + - name: Set up uv |
| 96 | + uses: astral-sh/setup-uv@v7 |
| 97 | + with: |
| 98 | + enable-cache: true |
| 99 | + cache-dependency-glob: | |
| 100 | + pyproject.toml |
| 101 | + uv.lock |
| 102 | +
|
| 103 | + - name: Sync development environment |
| 104 | + run: uv sync --locked --extra development |
| 105 | + |
| 106 | + - name: Run test suite |
| 107 | + run: | |
| 108 | + uv run pytest --cov=excelalchemy --cov-report=term-missing:skip-covered --cov-report=xml:coverage.xml --junitxml=pytest.xml tests |
| 109 | +
|
| 110 | + - name: Upload coverage artifact |
| 111 | + if: always() && matrix.python-version == '3.14' |
| 112 | + uses: actions/upload-artifact@v4 |
| 113 | + with: |
| 114 | + name: test-reports-${{ matrix.python-version }} |
| 115 | + path: | |
| 116 | + coverage.xml |
| 117 | + pytest.xml |
| 118 | + if-no-files-found: warn |
| 119 | + retention-days: 14 |
| 120 | + |
| 121 | + - name: Upload coverage to Codecov |
| 122 | + if: matrix.python-version == '3.14' && env.CODECOV_TOKEN != '' |
| 123 | + uses: codecov/codecov-action@v5 |
| 124 | + with: |
| 125 | + files: coverage.xml |
| 126 | + disable_search: true |
| 127 | + token: ${{ env.CODECOV_TOKEN }} |
0 commit comments