|
| 1 | +name: Type Coverage and Linting |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + types: [opened, reopened, synchronize] |
| 11 | + |
| 12 | +jobs: |
| 13 | + check: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + python-version: ["3.11", "3.x"] |
| 19 | + |
| 20 | + name: "Type Coverage and Linting @ ${{ matrix.python-version }}" |
| 21 | + steps: |
| 22 | + - name: "Checkout Repository" |
| 23 | + uses: actions/checkout@v3 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: "Load cached poetry installation @ ${{ matrix.python-version }}" |
| 28 | + id: cached-poetry |
| 29 | + uses: actions/cache@v3 |
| 30 | + with: |
| 31 | + path: ~/.local |
| 32 | + key: poetry-0 |
| 33 | + |
| 34 | + - name: "Setup Poetry @ ${{ matrix.python-version }}" |
| 35 | + if: steps.cached-poetry.outputs.cache-hit != 'true' |
| 36 | + uses: snok/install-poetry@v1 |
| 37 | + with: |
| 38 | + version: latest |
| 39 | + virtualenvs-create: true |
| 40 | + virtualenvs-in-project: true |
| 41 | + virtualenvs-path: .venv |
| 42 | + |
| 43 | + - name: "Setup Python @ ${{ matrix.python-version }}" |
| 44 | + id: setup-python |
| 45 | + uses: actions/setup-python@v4 |
| 46 | + with: |
| 47 | + python-version: "${{ matrix.python-version }}" |
| 48 | + cache: "poetry" |
| 49 | + |
| 50 | + - name: "Load cached venv @ ${{ matrix.python-version }}" |
| 51 | + id: cached-pip-wheels |
| 52 | + uses: actions/cache@v3 |
| 53 | + with: |
| 54 | + path: .venv/ |
| 55 | + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 56 | + |
| 57 | + - name: "Install Python deps @ ${{ matrix.python-version }}" |
| 58 | + if: ${{ steps.cached-pip-wheels.outputs.cache-hit != 'true' }} |
| 59 | + id: install-deps |
| 60 | + run: | |
| 61 | + poetry install --without=dev --no-interaction |
| 62 | +
|
| 63 | + - name: Activate venv @ ${{ matrix.python-version }} |
| 64 | + run: | |
| 65 | + echo "$(poetry env info --path)/bin" >> $GITHUB_PATH |
| 66 | +
|
| 67 | + - name: "Run Pyright @ ${{ matrix.python-version }}" |
| 68 | + uses: jakebailey/pyright-action@v1 |
| 69 | + with: |
| 70 | + warnings: false |
| 71 | + ignore-external: true |
| 72 | + no-comments: ${{ matrix.python-version != '3.x' }} |
| 73 | + |
| 74 | + - name: Lint |
| 75 | + if: ${{ always() && steps.install-deps.outcome == 'success' }} |
| 76 | + uses: github/super-linter/slim@v4 |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + DEFAULT_BRANCH: main |
| 80 | + VALIDATE_ALL_CODEBASE: false |
| 81 | + VALIDATE_PYTHON_BLACK: true |
| 82 | + VALIDATE_PYTHON_ISORT: true |
| 83 | + LINTER_RULES_PATH: / |
| 84 | + PYTHON_ISORT_CONFIG_FILE: pyproject.toml |
| 85 | + PYTHON_BLACK_CONFIG_FILE: pyproject.toml |
0 commit comments