Skip to content

Commit e0afd35

Browse files
committed
ci: lock PR dependencies and check upstream compatibility weekly
1 parent 394c059 commit e0afd35

3 files changed

Lines changed: 91 additions & 24 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Upstream compatibility
2+
3+
on:
4+
schedule:
5+
- cron: "23 6 * * 1"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
# Override rust-toolchain.toml for this workflow only.
13+
RUSTUP_TOOLCHAIN: stable
14+
15+
jobs:
16+
compatibility:
17+
name: Latest stable and dependencies (${{ matrix.tls }})
18+
runs-on: ubuntu-24.04
19+
timeout-minutes: 30
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
tls: [native-tls, rustls]
24+
steps:
25+
- uses: actions/checkout@v6
26+
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
27+
with:
28+
toolchain: stable
29+
components: clippy
30+
- run: sudo apt-get update && sudo apt-get install -y libodbc2 unixodbc-dev
31+
- name: Resolve latest compatible dependencies
32+
run: cargo update
33+
- name: Check core with latest dependencies
34+
run: >-
35+
cargo clippy --locked --manifest-path sqlx-core/Cargo.toml --no-default-features
36+
--features offline,all-databases,all-types,migrate,${{ matrix.tls }}
37+
-- -D warnings
38+
- name: Check macros with latest dependencies
39+
run: >-
40+
cargo clippy --locked --no-default-features
41+
--features offline,all-databases,all-types,migrate,macros,${{ matrix.tls }}
42+
-- -D warnings
43+
- name: Check all targets with latest dependencies
44+
run: >-
45+
cargo clippy --locked --no-default-features --all-targets
46+
--features offline,all-databases,all-types,${{ matrix.tls }}
47+
-- -D warnings
48+
- name: Run core unit tests
49+
run: >-
50+
cargo test --locked --manifest-path sqlx-core/Cargo.toml
51+
--features offline,all-databases,all-types,${{ matrix.tls }}
52+
- name: Run SQLite type tests
53+
run: >-
54+
cargo test --locked --no-default-features
55+
--features sqlite,all-types,macros,${{ matrix.tls }} --test sqlite-types
56+
env:
57+
DATABASE_URL: "sqlite::memory:"

‎.github/workflows/sqlx.yml‎

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ jobs:
3232
save-if: ${{ false }}
3333
- name: Run clippy for core with all features
3434
run: |
35-
cargo clippy --manifest-path sqlx-core/Cargo.toml \
35+
cargo clippy --locked --manifest-path sqlx-core/Cargo.toml \
3636
--no-default-features \
3737
--features offline,all-databases,all-types,migrate,${{ matrix.tls }} \
3838
-- -D warnings
3939
- name: Run clippy for root with all features
4040
run: |
41-
cargo clippy \
41+
cargo clippy --locked \
4242
--no-default-features \
4343
--features offline,all-databases,all-types,migrate,${{ matrix.tls }},macros \
4444
-- -D warnings
4545
- name: Run clippy for all targets
4646
run: |
47-
cargo clippy \
47+
cargo clippy --locked \
4848
--no-default-features \
4949
--all-targets \
5050
--features offline,all-databases,all-types,migrate,${{ matrix.tls }} \
@@ -64,7 +64,7 @@ jobs:
6464
save-if: ${{ false }}
6565
- run: sudo apt-get update && sudo apt-get install -y libodbc2 unixodbc-dev
6666
if: ${{ matrix.os == 'ubuntu-latest' }}
67-
- run: cargo test
67+
- run: cargo test --locked
6868
--manifest-path sqlx-core/Cargo.toml
6969
--features offline,all-databases,all-types,rustls
7070

