122 lines
2.9 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]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: >
--manifest-path sqlx-core/Cargo.toml
--no-default-features
--features offline,all-databases,all-types,runtime-${{ matrix.runtime }}
- uses: actions-rs/cargo@v1
with:
command: check
args: >
--no-default-features
--features offline,all-databases,all-types,runtime-${{ matrix.runtime }},macros
test:
name: Unit Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path sqlx-core/Cargo.toml
--features offline,all-databases,all-types
postgres:
name: Postgres
runs-on: ubuntu-20.04
strategy:
matrix:
runtime: [async-std, tokio, actix]
postgres: [12, 10, 9_6, 9_5]
needs: check
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--features postgres,all-types
- run: docker-compose -f tests/docker-compose.yml run -d -p 5432:5432 postgres_${{ matrix.postgres }}
- run: sleep 10
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--no-default-features
--features postgres,all-types,runtime-${{ matrix.runtime }}
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--no-default-features
--features postgres,all-types,runtime-${{ matrix.runtime }}
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=.%2Ftests%2Fcerts%2Fca.crt