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