|
| 1 | +name: CI (Poetry) |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ main ] |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + lint: |
| 14 | + name: lint |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - uses: actions/setup-python@v5 |
| 20 | + with: |
| 21 | + python-version: "3.11" |
| 22 | + |
| 23 | + - name: Install Poetry |
| 24 | + uses: snok/install-poetry@v1 |
| 25 | + with: |
| 26 | + virtualenvs-create: true |
| 27 | + virtualenvs-in-project: true |
| 28 | + installer-parallel: true |
| 29 | + |
| 30 | + - name: Cache venv |
| 31 | + uses: actions/cache@v4 |
| 32 | + with: |
| 33 | + path: .venv |
| 34 | + key: venv-${{ runner.os }}-py311-${{ hashFiles('**/poetry.lock') }} |
| 35 | + restore-keys: | |
| 36 | + venv-${{ runner.os }}-py311- |
| 37 | +
|
| 38 | + - name: Install deps (dev/test groups if present) |
| 39 | + run: | |
| 40 | + if poetry install --no-interaction --with dev,test; then |
| 41 | + echo "Installed with groups dev,test" |
| 42 | + else |
| 43 | + poetry install --no-interaction |
| 44 | + fi |
| 45 | +
|
| 46 | + - name: Ruff |
| 47 | + run: poetry run ruff check . |
| 48 | + |
| 49 | + typecheck: |
| 50 | + name: typecheck |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + - uses: actions/setup-python@v5 |
| 55 | + with: |
| 56 | + python-version: "3.11" |
| 57 | + - uses: snok/install-poetry@v1 |
| 58 | + with: |
| 59 | + virtualenvs-create: true |
| 60 | + virtualenvs-in-project: true |
| 61 | + installer-parallel: true |
| 62 | + - uses: actions/cache@v4 |
| 63 | + with: |
| 64 | + path: .venv |
| 65 | + key: venv-${{ runner.os }}-py311-${{ hashFiles('**/poetry.lock') }} |
| 66 | + restore-keys: | |
| 67 | + venv-${{ runner.os }}-py311- |
| 68 | + - name: Install deps |
| 69 | + run: | |
| 70 | + if poetry install --no-interaction --with dev,test; then |
| 71 | + echo "Installed with groups dev,test" |
| 72 | + else |
| 73 | + poetry install --no-interaction |
| 74 | + fi |
| 75 | + - name: mypy |
| 76 | + run: | |
| 77 | + poetry run mypy src || poetry run mypy . |
| 78 | +
|
| 79 | + tests: |
| 80 | + name: tests |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v4 |
| 84 | + - uses: actions/setup-python@v5 |
| 85 | + with: |
| 86 | + python-version: "3.11" |
| 87 | + - uses: snok/install-poetry@v1 |
| 88 | + with: |
| 89 | + virtualenvs-create: true |
| 90 | + virtualenvs-in-project: true |
| 91 | + installer-parallel: true |
| 92 | + - uses: actions/cache@v4 |
| 93 | + with: |
| 94 | + path: .venv |
| 95 | + key: venv-${{ runner.os }}-py311-${{ hashFiles('**/poetry.lock') }} |
| 96 | + restore-keys: | |
| 97 | + venv-${{ runner.os }}-py311- |
| 98 | + - name: Install deps |
| 99 | + run: | |
| 100 | + if poetry install --no-interaction --with dev,test; then |
| 101 | + echo "Installed with groups dev,test" |
| 102 | + else |
| 103 | + poetry install --no-interaction |
| 104 | + fi |
| 105 | + - name: pytest |
| 106 | + run: poetry run pytest -q |
| 107 | + |
| 108 | + build: |
| 109 | + name: build |
| 110 | + runs-on: ubuntu-latest |
| 111 | + steps: |
| 112 | + - uses: actions/checkout@v4 |
| 113 | + - uses: actions/setup-python@v5 |
| 114 | + with: |
| 115 | + python-version: "3.11" |
| 116 | + - uses: snok/install-poetry@v1 |
| 117 | + with: |
| 118 | + virtualenvs-create: true |
| 119 | + virtualenvs-in-project: true |
| 120 | + installer-parallel: true |
| 121 | + - uses: actions/cache@v4 |
| 122 | + with: |
| 123 | + path: .venv |
| 124 | + key: venv-${{ runner.os }}-py311-${{ hashFiles('**/poetry.lock') }} |
| 125 | + restore-keys: | |
| 126 | + venv-${{ runner.os }}-py311- |
| 127 | + - name: Install deps (no root) |
| 128 | + run: | |
| 129 | + if poetry install --no-interaction --with dev,test; then |
| 130 | + echo "Installed with groups dev,test" |
| 131 | + else |
| 132 | + poetry install --no-interaction |
| 133 | + fi |
| 134 | + - name: Build package |
| 135 | + run: poetry build |
0 commit comments