Skip to content

Commit dc1021f

Browse files
authored
ci: lock PR dependencies and check upstream compatibility weekly (#64)
1 parent 539faed commit dc1021f

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
@@ -34,19 +34,19 @@ jobs:
3434
save-if: ${{ false }}
3535
- name: Run clippy for core with all features
3636
run: |
37-
cargo clippy --manifest-path sqlx-core/Cargo.toml \
37+
cargo clippy --locked --manifest-path sqlx-core/Cargo.toml \
3838
--no-default-features \
3939
--features offline,all-databases,all-types,migrate,${{ matrix.tls }} \
4040
-- -D warnings
4141
- name: Run clippy for root with all features
4242
run: |
43-
cargo clippy \
43+
cargo clippy --locked \
4444
--no-default-features \
4545
--features offline,all-databases,all-types,migrate,${{ matrix.tls }},macros \
4646
-- -D warnings
4747
- name: Run clippy for all targets
4848
run: |
49-
cargo clippy \
49+
cargo clippy --locked \
5050
--no-default-features \
5151
--all-targets \
5252
--features offline,all-databases,all-types,migrate,${{ matrix.tls }} \
@@ -66,7 +66,7 @@ jobs:
6666
save-if: ${{ false }}
6767
- run: sudo apt-get update && sudo apt-get install -y libodbc2 unixodbc-dev
6868
if: ${{ matrix.os == 'ubuntu-latest' }}
69-
- run: cargo test
69+
- run: cargo test --locked
7070
--manifest-path sqlx-core/Cargo.toml
7171
--features offline,all-databases,all-types,rustls
7272

@@ -96,7 +96,7 @@ jobs:
9696
with:
9797
prefix-key: v1-sqlx
9898
save-if: ${{ github.ref == 'refs/heads/main' }}
99-
- run: cargo build
99+
- run: cargo build --locked
100100
--manifest-path sqlx-cli/Cargo.toml
101101
--bin cargo-sqlx
102102
${{ matrix.args }}
@@ -123,11 +123,11 @@ jobs:
123123
save-if: ${{ github.ref == 'refs/heads/main' && matrix.tls == 'native-tls' }}
124124
- name: Run clippy for sqlite
125125
run: |
126-
cargo clippy \
126+
cargo clippy --locked \
127127
--no-default-features \
128128
--features sqlite,all-types,${{ matrix.tls }},macros,migrate \
129129
-- -D warnings
130-
- run: cargo test
130+
- run: cargo test --locked
131131
--no-default-features
132132
--features any,macros,migrate,sqlite,all-types,${{ matrix.tls }}
133133
env:
@@ -153,15 +153,15 @@ jobs:
153153
save-if: ${{ github.ref == 'refs/heads/main' && matrix.postgres == '14' }}
154154

155155
- run: |
156-
cargo build --features postgres,all-types,${{ matrix.tls }}
156+
cargo build --locked --features postgres,all-types,${{ matrix.tls }}
157157
env:
158158
# FIXME: needed to disable `ltree` tests in Postgres 9.6
159159
# but `PgLTree` should just fall back to text format
160160
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
161161
162162
- name: Run clippy for postgres
163163
run: |
164-
cargo clippy \
164+
cargo clippy --locked \
165165
--no-default-features \
166166
--features postgres,all-types,${{ matrix.tls }},macros,migrate \
167167
-- -D warnings
@@ -173,15 +173,15 @@ jobs:
173173
docker exec postgres_${{ matrix.postgres }} bash -c "until pg_isready; do sleep 1; done"
174174
175175
- run: |
176-
cargo test --no-default-features --features any,postgres,macros,all-types,${{ matrix.tls }}
176+
cargo test --locked --no-default-features --features any,postgres,macros,all-types,${{ matrix.tls }}
177177
env:
178178
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx
179179
# FIXME: needed to disable `ltree` tests in Postgres 9.6
180180
# but `PgLTree` should just fall back to text format
181181
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
182182
183183
- run: |
184-
cargo test --no-default-features --features any,postgres,macros,migrate,all-types,${{ matrix.tls }}
184+
cargo test --locked --no-default-features --features any,postgres,macros,migrate,all-types,${{ matrix.tls }}
185185
env:
186186
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=./tests/certs/ca.crt
187187
# FIXME: needed to disable `ltree` tests in Postgres 9.6
@@ -201,7 +201,7 @@ jobs:
201201
save-if: ${{ false }}
202202
- run: docker compose up --wait postgres_16
203203
working-directory: tests
204-
- run: cargo test --no-default-features --features any,postgres,macros,all-types,rustls
204+
- run: cargo test --locked --no-default-features --features any,postgres,macros,all-types,rustls
205205
env:
206206
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
207207

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

225225
- run: |
226-
cargo build --features mysql,all-types,${{ matrix.tls }}
226+
cargo build --locked --features mysql,all-types,${{ matrix.tls }}
227227
228228
- name: Run clippy for mysql
229229
run: |
230-
cargo clippy \
230+
cargo clippy --locked \
231231
--no-default-features \
232232
--features mysql,all-types,${{ matrix.tls }},macros,migrate \
233233
-- -D warnings
@@ -236,13 +236,13 @@ jobs:
236236
- run: sleep 60
237237

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

267267
- run: |
268-
cargo build --features mysql,${{ matrix.tls }}
268+
cargo build --locked --features mysql,${{ matrix.tls }}
269269
270270
- name: Run clippy for mariadb
271271
run: |
272-
cargo clippy \
272+
cargo clippy --locked \
273273
--no-default-features \
274274
--features mysql,${{ matrix.tls }},macros,migrate \
275275
-- -D warnings
@@ -278,7 +278,7 @@ jobs:
278278
- run: sleep 30
279279

280280
- run: |
281-
cargo test --no-default-features --features any,mysql,macros,migrate,${{ matrix.tls }}
281+
cargo test --locked --no-default-features --features any,mysql,macros,migrate,${{ matrix.tls }}
282282
env:
283283
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
284284
@@ -300,11 +300,11 @@ jobs:
300300
save-if: ${{ github.ref == 'refs/heads/main' && matrix.mssql == '2022' }}
301301

302302
- run: |
303-
cargo build --features mssql,all-types,${{ matrix.tls }}
303+
cargo build --locked --features mssql,all-types,${{ matrix.tls }}
304304
305305
- name: Run clippy for mssql
306306
run: |
307-
cargo clippy \
307+
cargo clippy --locked \
308308
--no-default-features \
309309
--features mssql,all-types,${{ matrix.tls }},macros,migrate \
310310
-- -D warnings
@@ -313,7 +313,7 @@ jobs:
313313
- run: sleep 80 # MSSQL takes a "bit" to startup
314314

315315
- run: |
316-
cargo test --no-default-features --features any,mssql,macros,migrate,all-types,${{ matrix.tls }}
316+
cargo test --locked --no-default-features --features any,mssql,macros,migrate,all-types,${{ matrix.tls }}
317317
env:
318318
DATABASE_URL: mssql://sa:Password123!@localhost/sqlx
319319
@@ -344,10 +344,10 @@ jobs:
344344
odbcinst -q -s || true
345345
echo "select 1;" | isql -v SQLX_PG_5432 || true
346346
- name: Run ODBC tests (PostgreSQL DSN)
347-
run: cargo test --no-default-features --features any,odbc,macros,all-types,rustls
347+
run: cargo test --locked --no-default-features --features any,odbc,macros,all-types,rustls
348348
env:
349349
DATABASE_URL: DSN=SQLX_PG_5432;UID=postgres;PWD=password
350350
- name: Run ODBC tests (SQLite driver)
351-
run: cargo test --no-default-features --features any,odbc,macros,all-types,rustls
351+
run: cargo test --locked --no-default-features --features any,odbc,macros,all-types,rustls
352352
env:
353353
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)