|
| 1 | +name: pr |
| 2 | + |
| 3 | +on: |
| 4 | + - pull_request |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + pull-requests: read |
| 9 | + checks: write |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +env: |
| 16 | + PYTHON_VERSION: "3.8" |
| 17 | + POETRY_VERSION: "1.8.3" |
| 18 | + RUFF_VERSION: "0.6.7" |
| 19 | + |
| 20 | +jobs: |
| 21 | + lint: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + timeout-minutes: 10 |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Install python |
| 28 | + uses: actions/setup-python@v5 |
| 29 | + with: |
| 30 | + python-version: ${{ env.PYTHON_VERSION }} |
| 31 | + |
| 32 | + - name: Install dependencies |
| 33 | + run: | |
| 34 | + pip install --upgrade pip |
| 35 | + pip install ruff==${{ env.RUFF_VERSION }} |
| 36 | +
|
| 37 | + - name: Run Ruff |
| 38 | + run: ruff check --output-format=github . |
| 39 | + |
| 40 | + test: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + strategy: |
| 43 | + matrix: |
| 44 | + python: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 45 | + |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + |
| 49 | + - name: Setup Python |
| 50 | + uses: actions/setup-python@v5 |
| 51 | + with: |
| 52 | + python-version: ${{ matrix.python }} |
| 53 | + cache: 'pip' |
| 54 | + |
| 55 | + - name: Install Poetry |
| 56 | + run: pip install poetry==${{ env.POETRY_VERSION }} |
| 57 | + |
| 58 | + - name: Restore dependencies from cache |
| 59 | + uses: actions/cache@v4 |
| 60 | + with: |
| 61 | + path: ~/.cache/pypoetry |
| 62 | + key: dependencies-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }} |
| 63 | + restore-keys: | |
| 64 | + dependencies-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}- |
| 65 | +
|
| 66 | + - name: Install dependencies |
| 67 | + if: steps.setup-python.outputs.cache-hit != 'true' |
| 68 | + run: | |
| 69 | + poetry config virtualenvs.create false |
| 70 | + poetry install --no-root --no-interaction |
| 71 | +
|
| 72 | + - name: Run Pytest on Python ${{ matrix.python }} |
| 73 | + run: poetry run pytest -m "not integration" |
0 commit comments