@@ -94,7 +94,7 @@ jobs:
9494
with:
9595
prefix-key: v1-sqlx
9696
save-if: ${{ github.ref == 'refs/heads/main' }}
97-
- run: cargo build
97+
- run: cargo build --locked
9898
--manifest-path sqlx-cli/Cargo.toml
9999
--bin cargo-sqlx
100100
${{ matrix.args }}
@@ -121,11 +121,11 @@ jobs:
121121
save-if: ${{ github.ref == 'refs/heads/main' && matrix.tls == 'native-tls' }}
122122
- name: Run clippy for sqlite
123123
run: |
124-
cargo clippy \
124+
cargo clippy --locked \
125125
--no-default-features \
126126
--features sqlite,all-types,${{ matrix.tls }},macros,migrate \
127127
-- -D warnings
128-
- run: cargo test
128+
- run: cargo test --locked
129129
--no-default-features
130130
--features any,macros,migrate,sqlite,all-types,${{ matrix.tls }}
131131
env:
@@ -151,15 +151,15 @@ jobs:
151151
save-if: ${{ github.ref == 'refs/heads/main' && matrix.postgres == '14' }}
152152

153153
- run: |
154-
cargo build --features postgres,all-types,${{ matrix.tls }}
154+
cargo build --locked --features postgres,all-types,${{ matrix.tls }}
155155
env:
156156
# FIXME: needed to disable `ltree` tests in Postgres 9.6
157157
# but `PgLTree` should just fall back to text format
158158
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
159159
160160
- name: Run clippy for postgres
161161
run: |
162-
cargo clippy \
162+
cargo clippy --locked \
163163
--no-default-features \
164164
--features postgres,all-types,${{ matrix.tls }},macros,migrate \
165165
-- -D warnings
@@ -171,15 +171,15 @@ jobs:
171171
docker exec postgres_${{ matrix.postgres }} bash -c "until pg_isready; do sleep 1; done"
172172
173173
- run: |
174-
cargo test --no-default-features --features any,postgres,macros,all-types,${{ matrix.tls }}
174+
cargo test --locked --no-default-features --features any,postgres,macros,all-types,${{ matrix.tls }}
175175
env:
176176
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx
177177
# FIXME: needed to disable `ltree` tests in Postgres 9.6
178178
# but `PgLTree` should just fall back to text format
179179
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
180180
181181
- run: |
182-
cargo test --no-default-features --features any,postgres,macros,migrate,all-types,${{ matrix.tls }}
182+
cargo test --locked --no-default-features --features any,postgres,macros,migrate,all-types,${{ matrix.tls }}
183183
env:
184184
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=./tests/certs/ca.crt
185185
# FIXME: needed to disable `ltree` tests in Postgres 9.6
@@ -199,7 +199,7 @@ jobs:
199199
save-if: ${{ false }}
200200
- run: docker compose up --wait postgres_16
201201
working-directory: tests
202-
- run: cargo test --no-default-features --features any,postgres,macros,all-types,rustls
202+
- run: cargo test --locked --no-default-features --features any,postgres,macros,all-types,rustls
203203
env:
204204
DATABASE_URL: postgres://postgres@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=./tests/certs/ca.crt&sslcert=./tests/certs/client.crt&sslkey=./tests/keys/client.key
205205

@@ -221,11 +221,11 @@ jobs:
221221
save-if: ${{ github.ref == 'refs/heads/main' && matrix.mysql == '8' }}
222222

223223
- run: |
224-
cargo build --features mysql,all-types,${{ matrix.tls }}
224+
cargo build --locked --features mysql,all-types,${{ matrix.tls }}
225225
226226
- name: Run clippy for mysql
227227
run: |
228-
cargo clippy \
228+
cargo clippy --locked \
229229
--no-default-features \
230230
--features mysql,all-types,${{ matrix.tls }},macros,migrate \
231231
-- -D warnings
@@ -234,13 +234,13 @@ jobs:
234234
- run: sleep 60
235235

236236
- run: |
237-
cargo test --no-default-features --features any,mysql,macros,migrate,all-types,${{ matrix.tls }}
237+
cargo test --locked --no-default-features --features any,mysql,macros,migrate,all-types,${{ matrix.tls }}
238238
env:
239239
DATABASE_URL: mysql://root:password@localhost:3306/sqlx?ssl-mode=disabled
240240
241241
# MySQL 5.7 supports TLS but not TLSv1.3 as required by RusTLS.
242242
- run: |
243-
cargo test --no-default-features --features any,mysql,macros,migrate,all-types,${{ matrix.tls }}
243+
cargo test --locked --no-default-features --features any,mysql,macros,migrate,all-types,${{ matrix.tls }}
244244
if: ${{ !(matrix.mysql == '5_7' && matrix.tls == 'rustls') }}
245245
env:
246246
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
@@ -263,11 +263,11 @@ jobs:
263263
save-if: ${{ github.ref == 'refs/heads/main' && matrix.mariadb == '10_6' }}
264264

