|
7 | 7 | pull_request:
|
8 | 8 | workflow_dispatch:
|
9 | 9 |
|
| 10 | +env: |
| 11 | + DEFAULT_PYTHON: "3.9" |
| 12 | + |
10 | 13 | jobs:
|
11 |
| - precommit: |
12 |
| - name: ${{ matrix.name }} |
| 14 | + codespell: |
| 15 | + name: codespell |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: ⤵️ Check out code from GitHub |
| 19 | + uses: actions/checkout@v3 |
| 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@v4 |
| 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: 🚀 Check code for common misspellings |
| 35 | + run: poetry run pre-commit run codespell --all-files |
| 36 | + |
| 37 | + ruff: |
| 38 | + name: Ruff |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: ⤵️ Check out code from GitHub |
| 42 | + uses: actions/checkout@v3 |
| 43 | + - name: 🏗 Set up Poetry |
| 44 | + run: pipx install poetry |
| 45 | + - name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} |
| 46 | + id: python |
| 47 | + uses: actions/setup-python@v4 |
| 48 | + with: |
| 49 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 50 | + cache: 'poetry' |
| 51 | + - name: 🏗 Install workflow dependencies |
| 52 | + run: | |
| 53 | + poetry config virtualenvs.create true |
| 54 | + poetry config virtualenvs.in-project true |
| 55 | + - name: 🏗 Install Python dependencies |
| 56 | + run: poetry install --no-interaction |
| 57 | + - name: 🚀 Run Ruff |
| 58 | + run: poetry run ruff . |
| 59 | + |
| 60 | + black: |
| 61 | + name: black |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - name: ⤵️ Check out code from GitHub |
| 65 | + uses: actions/checkout@v3 |
| 66 | + - name: 🏗 Set up Poetry |
| 67 | + run: pipx install poetry |
| 68 | + - name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} |
| 69 | + id: python |
| 70 | + uses: actions/setup-python@v4 |
| 71 | + with: |
| 72 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 73 | + cache: 'poetry' |
| 74 | + - name: 🏗 Install workflow dependencies |
| 75 | + run: | |
| 76 | + poetry config virtualenvs.create true |
| 77 | + poetry config virtualenvs.in-project true |
| 78 | + - name: 🏗 Install Python dependencies |
| 79 | + run: poetry install --no-interaction |
| 80 | + - name: 🚀 Run black on docs |
| 81 | + run: poetry run blacken-docs |
| 82 | + |
| 83 | + pre-commit-hooks: |
| 84 | + name: pre-commit-hooks |
13 | 85 | runs-on: ubuntu-latest
|
14 |
| - if: ${{ github.actor != 'dependabot[bot]' }} |
15 |
| - strategy: |
16 |
| - matrix: |
17 |
| - include: |
18 |
| - - id: bandit |
19 |
| - name: Check with bandit |
20 |
| - - id: black |
21 |
| - name: Check code style |
22 |
| - - id: blacken-docs |
23 |
| - name: Check code style in documentation |
24 |
| - - id: check-ast |
25 |
| - name: Check Python AST |
26 |
| - - id: check-case-conflict |
27 |
| - name: Check for case conflicts |
28 |
| - - id: check-docstring-first |
29 |
| - name: Check docstring is first |
30 |
| - - id: check-executables-have-shebangs |
31 |
| - name: Check that executables have shebangs |
32 |
| - - id: check-json |
33 |
| - name: Check JSON files |
34 |
| - - id: check-merge-conflict |
35 |
| - name: Check for merge conflicts |
36 |
| - - id: check-symlinks |
37 |
| - name: Check for broken symlinks |
38 |
| - - id: check-toml |
39 |
| - name: Check TOML files |
40 |
| - - id: check-yaml |
41 |
| - name: Check YAML files |
42 |
| - - id: codespell |
43 |
| - name: Check code for common misspellings |
44 |
| - - id: debug-statements |
45 |
| - name: Debug Statements and imports (Python) |
46 |
| - - id: detect-private-key |
47 |
| - name: Detect Private Keys |
48 |
| - - id: end-of-file-fixer |
49 |
| - name: Check End of Files |
50 |
| - - id: fix-byte-order-marker |
51 |
| - name: Check UTF-8 byte order marker |
52 |
| - - id: flake8 |
53 |
| - name: Enforcing style guide with flake8 |
54 |
| - - id: isort |
55 |
| - name: Check imports are sorted |
56 |
| - - id: poetry |
57 |
| - name: Check pyproject file |
58 |
| - - id: pylint |
59 |
| - name: Check with pylint |
60 |
| - - id: pyupgrade |
61 |
| - name: Check for upgradable syntax |
62 |
| - - id: trailing-whitespace |
63 |
| - name: Trim Trailing Whitespace |
64 |
| - - id: vulture |
65 |
| - name: Check for unused Python code |
66 |
| - - id: yamllint |
67 |
| - name: Check YAML style |
68 | 86 | steps:
|
69 | 87 | - name: ⤵️ Check out code from GitHub
|
70 | 88 | uses: actions/checkout@v3
|
71 |
| - - name: 🏗 Set up Python 3.9 |
| 89 | + - name: 🏗 Set up Poetry |
| 90 | + run: pipx install poetry |
| 91 | + - name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} |
72 | 92 | id: python
|
73 | 93 | uses: actions/setup-python@v4
|
74 | 94 | with:
|
75 |
| - python-version: 3.9 |
76 |
| - - name: 🏗 Get pip cache dir |
77 |
| - id: pip-cache |
| 95 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 96 | + cache: 'poetry' |
| 97 | + - name: 🏗 Install workflow dependencies |
78 | 98 | run: |
|
79 |
| - echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT |
80 |
| - - name: ⤵️ Restore cached Python PIP packages |
81 |
| - uses: actions/cache@v3 |
| 99 | + poetry config virtualenvs.create true |
| 100 | + poetry config virtualenvs.in-project true |
| 101 | + - name: 🏗 Install Python dependencies |
| 102 | + run: poetry install --no-interaction |
| 103 | + - name: 🚀 Check Python AST |
| 104 | + run: poetry run pre-commit run check-ast --all-files |
| 105 | + - name: 🚀 Check for case conflicts |
| 106 | + run: poetry run pre-commit run check-case-conflict --all-files |
| 107 | + - name: 🚀 Check docstring is first |
| 108 | + run: poetry run pre-commit run check-docstring-first --all-files |
| 109 | + - name: 🚀 Check that executables have shebangs |
| 110 | + run: poetry run pre-commit run check-executables-have-shebangs --all-files |
| 111 | + - name: 🚀 Check JSON files |
| 112 | + run: poetry run pre-commit run check-json --all-files |
| 113 | + - name: 🚀 Check for merge conflicts |
| 114 | + run: poetry run pre-commit run check-merge-conflict --all-files |
| 115 | + - name: 🚀 Check for broken symlinks |
| 116 | + run: poetry run pre-commit run check-symlinks --all-files |
| 117 | + - name: 🚀 Check TOML files |
| 118 | + run: poetry run pre-commit run check-toml --all-files |
| 119 | + - name: 🚀 Check XML files |
| 120 | + run: poetry run pre-commit run check-xml --all-files |
| 121 | + - name: 🚀 Check YAML files |
| 122 | + run: poetry run pre-commit run check-yaml --all-files |
| 123 | + - name: 🚀 Check YAML files |
| 124 | + run: poetry run pre-commit run check-yaml --all-files |
| 125 | + - name: 🚀 Detect Private Keys |
| 126 | + run: poetry run pre-commit run detect-private-key --all-files |
| 127 | + - name: 🚀 Check End of Files |
| 128 | + run: poetry run pre-commit run end-of-file-fixer --all-files |
| 129 | + - name: 🚀 Trim Trailing Whitespace |
| 130 | + run: poetry run pre-commit run trailing-whitespace --all-files |
| 131 | + |
| 132 | + pylint: |
| 133 | + name: pylint |
| 134 | + runs-on: ubuntu-latest |
| 135 | + steps: |
| 136 | + - name: ⤵️ Check out code from GitHub |
| 137 | + uses: actions/checkout@v3 |
| 138 | + - name: 🏗 Set up Poetry |
| 139 | + run: pipx install poetry |
| 140 | + - name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} |
| 141 | + id: python |
| 142 | + uses: actions/setup-python@v4 |
82 | 143 | with:
|
83 |
| - path: ${{ steps.pip-cache.outputs.dir }} |
84 |
| - key: pip-${{ runner.os }}-v1-${{ steps.python.outputs.python-version }}-${{ hashFiles('.github/workflows/requirements.txt') }} |
85 |
| - restore-keys: | |
86 |
| - pip-${{ runner.os }}-v1-${{ steps.python.outputs.python-version }}- |
| 144 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 145 | + cache: 'poetry' |
87 | 146 | - name: 🏗 Install workflow dependencies
|
88 | 147 | run: |
|
89 |
| - pip install -r .github/workflows/requirements.txt |
90 | 148 | poetry config virtualenvs.create true
|
91 | 149 | poetry config virtualenvs.in-project true
|
92 |
| - - name: ⤵️ Restore cached Python virtual environment |
93 |
| - id: cached-poetry-dependencies |
94 |
| - uses: actions/cache@v3 |
| 150 | + - name: 🏗 Install Python dependencies |
| 151 | + run: poetry install --no-interaction |
| 152 | + - name: 🚀 Run pylint |
| 153 | + run: poetry run pre-commit run pylint --all-files |
| 154 | + |
| 155 | + yamllint: |
| 156 | + name: yamllint |
| 157 | + runs-on: ubuntu-latest |
| 158 | + steps: |
| 159 | + - name: ⤵️ Check out code from GitHub |
| 160 | + uses: actions/checkout@v3 |
| 161 | + - name: 🏗 Set up Poetry |
| 162 | + run: pipx install poetry |
| 163 | + - name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }} |
| 164 | + id: python |
| 165 | + uses: actions/setup-python@v4 |
95 | 166 | with:
|
96 |
| - path: .venv |
97 |
| - key: >- |
98 |
| - venv-${{ runner.os }}-v1-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} |
99 |
| - venv-${{ runner.os }}-v1-${{ steps.python.outputs.python-version }}- |
| 167 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 168 | + cache: 'poetry' |
| 169 | + - name: 🏗 Install workflow dependencies |
| 170 | + run: | |
| 171 | + poetry config virtualenvs.create true |
| 172 | + poetry config virtualenvs.in-project true |
100 | 173 | - name: 🏗 Install Python dependencies
|
101 | 174 | run: poetry install --no-interaction
|
102 |
| - - name: 🚀 Run pre-commit for ${{ matrix.id }} |
103 |
| - run: poetry run pre-commit run ${{ matrix.id }} --all-files |
| 175 | + - name: 🚀 Run yamllint |
| 176 | + run: poetry run yamllint . |
0 commit comments