Skip to content

Commit 886740e

Browse files
committed
refactor: streamline clippy checks in CI workflow
- Removed clippy job and integrated checks into existing jobs for core, root, and all targets. - Added clippy checks for sqlite, postgres, mysql, mariadb, and mssql with specific features. - Enhanced CI workflow efficiency by consolidating clippy steps.
1 parent ef3c39b commit 886740e

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

.github/workflows/sqlx.yml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,6 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- run: cargo fmt --all -- --check
1616

17-
clippy:
18-
name: Clippy
19-
runs-on: ubuntu-22.04
20-
strategy:
21-
matrix:
22-
runtime: [async-std, tokio]
23-
tls: [native-tls, rustls]
24-
steps:
25-
- uses: actions/checkout@v4
26-
- uses: Swatinem/rust-cache@v2
27-
- name: Run clippy for core with all features
28-
run: |
29-
cargo clippy --manifest-path sqlx-core/Cargo.toml \
30-
--no-default-features \
31-
--features offline,all-databases,all-types,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }} \
32-
-- -D warnings
33-
env:
34-
RUSTFLAGS: -D warnings
35-
- name: Run clippy for root with all features
36-
run: |
37-
cargo clippy \
38-
--no-default-features \
39-
--features offline,all-databases,all-types,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros \
40-
-- -D warnings
41-
env:
42-
RUSTFLAGS: -D warnings
43-
- name: Run clippy for all targets
44-
run: |
45-
cargo clippy \
46-
--no-default-features \
47-
--all-targets \
48-
--features offline,all-databases,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }} \
49-
-- -D warnings
50-
env:
51-
RUSTFLAGS: -D warnings
5217

5318
check:
5419
name: Check
@@ -76,6 +41,25 @@ jobs:
7641
--no-default-features
7742
--lib --tests
7843
--features offline,all-databases,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
44+
- name: Run clippy for core with all features
45+
run: |
46+
cargo clippy --manifest-path sqlx-core/Cargo.toml \
47+
--no-default-features \
48+
--features offline,all-databases,all-types,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }} \
49+
-- -D warnings
50+
- name: Run clippy for root with all features
51+
run: |
52+
cargo clippy \
53+
--no-default-features \
54+
--features offline,all-databases,all-types,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros \
55+
-- -D warnings
56+
- name: Run clippy for all targets
57+
run: |
58+
cargo clippy \
59+
--no-default-features \
60+
--all-targets \
61+
--features offline,all-databases,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }} \
62+
-- -D warnings
7963
8064
test:
8165
name: Unit Test
@@ -134,26 +118,6 @@ jobs:
134118
name: cargo-sqlx-${{ matrix.target }}
135119
path: ${{ matrix.bin }}
136120

137-
clippy-per-db:
138-
name: Clippy per Database
139-
runs-on: ubuntu-22.04
140-
strategy:
141-
matrix:
142-
db: [postgres, mysql, sqlite, mssql]
143-
runtime: [tokio]
144-
tls: [rustls]
145-
needs: clippy
146-
steps:
147-
- uses: actions/checkout@v4
148-
- uses: Swatinem/rust-cache@v2
149-
- name: Run clippy for ${{ matrix.db }}
150-
run: |
151-
cargo clippy \
152-
--no-default-features \
153-
--features ${{ matrix.db }},all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros,migrate \
154-
-- -D warnings
155-
env:
156-
RUSTFLAGS: -D warnings
157121

158122
sqlite:
159123
name: SQLite
@@ -167,6 +131,12 @@ jobs:
167131
- uses: actions/checkout@v4
168132
- run: mkdir /tmp/sqlite3-lib && wget -O /tmp/sqlite3-lib/ipaddr.so https://github.com/nalgeon/sqlean/releases/download/0.15.2/ipaddr.so
169133
- uses: Swatinem/rust-cache@v2
134+
- name: Run clippy for sqlite
135+
run: |
136+
cargo clippy \
137+
--no-default-features \
138+
--features sqlite,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros,migrate \
139+
-- -D warnings
170140
- run:
171141
cargo test
172142
--no-default-features
@@ -210,6 +180,15 @@ jobs:
210180
args: >
211181
--features postgres,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
212182
183+
- name: Run clippy for postgres
184+
run: |
185+
cargo clippy \
186+
--no-default-features \
187+
--features postgres,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros,migrate \
188+
-- -D warnings
189+
env:
190+
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
191+
213192
- run: |
214193
docker compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_${{ matrix.postgres }} postgres_${{ matrix.postgres }}
215194
docker exec postgres_${{ matrix.postgres }} bash -c "until pg_isready; do sleep 1; done"
@@ -281,6 +260,13 @@ jobs:
281260
args: >
282261
--features mysql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
283262
263+
- name: Run clippy for mysql
264+
run: |
265+
cargo clippy \
266+
--no-default-features \
267+
--features mysql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros,migrate \
268+
-- -D warnings
269+
284270
- run: docker compose -f tests/docker-compose.yml run -d -p 3306:3306 mysql_${{ matrix.mysql }}
285271
- run: sleep 60
286272

@@ -332,6 +318,13 @@ jobs:
332318
args: >
333319
--features mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
334320
321+
- name: Run clippy for mariadb
322+
run: |
323+
cargo clippy \
324+
--no-default-features \
325+
--features mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros,migrate \
326+
-- -D warnings
327+
335328
- run: docker compose -f tests/docker-compose.yml run -d -p 3306:3306 mariadb_${{ matrix.mariadb }}
336329
- run: sleep 30
337330

@@ -372,6 +365,13 @@ jobs:
372365
args: >
373366
--features mssql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
374367
368+
- name: Run clippy for mssql
369+
run: |
370+
cargo clippy \
371+
--no-default-features \
372+
--features mssql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros,migrate \
373+
-- -D warnings
374+
375375
- run: docker compose -f tests/docker-compose.yml run -d -p 1433:1433 mssql_${{ matrix.mssql }}
376376
- run: sleep 80 # MSSQL takes a "bit" to startup
377377

0 commit comments

Comments
 (0)