Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
@@ -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:"
48 changes: 24 additions & 24 deletions .github/workflows/sqlx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} \
Expand All @@ -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

Expand Down Expand Up @@ -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 }}
Expand All @@ -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:
Expand All @@ -151,15 +151,15 @@ 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
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}

- name: Run clippy for postgres
run: |
cargo clippy \
cargo clippy --locked \
--no-default-features \
--features postgres,all-types,${{ matrix.tls }},macros,migrate \
-- -D warnings
Expand All @@ -171,15 +171,15 @@ 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
# but `PgLTree` should just fall back to text format
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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Loading