265265
- run: |
266-
cargo build --features mysql,${{ matrix.tls }}
266+
cargo build --locked --features mysql,${{ matrix.tls }}
267267
268268
- name: Run clippy for mariadb
269269
run: |
270-
cargo clippy \
270+
cargo clippy --locked \
271271
--no-default-features \
272272
--features mysql,${{ matrix.tls }},macros,migrate \
273273
-- -D warnings
@@ -276,7 +276,7 @@ jobs:
276276
- run: sleep 30
277277

278278
- run: |
279-
cargo test --no-default-features --features any,mysql,macros,migrate,${{ matrix.tls }}
279+
cargo test --locked --no-default-features --features any,mysql,macros,migrate,${{ matrix.tls }}
280280
env:
281281
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
282282
@@ -298,11 +298,11 @@ jobs:
298298
save-if: ${{ github.ref == 'refs/heads/main' && matrix.mssql == '2022' }}
299299

300300
- run: |
301-
cargo build --features mssql,all-types,${{ matrix.tls }}
301+
cargo build --locked --features mssql,all-types,${{ matrix.tls }}
302302
303303
- name: Run clippy for mssql
304304
run: |
305-
cargo clippy \
305+
cargo clippy --locked \
306306
--no-default-features \
307307
--features mssql,all-types,${{ matrix.tls }},macros,migrate \
308308
-- -D warnings
@@ -311,7 +311,7 @@ jobs:
311311
- run: sleep 80 # MSSQL takes a "bit" to startup
312312

313313
- run: |
314-
cargo test --no-default-features --features any,mssql,macros,migrate,all-types,${{ matrix.tls }}
314+
cargo test --locked --no-default-features --features any,mssql,macros,migrate,all-types,${{ matrix.tls }}
315315
env:
316316
DATABASE_URL: mssql://sa:Password123!@localhost/sqlx
317317
@@ -342,10 +342,10 @@ jobs:
342342
odbcinst -q -s || true
343343
echo "select 1;" | isql -v SQLX_PG_5432 || true
344344
- name: Run ODBC tests (PostgreSQL DSN)
345-
run: cargo test --no-default-features --features any,odbc,macros,all-types,rustls
345+
run: cargo test --locked --no-default-features --features any,odbc,macros,all-types,rustls
346346
env:
347347
DATABASE_URL: DSN=SQLX_PG_5432;UID=postgres;PWD=password
348348
- name: Run ODBC tests (SQLite driver)
349-
run: cargo test --no-default-features --features any,odbc,macros,all-types,rustls
349+
run: cargo test --locked --no-default-features --features any,odbc,macros,all-types,rustls
350350
env:
351351
DATABASE_URL: Driver={SQLite3};Database=./tests/odbc/sqlite.db

‎CONTRIBUTING.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ You can use this document to figure out how and where to start.
2626
- Push your changes to a topic branch in your fork of the repository.
2727
- Submit a pull request to the original repository.
2828

29+
## Dependency updates
30+
31+
PR CI uses the committed `Cargo.lock` with `--locked`. When changing dependencies,
32+
update and commit the lockfile in the same PR. Keep unrelated dependency upgrades
33+
in dedicated PRs.
34+
35+
The separate **Upstream compatibility** workflow runs weekly and can also be
36+
started manually. It tests the latest stable Rust and a freshly updated lockfile
37+
without changing the committed baseline or adding checks to unrelated PRs.
38+
2939
## What to work on
3040

3141
We try to mark issues with a suggested level of experience (in Rust/SQL/SQLx).

0 commit comments

Comments
 (0)