-
Notifications
You must be signed in to change notification settings - Fork 4
244 lines (232 loc) · 6.22 KB
/
Copy pathpr.yml
File metadata and controls
244 lines (232 loc) · 6.22 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: pr
on:
pull_request:
env:
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_TERM_COLOR: always
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
deps: ${{ steps.filter.outputs.deps }}
code: ${{ steps.filter.outputs.code }}
rust: ${{ steps.filter.outputs.rust }}
shell: ${{ steps.filter.outputs.shell }}
workflows: ${{ steps.filter.outputs.workflows }}
yml: ${{ steps.filter.outputs.yml }}
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
deps:
- "Cargo.toml"
- "Cargo.lock"
- "deny.toml"
- "mise.toml"
- "mise.lock"
- ".github/workflows/pr.yml"
code:
- ".sqlx/**"
- "migrations/**"
- "src/**"
- "tests/**"
- "**/*.rs"
- Cargo.*
- clippy.toml
- dist-workspace.toml
- rust-toolchain.toml
- mise.toml
- mise.lock
- ".github/actions/**/*.yml"
- ".github/workflows/pr.yml"
rust:
- "**/*.rs"
shell:
- "**.sh"
- "mise.toml"
- "mise.lock"
- ".github/workflows/pr.yml"
workflows:
- ".github/**/*.yml"
- "mise.toml"
- "mise.lock"
yml:
- "**.yml"
- "**.yaml"
- "mise.toml"
- "mise.lock"
lint:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
env:
SQLX_OFFLINE: true
steps:
- uses: actions/checkout@v6
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: rust
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Check formatting
run: mise run fmt:check
- name: Lint
run: mise run lint
build:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
env:
SQLX_OFFLINE: true
steps:
- uses: actions/checkout@v6
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: rust
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Build
run: mise run build
test:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
DATABASE_URL: sqlite://testdb/db.db
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: rust bmm-sqlx
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Check SQLx query metadata
run: mise run sqlx:prepare-check
- name: Run tests
env:
RUST_BACKTRACE: 0
run: mise run test
back-compat:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
env:
SQLX_OFFLINE: true
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- run: git checkout main
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: rust
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Build main
run: cargo build
- name: Save bookmarks with bmm on main
run: target/debug/bmm save https://github.com/dhth/bmm
- run: git checkout ${{ github.sha }}
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: rust
- name: Build head
run: cargo build
- name: Run bmm on head
run: target/debug/bmm list -f json
lint-sh:
needs: changes
if: ${{ needs.changes.outputs.shell == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: shellcheck
- name: Lint shell scripts
run: mise run lint:shell
lint-workflows:
needs: changes
if: ${{ needs.changes.outputs.workflows == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: actionlint
- name: Lint workflows
run: mise run lint:actions
lint-yaml:
needs: changes
if: ${{ needs.changes.outputs.yml == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: yamlfmt
- name: Lint YAML
run: mise run lint:yaml
dstlled-diff:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- id: get-dstlled-diff
uses: dhth/dstlled-diff-action@0ab616345f8816e9046fdefec81b14ada815aaca # v0.2.0
with:
pattern: '**.rs'
starting-commit: ${{ github.event.pull_request.base.sha }}
ending-commit: ${{ github.event.pull_request.head.sha }}
post-comment-on-pr: 'true'
audit:
needs: changes
if: ${{ needs.changes.outputs.deps == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up mise
uses: jdx/mise-action@v4
with:
install_args: rust aqua:EmbarkStudios/cargo-deny
- name: Check dependencies and licenses
run: mise run deny