Skip to content

Commit 943f4d8

Browse files
abonanderjrasanen
authored andcommitted
Fix CI after Rust 1.80, remove dead feature references (launchbadge#3381)
* fix(ci): update workflows/examples.yml * Removed archived `actions-rs` actions * Upgraded `Swatinem/rust-cache`, `actions/checkout`, `actions/download-artifact`, `actions/upload-artifact` * chore: deprecate `AnyKind` * fix: remove dead references to DB features in `sqlx-core` This reactivates a couple of tests that had stopped working. * chore(ci): move sqlx-cli checks to their own workflow * fix(ci): remove remaining `uses: actions-rs/cargo` * fix warnings * chore: add titles to sqlx-cli jobs * fix warnings (2) * fix error in pool example * fix warnings (3) * fix query_builder test * fix: don't run CLI tests on Windows * chore: upgrade `rust-toolchain` to 1.80 * fix(postgres): fix missing Tokio specialization in `PgCopyIn` Caught by the new `unexpected_cfgs` lint. * fix new warnings
1 parent 2eb75f3 commit 943f4d8

File tree

22 files changed

+334
-352
lines changed

22 files changed

+334
-352
lines changed

.github/workflows/examples.yml

+28-88
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,24 @@ jobs:
1212
name: Build SQLx CLI
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616

17-
- uses: actions-rs/toolchain@v1
18-
with:
19-
profile: minimal
20-
toolchain: stable
21-
override: true
17+
- name: Use latest Rust
18+
run: rustup override set stable
2219

23-
- uses: Swatinem/rust-cache@v1
20+
- uses: Swatinem/rust-cache@v2
2421
with:
2522
key: sqlx-cli
2623

27-
- uses: actions-rs/cargo@v1
28-
with:
29-
command: build
30-
args: >
24+
- run: >
25+
cargo build
3126
-p sqlx-cli
3227
--bin sqlx
3328
--release
3429
--no-default-features
3530
--features mysql,postgres,sqlite
36-
env:
37-
RUSTFLAGS: -D warnings
3831
39-
- uses: actions/upload-artifact@v3
32+
- uses: actions/upload-artifact@v4
4033
with:
4134
name: sqlx-cli
4235
path: target/release/sqlx
@@ -56,7 +49,7 @@ jobs:
5649

5750
steps:
5851
- name: Get SQLx-CLI
59-
uses: actions/download-artifact@v3
52+
uses: actions/download-artifact@v4
6053
with:
6154
name: sqlx-cli
6255
# $HOME is interpreted differently by the shell
@@ -68,15 +61,9 @@ jobs:
6861
echo /home/runner/.local/bin >> $GITHUB_PATH
6962
sleep 10
7063
71-
- uses: actions/checkout@v2
72-
73-
- uses: actions-rs/toolchain@v1
74-
with:
75-
profile: minimal
76-
toolchain: stable
77-
override: true
64+
- uses: actions/checkout@v4
7865

79-
- uses: Swatinem/rust-cache@v1
66+
- uses: Swatinem/rust-cache@v2
8067
with:
8168
key: mysql-examples
8269

@@ -87,13 +74,9 @@ jobs:
8774
run: sqlx db setup
8875

8976
- name: Todos (Run)
90-
uses: actions-rs/cargo@v1
9177
env:
9278
DATABASE_URL: mysql://root:password@localhost:3306/todos?ssl-mode=disabled
93-
with:
94-
# TODO: test full CLI
95-
command: run
96-
args: -p sqlx-example-mysql-todos
79+
run: cargo run -p sqlx-example-mysql-todos
9780

9881
postgres:
9982
name: PostgreSQL Examples
@@ -110,7 +93,7 @@ jobs:
11093

11194
steps:
11295
- name: Get SQLx-CLI
113-
uses: actions/download-artifact@v3
96+
uses: actions/download-artifact@v4
11497
with:
11598
name: sqlx-cli
11699
path: /home/runner/.local/bin
@@ -121,15 +104,9 @@ jobs:
121104
echo $HOME/.local/bin >> $GITHUB_PATH
122105
sleep 10
123106
124-
- uses: actions/checkout@v2
125-
126-
- uses: actions-rs/toolchain@v1
127-
with:
128-
profile: minimal
129-
toolchain: stable
130-
override: true
107+
- uses: actions/checkout@v4
131108

132-
- uses: Swatinem/rust-cache@v1
109+
- uses: Swatinem/rust-cache@v2
133110
with:
134111
key: pg-examples
135112

@@ -140,28 +117,19 @@ jobs:
140117
run: sqlx db setup
141118

142119
- name: Axum Social with Tests (Check)
143-
uses: actions-rs/cargo@v1
144120
env:
145121
DATABASE_URL: postgres://postgres:password@localhost:5432/axum-social
146-
with:
147-
command: check
148-
args: -p sqlx-example-postgres-axum-social
122+
run: cargo check -p sqlx-example-postgres-axum-social
149123

150124
- name: Axum Social with Tests (Test)
151-
uses: actions-rs/cargo@v1
152125
env:
153126
DATABASE_URL: postgres://postgres:password@localhost:5432/axum-social
154-
with:
155-
command: test
156-
args: -p sqlx-example-postgres-axum-social
127+
run: cargo test -p sqlx-example-postgres-axum-social
157128

158129
# The Chat example has an interactive TUI which is not trivial to test automatically,
159130
# so we only check that it compiles.
160131
- name: Chat (Check)
161-
uses: actions-rs/cargo@v1
162-
with:
163-
command: check
164-
args: -p sqlx-example-postgres-chat
132+
run: cargo check -p sqlx-example-postgres-chat
165133

166134
- name: Files (Setup)
167135
working-directory: examples/postgres/files
@@ -170,12 +138,9 @@ jobs:
170138
run: sqlx db setup
171139

172140
- name: Files (Run)
173-
uses: actions-rs/cargo@v1
174141
env:
175142
DATABASE_URL: postgres://postgres:password@localhost:5432/files
176-
with:
177-
command: run
178-
args: -p sqlx-example-postgres-files
143+
run: cargo run -p sqlx-example-postgres-files
179144

180145
- name: JSON (Setup)
181146
working-directory: examples/postgres/json
@@ -184,12 +149,9 @@ jobs:
184149
run: sqlx db setup
185150

186151
- name: JSON (Run)
187-
uses: actions-rs/cargo@v1
188152
env:
189153
DATABASE_URL: postgres://postgres:password@localhost:5432/json
190-
with:
191-
command: run
192-
args: -p sqlx-example-postgres-json
154+
run: cargo run -p sqlx-example-postgres-json
193155

194156
- name: Listen (Setup)
195157
working-directory: examples/postgres/listen
@@ -198,12 +160,9 @@ jobs:
198160
run: sqlx db create
199161

200162
- name: Listen (Run)
201-
uses: actions-rs/cargo@v1
202163
env:
203164
DATABASE_URL: postgres://postgres:password@localhost:5432/listen
204-
with:
205-
command: run
206-
args: -p sqlx-example-postgres-listen
165+
run: cargo run -p sqlx-example-postgres-listen
207166

208167
- name: Mockable TODOs (Setup)
209168
working-directory: examples/postgres/mockable-todos
@@ -212,13 +171,9 @@ jobs:
212171
run: sqlx db setup
213172

214173
- name: Mockable TODOs (Run)
215-
uses: actions-rs/cargo@v1
216174
env:
217175
DATABASE_URL: postgres://postgres:password@localhost:5432/mockable-todos
218-
with:
219-
# TODO: test full CLI
220-
command: run
221-
args: -p sqlx-example-postgres-mockable-todos
176+
run: cargo run -p sqlx-example-postgres-mockable-todos
222177

223178
- name: TODOs (Setup)
224179
working-directory: examples/postgres/todos
@@ -227,13 +182,10 @@ jobs:
227182
run: sqlx db setup
228183

229184
- name: TODOs (Run)
230-
uses: actions-rs/cargo@v1
231185
env:
232186
DATABASE_URL: postgres://postgres:password@localhost:5432/todos
233-
with:
234-
# TODO: test full CLI
235-
command: run
236-
args: -p sqlx-example-postgres-todos
187+
# TODO: test full CLI
188+
run: cargo run -p sqlx-example-postgres-todos
237189

238190
- name: Transaction (Setup)
239191
working-directory: examples/postgres/transaction
@@ -242,12 +194,9 @@ jobs:
242194
run: sqlx db setup
243195

244196
- name: Transaction (Run)
245-
uses: actions-rs/cargo@v1
246197
env:
247198
DATABASE_URL: postgres://postgres:password@localhost:5432/txn
248-
with:
249-
command: run
250-
args: -p sqlx-example-postgres-transaction
199+
run: cargo run -p sqlx-example-postgres-transaction
251200

252201
sqlite:
253202
name: SQLite Examples
@@ -256,7 +205,7 @@ jobs:
256205

257206
steps:
258207
- name: Get SQLx-CLI
259-
uses: actions/download-artifact@v3
208+
uses: actions/download-artifact@v4
260209
with:
261210
name: sqlx-cli
262211
path: /home/runner/.local/bin
@@ -266,15 +215,9 @@ jobs:
266215
chmod +x /home/runner/.local/bin/sqlx
267216
echo /home/runner/.local/bin >> $GITHUB_PATH
268217
269-
- uses: actions/checkout@v2
218+
- uses: actions/checkout@v4
270219

271-
- uses: actions-rs/toolchain@v1
272-
with:
273-
profile: minimal
274-
toolchain: stable
275-
override: true
276-
277-
- uses: Swatinem/rust-cache@v1
220+
- uses: Swatinem/rust-cache@v2
278221
with:
279222
key: sqlite-examples
280223

@@ -284,9 +227,6 @@ jobs:
284227
run: sqlx db setup --source=examples/sqlite/todos/migrations
285228

286229
- name: TODOs (Run)
287-
uses: actions-rs/cargo@v1
288230
env:
289231
DATABASE_URL: sqlite://todos.sqlite
290-
with:
291-
command: run
292-
args: -p sqlx-example-sqlite-todos
232+
run: cargo run -p sqlx-example-sqlite-todos

.github/workflows/sqlx-cli.yml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: SQLx CLI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- "*-dev"
9+
10+
jobs:
11+
check:
12+
name: Check
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- run: |
19+
rustup update
20+
rustup component add clippy
21+
rustup toolchain install beta
22+
rustup component add --toolchain beta clippy
23+
24+
- uses: Swatinem/rust-cache@v2
25+
26+
- run: cargo clippy --manifest-path sqlx-cli/Cargo.toml -- -D warnings
27+
28+
# Run beta for new warnings but don't break the build.
29+
# Use a subdirectory of `target` to avoid clobbering the cache.
30+
- run: >
31+
cargo +beta clippy
32+
--manifest-path sqlx-cli/Cargo.toml
33+
--target-dir target/beta/
34+
35+
test:
36+
name: Test
37+
runs-on: ${{ matrix.os }}
38+
39+
strategy:
40+
matrix:
41+
# Note: macOS-latest uses M1 Silicon (ARM64)
42+
os:
43+
- ubuntu-latest
44+
# FIXME: migrations tests fail on Windows for whatever reason
45+
# - windows-latest
46+
- macOS-13
47+
- macOS-latest
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- uses: Swatinem/rust-cache@v2
53+
with:
54+
key: ${{ runner.os }}-test
55+
56+
- run: cargo test --manifest-path sqlx-cli/Cargo.toml
57+
58+
build:
59+
name: Build
60+
runs-on: ${{ matrix.os }}
61+
62+
strategy:
63+
matrix:
64+
# Note: macOS-latest uses M1 Silicon (ARM64)
65+
os:
66+
- ubuntu-latest
67+
- windows-latest
68+
- macOS-13
69+
- macOS-latest
70+
include:
71+
- os: ubuntu-latest
72+
target: x86_64-unknown-linux-musl
73+
args: --features openssl-vendored
74+
bin: target/debug/cargo-sqlx
75+
- os: windows-latest
76+
target: x86_64-pc-windows-msvc
77+
bin: target/debug/cargo-sqlx.exe
78+
- os: macOS-13
79+
target: x86_64-apple-darwin
80+
bin: target/debug/cargo-sqlx
81+
- os: macOS-latest
82+
target: aarch64-apple-darwin
83+
bin: target/debug/cargo-sqlx
84+
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
- name: Use latest Rust
89+
run: rustup override set stable
90+
91+
- uses: Swatinem/rust-cache@v2
92+
with:
93+
key: ${{ runner.os }}-cli
94+
95+
- run: cargo build --manifest-path sqlx-cli/Cargo.toml --bin cargo-sqlx ${{ matrix.args }}
96+
97+
- uses: actions/upload-artifact@v4
98+
with:
99+
name: cargo-sqlx-${{ matrix.target }}
100+
path: ${{ matrix.bin }}

0 commit comments

Comments
 (0)