-
-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (129 loc) · 4.06 KB
/
pre-commit.yml
File metadata and controls
136 lines (129 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: pre-commit
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions: {}
jobs:
all-files:
# also lints python files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v6
id: python-setup
with:
python-version: 3.x
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
with:
enable-cache: true
- name: Cache pre-commit environments
uses: actions/cache@v5
with:
path: '~/.cache/pre-commit'
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
- run: uvx pre-commit run --show-diff-on-failure --color=always --all-files
lint-rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Rust
run: rustup update --no-self-update
- name: Cache deps
uses: actions/cache@v5
with:
path: |-
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-lint-${{ hashFiles('**/*.rs') }}
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@80aaafe04903087c333980fa2686259ddd34b2d9 # v1.16.6
- name: Install nur
run: cargo binstall -y nur
env:
GITHUB_TOKEN: ${{ github.token }}
- run: nur lint --check
- run: nur lint examples --check
lint-typescript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
cache: yarn
- run: rustup update --no-self-update
- name: Install libgpiod
run: sudo apt-get install -y libgpiod-dev
- run: yarn install
- name: Build binding (debug)
run: yarn build:debug
- name: Lint examples
run: yarn lint
- name: Format examples
run: yarn format:examples
- name: Compile examples
run: yarn build:examples
check-pr-title:
name: Check PR title
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
# permissions needed to read PR title dynamically using gh-cli
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Get PR title
id: get-title
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |-
pr_title=$(gh pr view "${PR_NUMBER}" --repo "${GH_REPO}" --json "title" -q ".title")
echo "title=${pr_title}" >> "${GITHUB_OUTPUT}"
- run: rustup update --no-self-update
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@80aaafe04903087c333980fa2686259ddd34b2d9 # v1.16.6
- name: Install committed
run: cargo binstall -y committed
env:
GITHUB_TOKEN: ${{ github.token }}
- name: conventional-commit
env:
PR_TITLE: "${{ steps.get-title.outputs.title }}"
run: echo "${PR_TITLE}" | committed --config .config/committed.toml --commit-file -
- uses: actions/setup-node@v6
with:
node-version: latest
- name: spell check
env:
PR_TITLE: "${{ steps.get-title.outputs.title }}"
run: echo "${PR_TITLE}" | npx cspell-cli lint stdin
lint-ci-workflows:
name: Lint CI Workflows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup node
uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Lint GitHub Workflows
env:
GH_TOKEN: ${{ github.token }}
run: pipx run zizmor --format github .github/workflows/