mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-09-27 13:01:43 +00:00

* fix test suite * rustfmt * need Row * test: fix integration test scripts and update the upstream supported databases Signed-off-by: Atkins Chang <atkinschang@gmail.com> * ci(actions): update supported databases Signed-off-by: Atkins Chang <atkinschang@gmail.com> * ci(actions): use `pg_isready` instead of `sleep` to avoid error cause by database not ready Signed-off-by: Atkins Chang <atkinschang@gmail.com> * feat(core): add `trait PgConnectionInfo` for connection parameter status from server Signed-off-by: Atkins Chang <atkinschang@gmail.com> * test(postgres): fix integration test for postgres Signed-off-by: Atkins Chang <atkinschang@gmail.com> * test(mysql): fix integration tests Signed-off-by: Atkins Chang <atkinschang@gmail.com> * ci(actions): test database against the oldest and newest supported versions Signed-off-by: Atkins Chang <atkinschang@gmail.com> * docs(core): document `trait PgConnectionInfo` Signed-off-by: Atkins Chang <atkinschang@gmail.com> Co-authored-by: Montana Low <montanalow@gmail.com>
370 lines
10 KiB
YAML
370 lines
10 KiB
YAML
name: SQLx
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
format:
|
|
name: Format
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
# this is cheaper than requesting the non-minimal profile
|
|
- run: rustup component add rustfmt
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
|
|
check:
|
|
name: Check
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
runtime: [async-std, tokio, actix]
|
|
tls: [native-tls, rustls]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-check-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: >
|
|
--manifest-path sqlx-core/Cargo.toml
|
|
--no-default-features
|
|
--features offline,all-databases,all-types,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: >
|
|
--no-default-features
|
|
--features offline,all-databases,all-types,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros
|
|
|
|
test:
|
|
name: Unit Test
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
runtime: [async-std, tokio, actix]
|
|
tls: [native-tls, rustls]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: >
|
|
--manifest-path sqlx-core/Cargo.toml
|
|
--features offline,all-databases,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
|
|
cli:
|
|
name: CLI Binaries
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]#, macOS-latest]
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-musl
|
|
args: --features openssl-vendored
|
|
bin: target/debug/cargo-sqlx
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
bin: target/debug/cargo-sqlx.exe
|
|
# FIXME: macOS build fails because of missing pin-project-internal
|
|
# - os: macOS-latest
|
|
# target: x86_64-apple-darwin
|
|
# bin: target/debug/cargo-sqlx
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
target: ${{ matrix.target }}
|
|
override: true
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cli-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --manifest-path sqlx-cli/Cargo.toml --bin cargo-sqlx ${{ matrix.args }}
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: cargo-sqlx-${{ matrix.target }}
|
|
path: ${{ matrix.bin }}
|
|
|
|
sqlite:
|
|
name: SQLite
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
runtime: [async-std, tokio, actix]
|
|
tls: [native-tls, rustls]
|
|
needs: check
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: >
|
|
--no-default-features
|
|
--features any,macros,migrate,sqlite,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
--
|
|
--test-threads=1
|
|
env:
|
|
DATABASE_URL: sqlite://tests/sqlite/sqlite.db
|
|
|
|
postgres:
|
|
name: Postgres
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
postgres: [13, 9_6]
|
|
runtime: [async-std, tokio, actix]
|
|
tls: [native-tls, rustls]
|
|
needs: check
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: >
|
|
--features postgres,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
|
|
- run: |
|
|
docker-compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_${{ matrix.postgres }} postgres_${{ matrix.postgres }}
|
|
docker exec postgres_${{ matrix.postgres }} bash -c "until pg_isready; do sleep 1; done"
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: >
|
|
--no-default-features
|
|
--features any,postgres,macros,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
env:
|
|
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: >
|
|
--no-default-features
|
|
--features any,postgres,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
env:
|
|
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=.%2Ftests%2Fcerts%2Fca.crt
|
|
|
|
mysql:
|
|
name: MySQL
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
mysql: [8, 5_6]
|
|
runtime: [async-std, tokio, actix]
|
|
tls: [native-tls, rustls]
|
|
needs: check
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: >
|
|
--features mysql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
|
|
- run: docker-compose -f tests/docker-compose.yml run -d -p 3306:3306 mysql_${{ matrix.mysql }}
|
|
- run: sleep 60
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: >
|
|
--no-default-features
|
|
--features any,mysql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
env:
|
|
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
|
|
|
|
mariadb:
|
|
name: MariaDB
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
mariadb: [10_6, 10_2]
|
|
runtime: [async-std, tokio, actix]
|
|
tls: [native-tls, rustls]
|
|
needs: check
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
# same Cargo features as MySQL so the same cache can be used
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: >
|
|
--features mysql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
|
|
- run: docker-compose -f tests/docker-compose.yml run -d -p 3306:3306 mariadb_${{ matrix.mariadb }}
|
|
- run: sleep 30
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: >
|
|
--no-default-features
|
|
--features any,mysql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
env:
|
|
DATABASE_URL: mysql://root:password@localhost:3306/sqlx
|
|
|
|
mssql:
|
|
name: MSSQL
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
mssql: [2019, 2017]
|
|
runtime: [async-std, tokio, actix]
|
|
tls: [native-tls, rustls]
|
|
needs: check
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-mssql-${{ matrix.runtime }}-${{ matrix.tls }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: >
|
|
--features mssql,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
|
|
- run: docker-compose -f tests/docker-compose.yml run -d -p 1433:1433 mssql_${{ matrix.mssql }}
|
|
- run: sleep 80 # MSSQL takes a "bit" to startup
|
|
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: >
|
|
--no-default-features
|
|
--features any,mssql,macros,migrate,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
|
|
env:
|
|
DATABASE_URL: mssql://sa:Password123!@localhost/sqlx
|