| 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.12" |
| 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/[email protected] |
| 20 |
- name: ๐ Set up Poetry |
| 21 |
run: pipx install poetry |
| 22 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 23 |
id: python |
| 24 |
uses: actions/[email protected] |
| 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 |
prek-hooks: |
| 40 |
name: prek-hooks |
| 41 |
runs-on: ubuntu-latest |
| 42 |
steps: |
| 43 |
- name: โคต๏ธ Check out code from GitHub |
| 44 |
uses: actions/[email protected] |
| 45 |
- name: ๐ Set up Poetry |
| 46 |
run: pipx install poetry |
| 47 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 48 |
id: python |
| 49 |
uses: actions/[email protected] |
| 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 prek run check-ast --all-files |
| 61 |
- name: ๐ Check for case conflicts |
| 62 |
run: poetry run prek run check-case-conflict --all-files |
| 63 |
- name: ๐ Check docstring is first |
| 64 |
run: poetry run prek run check-docstring-first --all-files |
| 65 |
- name: ๐ Check that executables have shebangs |
| 66 |
run: poetry run prek run check-executables-have-shebangs --all-files |
| 67 |
- name: ๐ Check JSON files |
| 68 |
run: poetry run prek run check-json --all-files |
| 69 |
- name: ๐ Check for merge conflicts |
| 70 |
run: poetry run prek run check-merge-conflict --all-files |
| 71 |
- name: ๐ Check for broken symlinks |
| 72 |
run: poetry run prek run check-symlinks --all-files |
| 73 |
- name: ๐ Check TOML files |
| 74 |
run: poetry run prek run check-toml --all-files |
| 75 |
- name: ๐ Check XML files |
| 76 |
run: poetry run prek run check-xml --all-files |
| 77 |
- name: ๐ Check YAML files |
| 78 |
run: poetry run prek run check-yaml --all-files |
| 79 |
- name: ๐ Detect Private Keys |
| 80 |
run: poetry run prek run detect-private-key --all-files |
| 81 |
- name: ๐ Check End of Files |
| 82 |
run: poetry run prek run end-of-file-fixer --all-files |
| 83 |
- name: ๐ Trim Trailing Whitespace |
| 84 |
run: poetry run prek run trailing-whitespace --all-files |
| 85 |
|
| 86 |
yamllint: |
| 87 |
name: yamllint |
| 88 |
runs-on: ubuntu-latest |
| 89 |
steps: |
| 90 |
- name: โคต๏ธ Check out code from GitHub |
| 91 |
uses: actions/[email protected] |
| 92 |
- name: ๐ Set up Poetry |
| 93 |
run: pipx install poetry |
| 94 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 95 |
id: python |
| 96 |
uses: actions/[email protected] |
| 97 |
with: |
| 98 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 99 |
cache: "poetry" |
| 100 |
- name: ๐ Install workflow dependencies |
| 101 |
run: | |
| 102 |
poetry config virtualenvs.create true |
| 103 |
poetry config virtualenvs.in-project true |
| 104 |
- name: ๐ Install Python dependencies |
| 105 |
run: poetry install --no-interaction |
| 106 |
- name: ๐ Run yamllint |
| 107 |
run: poetry run yamllint . |