From 5afc7335b763dc780f53ddf03bb9f2ef3a46d2d9 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Mon, 28 Sep 2026 00:45:22 +0200 Subject: [PATCH] ci: lock PR dependencies and check upstream compatibility weekly --- .github/workflows/compatibility.yml | 57 +++++++++++++++++++++++++++++ .github/workflows/sqlx.yml | 48 ++++++++++++------------ CONTRIBUTING.md | 10 +++++ 3 files changed, 91 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/compatibility.yml diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml new file mode 100644 index 0000000000..def543bda4 --- /dev/null +++ b/.github/workflows/compatibility.yml @@ -0,0 +1,57 @@ +name: Upstream compatibility + +on: + schedule: + - cron: "23 6 * * 1" + workflow_dispatch: + +permissions: + contents: read + +env: + # Override rust-toolchain.toml for this workflow only. + RUSTUP_TOOLCHAIN: stable + +jobs: + compatibility: + name: Latest stable and dependencies (${{ matrix.tls }}) + runs-on: ubuntu-24.04 + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + tls: [native-tls, rustls] + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 + with: + toolchain: stable + components: clippy + - run: sudo apt-get update && sudo apt-get install -y libodbc2 unixodbc-dev + - name: Resolve latest compatible dependencies + run: cargo update + - name: Check core with latest dependencies + run: >- + cargo clippy --locked --manifest-path sqlx-core/Cargo.toml --no-default-features + --features offline,all-databases,all-types,migrate,${{ matrix.tls }} + -- -D warnings + - name: Check macros with latest dependencies + run: >- + cargo clippy --locked --no-default-features + --features offline,all-databases,all-types,migrate,macros,${{ matrix.tls }} + -- -D warnings + - name: Check all targets with latest dependencies + run: >- + cargo clippy --locked --no-default-features --all-targets + --features offline,all-databases,all-types,${{ matrix.tls }} + -- -D warnings + - name: Run core unit tests + run: >- + cargo test --locked --manifest-path sqlx-core/Cargo.toml + --features offline,all-databases,all-types,${{ matrix.tls }} + - name: Run SQLite type tests + run: >- + cargo test --locked --no-default-features + --features sqlite,all-types,macros,${{ matrix.tls }} --test sqlite-types + env: + DATABASE_URL: "sqlite::memory:" diff --git a/.github/workflows/sqlx.yml b/.github/workflows/sqlx.yml index 5162d034b9..1b4bf48b16 100644 --- a/.github/workflows/sqlx.yml +++ b/.github/workflows/sqlx.yml @@ -32,19 +32,19 @@ jobs: save-if: ${{ false }} - name: Run clippy for core with all features run: | - cargo clippy --manifest-path sqlx-core/Cargo.toml \ + cargo clippy --locked --manifest-path sqlx-core/Cargo.toml \ --no-default-features \ --features offline,all-databases,all-types,migrate,${{ matrix.tls }} \ -- -D warnings - name: Run clippy for root with all features run: | - cargo clippy \ + cargo clippy --locked \ --no-default-features \ --features offline,all-databases,all-types,migrate,${{ matrix.tls }},macros \ -- -D warnings - name: Run clippy for all targets run: | - cargo clippy \ + cargo clippy --locked \ --no-default-features \ --all-targets \ --features offline,all-databases,all-types,migrate,${{ matrix.tls }} \ @@ -64,7 +64,7 @@ jobs: save-if: ${{ false }} - run: sudo apt-get update && sudo apt-get install -y libodbc2 unixodbc-dev if: ${{ matrix.os == 'ubuntu-latest' }} - - run: cargo test + - run: cargo test --locked --manifest-path sqlx-core/Cargo.toml --features offline,all-databases,all-types,rustls @@ -94,7 +94,7 @@ jobs: with: prefix-key: v1-sqlx save-if: ${{ github.ref == 'refs/heads/main' }} - - run: cargo build + - run: cargo build --locked --manifest-path sqlx-cli/Cargo.toml --bin cargo-sqlx ${{ matrix.args }} @@ -121,11 +121,11 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' && matrix.tls == 'native-tls' }} - name: Run clippy for sqlite run: | - cargo clippy \ + cargo clippy --locked \ --no-default-features \ --features sqlite,all-types,${{ matrix.tls }},macros,migrate \ -- -D warnings - - run: cargo test + - run: cargo test --locked --no-default-features --features any,macros,migrate,sqlite,all-types,${{ matrix.tls }} env: @@ -151,7 +151,7 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' && matrix.postgres == '14' }} - run: | - cargo build --features postgres,all-types,${{ matrix.tls }} + cargo build --locked --features postgres,all-types,${{ matrix.tls }} env: # FIXME: needed to disable `ltree` tests in Postgres 9.6 # but `PgLTree` should just fall back to text format @@ -159,7 +159,7 @@ jobs: - name: Run clippy for postgres run: | - cargo clippy \ + cargo clippy --locked \ --no-default-features \ --features postgres,all-types,${{ matrix.tls }},macros,migrate \ -- -D warnings @@ -171,7 +171,7 @@ jobs: docker exec postgres_${{ matrix.postgres }} bash -c "until pg_isready; do sleep 1; done" - run: | - cargo test --no-default-features --features any,postgres,macros,all-types,${{ matrix.tls }} + cargo test --locked --no-default-features --features any,postgres,macros,all-types,${{ matrix.tls }} env: DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx # FIXME: needed to disable `ltree` tests in Postgres 9.6 @@ -179,7 +179,7 @@ jobs: RUSTFLAGS: --cfg postgres_${{ matrix.postgres }} - run: | - cargo test --no-default-features --features any,postgres,macros,migrate,all-types,${{ matrix.tls }} + cargo test --locked --no-default-features --features any,postgres,macros,migrate,all-types,${{ matrix.tls }} env: DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=./tests/certs/ca.crt # FIXME: needed to disable `ltree` tests in Postgres 9.6 @@ -199,7 +199,7 @@ jobs: save-if: ${{ false }} - run: docker compose up --wait postgres_16 working-directory: tests - - run: cargo test --no-default-features --features any,postgres,macros,all-types,rustls + - run: cargo test --locked --no-default-features --features any,postgres,macros,all-types,rustls env: 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 @@ -221,11 +221,11 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' && matrix.mysql == '8' }} - run: | - cargo build --features mysql,all-types,${{ matrix.tls }} + cargo build --locked --features mysql,all-types,${{ matrix.tls }} - name: Run clippy for mysql run: | - cargo clippy \ + cargo clippy --locked \ --no-default-features \ --features mysql,all-types,${{ matrix.tls }},macros,migrate \ -- -D warnings @@ -234,13 +234,13 @@ jobs: - run: sleep 60 - run: | - cargo test --no-default-features --features any,mysql,macros,migrate,all-types,${{ matrix.tls }} + cargo test --locked --no-default-features --features any,mysql,macros,migrate,all-types,${{ matrix.tls }} env: DATABASE_URL: mysql://root:password@localhost:3306/sqlx?ssl-mode=disabled # MySQL 5.7 supports TLS but not TLSv1.3 as required by RusTLS. - run: | - cargo test --no-default-features --features any,mysql,macros,migrate,all-types,${{ matrix.tls }} + cargo test --locked --no-default-features --features any,mysql,macros,migrate,all-types,${{ matrix.tls }} if: ${{ !(matrix.mysql == '5_7' && matrix.tls == 'rustls') }} env: DATABASE_URL: mysql://root:password@localhost:3306/sqlx @@ -263,11 +263,11 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' && matrix.mariadb == '10_6' }} - run: | - cargo build --features mysql,${{ matrix.tls }} + cargo build --locked --features mysql,${{ matrix.tls }} - name: Run clippy for mariadb run: | - cargo clippy \ + cargo clippy --locked \ --no-default-features \ --features mysql,${{ matrix.tls }},macros,migrate \ -- -D warnings @@ -276,7 +276,7 @@ jobs: - run: sleep 30 - run: | - cargo test --no-default-features --features any,mysql,macros,migrate,${{ matrix.tls }} + cargo test --locked --no-default-features --features any,mysql,macros,migrate,${{ matrix.tls }} env: DATABASE_URL: mysql://root:password@localhost:3306/sqlx @@ -298,11 +298,11 @@ jobs: save-if: ${{ github.ref == 'refs/heads/main' && matrix.mssql == '2022' }} - run: | - cargo build --features mssql,all-types,${{ matrix.tls }} + cargo build --locked --features mssql,all-types,${{ matrix.tls }} - name: Run clippy for mssql run: | - cargo clippy \ + cargo clippy --locked \ --no-default-features \ --features mssql,all-types,${{ matrix.tls }},macros,migrate \ -- -D warnings @@ -311,7 +311,7 @@ jobs: - run: sleep 80 # MSSQL takes a "bit" to startup - run: | - cargo test --no-default-features --features any,mssql,macros,migrate,all-types,${{ matrix.tls }} + cargo test --locked --no-default-features --features any,mssql,macros,migrate,all-types,${{ matrix.tls }} env: DATABASE_URL: mssql://sa:Password123!@localhost/sqlx @@ -342,10 +342,10 @@ jobs: odbcinst -q -s || true echo "select 1;" | isql -v SQLX_PG_5432 || true - name: Run ODBC tests (PostgreSQL DSN) - run: cargo test --no-default-features --features any,odbc,macros,all-types,rustls + run: cargo test --locked --no-default-features --features any,odbc,macros,all-types,rustls env: DATABASE_URL: DSN=SQLX_PG_5432;UID=postgres;PWD=password - name: Run ODBC tests (SQLite driver) - run: cargo test --no-default-features --features any,odbc,macros,all-types,rustls + run: cargo test --locked --no-default-features --features any,odbc,macros,all-types,rustls env: DATABASE_URL: Driver={SQLite3};Database=./tests/odbc/sqlite.db diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e99011fae7..16914a692e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,6 +26,16 @@ You can use this document to figure out how and where to start. - Push your changes to a topic branch in your fork of the repository. - Submit a pull request to the original repository. +## Dependency updates + +PR CI uses the committed `Cargo.lock` with `--locked`. When changing dependencies, +update and commit the lockfile in the same PR. Keep unrelated dependency upgrades +in dedicated PRs. + +The separate **Upstream compatibility** workflow runs weekly and can also be +started manually. It tests the latest stable Rust and a freshly updated lockfile +without changing the committed baseline or adding checks to unrelated PRs. + ## What to work on We try to mark issues with a suggested level of experience (in Rust/SQL/SQLx).