|
| 1 | +# NOTE: adding exceptions for codespell into .github/.codespellignore |
| 2 | +name: pr-check |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + branches: [ main ] |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + codespell: |
| 11 | + name: Check spelling issues in repository. |
| 12 | + |
| 13 | + runs-on: ubuntu-latest |
| 14 | + timeout-minutes: 5 |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v3 |
| 17 | + |
| 18 | + - uses: codespell-project/actions-codespell@master |
| 19 | + with: |
| 20 | + ignore_words_file: .github/.codespellignore |
| 21 | + check_filenames: true |
| 22 | + check_hidden: false |
| 23 | + |
| 24 | + changes: |
| 25 | + name: Catch sub-repository with changes. |
| 26 | + |
| 27 | + runs-on: ubuntu-latest |
| 28 | + timeout-minutes: 5 |
| 29 | + outputs: |
| 30 | + python-workers: ${{ steps.python.outputs.changes }} |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v3 |
| 33 | + - uses: dorny/paths-filter@v2 |
| 34 | + id: python |
| 35 | + with: |
| 36 | + filters: | |
| 37 | + inventory/python: |
| 38 | + - 'inventory/python/**' |
| 39 | + misc/python/http: |
| 40 | + - 'misc/python/http/**' |
| 41 | + misc/python/influxdb: |
| 42 | + - 'misc/python/influxdb/**' |
| 43 | + misc/python/kafka: |
| 44 | + - 'misc/python/kafka/**' |
| 45 | + resource-manager/python: |
| 46 | + - 'resource-manager/python/**' |
| 47 | + schellar/python: |
| 48 | + - 'schellar/python/**' |
| 49 | + topology-discovery/python: |
| 50 | + - 'topology-discovery/python/**' |
| 51 | + uniconfig/python: |
| 52 | + - 'uniconfig/python/**' |
| 53 | + |
| 54 | + - name: Echoes changes. |
| 55 | + run: | |
| 56 | + echo "------------------------------------------------------------------------" |
| 57 | + echo "Caught changes in:" ${{ steps.python.outputs.changes }} |
| 58 | + echo "------------------------------------------------------------------------" |
| 59 | +
|
| 60 | + tests: |
| 61 | + name: Code testing in parallel. |
| 62 | + |
| 63 | + needs: changes |
| 64 | + if: ${{ needs.changes.outputs.python-workers != '[]' && needs.changes.outputs.python-workers != '' }} |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + directories: ${{ fromJSON(needs.changes.outputs.python-workers) }} |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v3 |
| 72 | + - uses: actions/setup-python@v4 |
| 73 | + with: |
| 74 | + python-version: "3.10" |
| 75 | + - uses: abatilo/actions-poetry@v2 |
| 76 | + with: |
| 77 | + poetry-version: "1.4.2" |
| 78 | + |
| 79 | + - name: Install package dependencies. |
| 80 | + run: | |
| 81 | + poetry install --verbose |
| 82 | + working-directory: ${{ matrix.directories }} |
| 83 | + |
| 84 | + - name: Run mypy. |
| 85 | + run: | |
| 86 | + poetry run mypy . |
| 87 | + working-directory: ${{ matrix.directories }} |
| 88 | + |
| 89 | + - name: Run ruff. |
| 90 | + run: | |
| 91 | + poetry run ruff . |
| 92 | + working-directory: ${{ matrix.directories }} |
| 93 | + |
| 94 | + - name: Run pyright. |
| 95 | + run: | |
| 96 | + poetry run pyright . |
| 97 | + working-directory: ${{ matrix.directories }} |
0 commit comments