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