|
| 1 | +--- |
| 2 | +name: Linting |
| 3 | + |
| 4 | +# yamllint disable-line rule:truthy |
| 5 | +on: |
| 6 | + push: |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + DEFAULT_PYTHON: "3.11" |
| 12 | + |
| 13 | +jobs: |
| 14 | + ruff: |
| 15 | + name: Ruff |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: ⤵️ Check out code from GitHub |
| 19 | + uses: actions/checkout@v4.2.2 |
| 20 | + - name: 🏗 Set up Poetry |
| 21 | + run: pipx install poetry |
| 22 | + - name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} |
| 23 | + id: python |
| 24 | + uses: actions/setup-python@v5.4.0 |
| 25 | + with: |
| 26 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 27 | + cache: "poetry" |
| 28 | + - name: 🏗 Install workflow dependencies |
| 29 | + run: | |
| 30 | + poetry config virtualenvs.create true |
| 31 | + poetry config virtualenvs.in-project true |
| 32 | + - name: 🏗 Install Python dependencies |
| 33 | + run: poetry install --no-interaction |
| 34 | + - name: 🚀 Run ruff linter |
| 35 | + run: poetry run ruff check --output-format=github . |
| 36 | + - name: 🚀 Run ruff formatter |
| 37 | + run: poetry run ruff format --check . |
| 38 | + |
| 39 | + pre-commit-hooks: |
| 40 | + name: pre-commit-hooks |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - name: ⤵️ Check out code from GitHub |
| 44 | + uses: actions/checkout@v4.2.2 |
| 45 | + - name: 🏗 Set up Poetry |
| 46 | + run: pipx install poetry |
| 47 | + - name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} |
| 48 | + id: python |
| 49 | + uses: actions/setup-python@v5.4.0 |
| 50 | + with: |
| 51 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 52 | + cache: "poetry" |
| 53 | + - name: 🏗 Install workflow dependencies |
| 54 | + run: | |
| 55 | + poetry config virtualenvs.create true |
| 56 | + poetry config virtualenvs.in-project true |
| 57 | + - name: 🏗 Install Python dependencies |
| 58 | + run: poetry install --no-interaction |
| 59 | + - name: 🚀 Check Python AST |
| 60 | + run: poetry run pre-commit run check-ast --all-files |
| 61 | + - name: 🚀 Check for case conflicts |
| 62 | + run: poetry run pre-commit run check-case-conflict --all-files |
| 63 | + - name: 🚀 Check docstring is first |
| 64 | + run: poetry run pre-commit run check-docstring-first --all-files |
| 65 | + - name: 🚀 Check JSON files |
| 66 | + run: poetry run pre-commit run check-json --all-files |
| 67 | + - name: 🚀 Check YAML files |
| 68 | + run: poetry run pre-commit run check-yaml --all-files |
| 69 | + - name: 🚀 Detect Private Keys |
| 70 | + run: poetry run pre-commit run detect-private-key --all-files |
| 71 | + - name: 🚀 Check End of Files |
| 72 | + run: poetry run pre-commit run end-of-file-fixer --all-files |
| 73 | + - name: 🚀 Trim Trailing Whitespace |
| 74 | + run: poetry run pre-commit run trailing-whitespace --all-files |
0 commit comments