-
Notifications
You must be signed in to change notification settings - Fork 0
221 lines (180 loc) · 5.37 KB
/
Copy pathci.yml
File metadata and controls
221 lines (180 loc) · 5.37 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Weekly audit on Mondays at 06:00 UTC
- cron: "0 6 * * 1"
env:
CARGO_TERM_COLOR: always
# The ubuntu-latest runner has clang-18 + libclang pre-installed;
# point bindgen at it so we can skip apt-get install libclang-dev.
LIBCLANG_PATH: /usr/lib/llvm-18/lib
jobs:
check:
name: Check (fmt, clippy, compile)
runs-on: ubuntu-latest
# Skip on scheduled runs (only audit/mutants need the weekly trigger)
if: github.event_name != 'schedule'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --check
- name: Run Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Check compilation
run: cargo check
test:
name: Test
runs-on: ubuntu-latest
needs: check
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-nextest
locked: true
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo nextest run
build:
name: Build (release)
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --release
- name: Upload release binary
uses: actions/upload-artifact@v6
with:
name: pg-migration-lint
path: target/release/pg-migration-lint
if-no-files-found: error
retention-days: 14
build-bridge:
name: Build Liquibase bridge JAR
runs-on: ubuntu-latest
# Skip on scheduled runs (only audit needs the weekly trigger)
if: github.event_name != 'schedule'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build fat JAR with Maven (via Docker)
run: |
docker run --rm \
-v "$PWD/bridge:/build" \
-w /build \
maven:3.9-eclipse-temurin-21 \
sh -c 'mvn package -q && cp target/liquibase-bridge-1.0.0.jar target/liquibase-bridge.jar'
- name: Upload bridge JAR
uses: actions/upload-artifact@v6
with:
name: liquibase-bridge
path: bridge/target/liquibase-bridge.jar
if-no-files-found: error
retention-days: 14
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: check
# Skip on scheduled runs
if: github.event_name != 'schedule'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-llvm-cov
locked: true
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-nextest
locked: true
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Generate coverage
run: cargo llvm-cov nextest --lcov --output-path lcov.info
- name: Upload coverage artifact
uses: actions/upload-artifact@v6
with:
name: coverage
path: lcov.info
retention-days: 14
mutants:
name: Mutation testing
runs-on: ubuntu-latest
# Only run on the weekly schedule
if: github.event_name == 'schedule'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-mutants
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-mutants
locked: true
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-nextest
locked: true
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Run mutation tests
run: cargo mutants --test-tool nextest --output mutants.out
- name: Upload mutants report
if: always()
uses: actions/upload-artifact@v6
with:
name: mutants-report
path: mutants.out/
retention-days: 30
deny:
name: Deny (licenses, advisories, duplicates)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: EmbarkStudios/cargo-deny-action@v2
audit:
name: Security audit
runs-on: ubuntu-latest
# Run on PRs, pushes to main, and the weekly schedule
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run audit
run: cargo audit