Skip to content

Commit 5167a14

Browse files
authored
Update Outdated GitHub Actions workflows (#33)
* Refactor GitHub Actions workflow for Rust replace actions-rs/cargo with direct cargo commands for build and test steps, and update toolchain action to dtolnay/rust-toolchain. * removing redundant cargo check clippy is a superset of check
1 parent 98ad187 commit 5167a14

File tree

1 file changed

+24
-92
lines changed

1 file changed

+24
-92
lines changed

.github/workflows/sqlx.yml

Lines changed: 24 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727
- uses: Swatinem/rust-cache@v2
28-
- run:
29-
cargo check
30-
--manifest-path sqlx-core/Cargo.toml
31-
--no-default-features
32-
--features offline,all-databases,all-types,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
33-
env:
34-
RUSTFLAGS: -D warnings
35-
- run:
36-
cargo check
37-
--no-default-features
38-
--features offline,all-databases,all-types,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros
39-
- run:
40-
cargo check
41-
--no-default-features
42-
--lib --tests
43-
--features offline,all-databases,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
4428
- name: Run clippy for core with all features
4529
run: |
4630
cargo clippy --manifest-path sqlx-core/Cargo.toml \
@@ -160,25 +144,18 @@ jobs:
160144
steps:
161145
- uses: actions/checkout@v4
162146

163-
- uses: actions-rs/toolchain@v1
164-
with:
165-
profile: minimal
166-
toolchain: stable
167-
override: true
147+
- uses: dtolnay/rust-toolchain@stable
168148

169149
- uses: Swatinem/rust-cache@v2
170150
with:
171151
key: ${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }}
172152

173-
- uses: actions-rs/cargo@v1
153+
- run: |
154+
cargo build --features postgres,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
174155
env:
175156
# FIXME: needed to disable `ltree` tests in Postgres 9.6
176157
# but `PgLTree` should just fall back to text format
177158
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
178-
with:
179-
command: build
180-
args: >
181-
--features postgres,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
182159
183160
- name: Run clippy for postgres
184161
run: |
@@ -193,24 +170,16 @@ jobs:
193170
docker compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_${{ matrix.postgres }} postgres_${{ matrix.postgres }}
194171
docker exec postgres_${{ matrix.postgres }} bash -c "until pg_isready; do sleep 1; done"
195172
196-
- uses: actions-rs/cargo@v1
197-
with:
198-
command: test
199-
args: >
200-
--no-default-features
201-
--features any,postgres,macros,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
173+
- run: |
174+
cargo test --no-default-features --features any,postgres,macros,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
202175
env:
203176
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx
204177
# FIXME: needed to disable `ltree` tests in Postgres 9.6
205178
# but `PgLTree` should just fall back to text format
206179
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
207180
208-
- uses: actions-rs/cargo@v1
209-
with:
210-
command: test
211-
args: >
212-
--no-default-features
213-
--features any,postgres,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
181+
- run: |
182+
cargo test --no-default-features --features any,postgres,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
214183
env:
215184
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=./tests/certs/ca.crt
216185
# FIXME: needed to disable `ltree` tests in Postgres 9.6
@@ -244,21 +213,14 @@ jobs:
244213
steps:
245214
- uses: actions/checkout@v4
246215

247-
- uses: actions-rs/toolchain@v1
248-
with:
249-
profile: minimal
250-
toolchain: stable
251-
override: true
216+
- uses: dtolnay/rust-toolchain@stable
252217

253218
- uses: Swatinem/rust-cache@v2
254219
with:
255220
key: ${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}
256221

257-
- uses: actions-rs/cargo@v1
258-
with:
259-
command: build
260-
args: >
261-
--features mysql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
222+
- run: |
223+
cargo build --features mysql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
262224
263225
- name: Run clippy for mysql
264226
run: |
@@ -270,23 +232,15 @@ jobs:
270232
- run: docker compose -f tests/docker-compose.yml run -d -p 3306:3306 mysql_${{ matrix.mysql }}
271233
- run: sleep 60
272234

273-
- uses: actions-rs/cargo@v1
274-
with:
275-
command: test
276-
args: >
277-
--no-default-features
278-
--features any,mysql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
235+
- run: |
236+
cargo test --no-default-features --features any,mysql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
279237
env:
280238
DATABASE_URL: mysql://root:password@localhost:3306/sqlx?ssl-mode=disabled
281239
282240
# MySQL 5.7 supports TLS but not TLSv1.3 as required by RusTLS.
283-
- uses: actions-rs/cargo@v1
241+
- run: |
242+
cargo test --no-default-features --features any,mysql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
284243
if: ${{ !(matrix.mysql == '5_7' && matrix.tls == 'rustls') }}
285-
with:
286-
command: test
287-
args: >
288-
--no-default-features
289-
--features any,mysql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
290244
env:
291245
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
292246
@@ -302,21 +256,14 @@ jobs:
302256
steps:
303257
- uses: actions/checkout@v4
304258

305-
- uses: actions-rs/toolchain@v1
306-
with:
307-
profile: minimal
308-
toolchain: stable
309-
override: true
259+
- uses: dtolnay/rust-toolchain@stable
310260

311261
- uses: Swatinem/rust-cache@v2
312262
with:
313263
key: ${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}
314264

315-
- uses: actions-rs/cargo@v1
316-
with:
317-
command: build
318-
args: >
319-
--features mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
265+
- run: |
266+
cargo build --features mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
320267
321268
- name: Run clippy for mariadb
322269
run: |
@@ -328,12 +275,8 @@ jobs:
328275
- run: docker compose -f tests/docker-compose.yml run -d -p 3306:3306 mariadb_${{ matrix.mariadb }}
329276
- run: sleep 30
330277

331-
- uses: actions-rs/cargo@v1
332-
with:
333-
command: test
334-
args: >
335-
--no-default-features
336-
--features any,mysql,macros,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
278+
- run: |
279+
cargo test --no-default-features --features any,mysql,macros,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
337280
env:
338281
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
339282
@@ -349,21 +292,14 @@ jobs:
349292
steps:
350293
- uses: actions/checkout@v4
351294

352-
- uses: actions-rs/toolchain@v1
353-
with:
354-
profile: minimal
355-
toolchain: stable
356-
override: true
295+
- uses: dtolnay/rust-toolchain@stable
357296

358297
- uses: Swatinem/rust-cache@v2
359298
with:
360299
key: ${{ runner.os }}-mssql-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
361300

362-
- uses: actions-rs/cargo@v1
363-
with:
364-
command: build
365-
args: >
366-
--features mssql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
301+
- run: |
302+
cargo build --features mssql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
367303
368304
- name: Run clippy for mssql
369305
run: |
@@ -375,11 +311,7 @@ jobs:
375311
- run: docker compose -f tests/docker-compose.yml run -d -p 1433:1433 mssql_${{ matrix.mssql }}
376312
- run: sleep 80 # MSSQL takes a "bit" to startup
377313

378-
- uses: actions-rs/cargo@v1
379-
with:
380-
command: test
381-
args: >
382-
--no-default-features
383-
--features any,mssql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
314+
- run: |
315+
cargo test --no-default-features --features any,mssql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
384316
env:
385317
DATABASE_URL: mssql://sa:Password123!@localhost/sqlx

0 commit comments

Comments
 (0)