| 1 |
--- |
| 2 |
name: Linting |
| 3 |
|
| 4 |
# yamllint disable-line rule:truthy |
| 5 |
on: |
| 6 |
push: |
| 7 |
branches: [main] |
| 8 |
pull_request: |
| 9 |
workflow_dispatch: |
| 10 |
|
| 11 |
env: |
| 12 |
DEFAULT_PYTHON: "3.11" |
| 13 |
|
| 14 |
jobs: |
| 15 |
codespell: |
| 16 |
name: codespell |
| 17 |
runs-on: ubuntu-latest |
| 18 |
steps: |
| 19 |
- name: โคต๏ธ Check out code from GitHub |
| 20 |
uses: actions/[email protected] |
| 21 |
- name: ๐ Set up uv |
| 22 |
uses: astral-sh/[email protected] |
| 23 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 24 |
id: python |
| 25 |
uses: actions/[email protected] |
| 26 |
with: |
| 27 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 28 |
- name: ๐ Install Python dependencies |
| 29 |
run: uv sync |
| 30 |
- name: ๐ Check code for common misspellings |
| 31 |
run: uv run pre-commit run codespell --all-files |
| 32 |
|
| 33 |
ruff: |
| 34 |
name: Ruff |
| 35 |
runs-on: ubuntu-latest |
| 36 |
steps: |
| 37 |
- name: โคต๏ธ Check out code from GitHub |
| 38 |
uses: actions/[email protected] |
| 39 |
- name: ๐ Set up uv |
| 40 |
uses: astral-sh/[email protected] |
| 41 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 42 |
id: python |
| 43 |
uses: actions/[email protected] |
| 44 |
with: |
| 45 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 46 |
- name: ๐ Install Python dependencies |
| 47 |
run: uv sync |
| 48 |
- name: ๐ Run ruff linter |
| 49 |
run: uv run ruff check --output-format=github . |
| 50 |
- name: ๐ Run ruff formatter |
| 51 |
run: uv run ruff format --check . |
| 52 |
|
| 53 |
pre-commit-hooks: |
| 54 |
name: pre-commit-hooks |
| 55 |
runs-on: ubuntu-latest |
| 56 |
steps: |
| 57 |
- name: โคต๏ธ Check out code from GitHub |
| 58 |
uses: actions/[email protected] |
| 59 |
- name: ๐ Set up uv |
| 60 |
uses: astral-sh/[email protected] |
| 61 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 62 |
id: python |
| 63 |
uses: actions/[email protected] |
| 64 |
with: |
| 65 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 66 |
- name: ๐ Install Python dependencies |
| 67 |
run: uv sync |
| 68 |
- name: ๐ Check Python AST |
| 69 |
run: uv run pre-commit run check-ast --all-files |
| 70 |
- name: ๐ Check for case conflicts |
| 71 |
run: uv run pre-commit run check-case-conflict --all-files |
| 72 |
- name: ๐ Check docstring is first |
| 73 |
run: uv run pre-commit run check-docstring-first --all-files |
| 74 |
- name: ๐ Check that executables have shebangs |
| 75 |
run: uv run pre-commit run check-executables-have-shebangs --all-files |
| 76 |
- name: ๐ Check JSON files |
| 77 |
run: uv run pre-commit run check-json --all-files |
| 78 |
- name: ๐ Check for merge conflicts |
| 79 |
run: uv run pre-commit run check-merge-conflict --all-files |
| 80 |
- name: ๐ Check for broken symlinks |
| 81 |
run: uv run pre-commit run check-symlinks --all-files |
| 82 |
- name: ๐ Check TOML files |
| 83 |
run: uv run pre-commit run check-toml --all-files |
| 84 |
- name: ๐ Check XML files |
| 85 |
run: uv run pre-commit run check-xml --all-files |
| 86 |
- name: ๐ Check YAML files |
| 87 |
run: uv run pre-commit run check-yaml --all-files |
| 88 |
- name: ๐ Detect Private Keys |
| 89 |
run: uv run pre-commit run detect-private-key --all-files |
| 90 |
- name: ๐ Check End of Files |
| 91 |
run: uv run pre-commit run end-of-file-fixer --all-files |
| 92 |
- name: ๐ Trim Trailing Whitespace |
| 93 |
run: uv run pre-commit run trailing-whitespace --all-files |
| 94 |
|
| 95 |
pylint: |
| 96 |
name: pylint |
| 97 |
runs-on: ubuntu-latest |
| 98 |
steps: |
| 99 |
- name: โคต๏ธ Check out code from GitHub |
| 100 |
uses: actions/[email protected] |
| 101 |
- name: ๐ Set up uv |
| 102 |
uses: astral-sh/[email protected] |
| 103 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 104 |
id: python |
| 105 |
uses: actions/[email protected] |
| 106 |
with: |
| 107 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 108 |
- name: ๐ Install Python dependencies |
| 109 |
run: uv sync |
| 110 |
- name: ๐ Run pylint |
| 111 |
run: uv run pre-commit run pylint --all-files |
| 112 |
|
| 113 |
yamllint: |
| 114 |
name: yamllint |
| 115 |
runs-on: ubuntu-latest |
| 116 |
steps: |
| 117 |
- name: โคต๏ธ Check out code from GitHub |
| 118 |
uses: actions/[email protected] |
| 119 |
- name: ๐ Set up uv |
| 120 |
uses: astral-sh/[email protected] |
| 121 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 122 |
id: python |
| 123 |
uses: actions/[email protected] |
| 124 |
with: |
| 125 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 126 |
- name: ๐ Install Python dependencies |
| 127 |
run: uv sync |
| 128 |
- name: ๐ Run yamllint |
| 129 |
run: uv run yamllint . |
| 130 |
|
| 131 |
prettier: |
| 132 |
name: Prettier |
| 133 |
runs-on: ubuntu-latest |
| 134 |
steps: |
| 135 |
- name: โคต๏ธ Check out code from GitHub |
| 136 |
uses: actions/[email protected] |
| 137 |
- name: ๐ Set up uv |
| 138 |
uses: astral-sh/[email protected] |
| 139 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 140 |
id: python |
| 141 |
uses: actions/[email protected] |
| 142 |
with: |
| 143 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 144 |
- name: ๐ Install Python dependencies |
| 145 |
run: uv sync |
| 146 |
- name: ๐ Set up Node.js |
| 147 |
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
| 148 |
with: |
| 149 |
node-version-file: ".nvmrc" |
| 150 |
cache: "npm" |
| 151 |
- name: ๐ Install NPM dependencies |
| 152 |
run: npm install |
| 153 |
- name: ๐ Run prettier |
| 154 |
run: uv run pre-commit run prettier --all-files |