2020-06-07 03:57:10 -07:00

108 lines
2.4 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_12:
name: Postgres 12
runs-on: ubuntu-20.04
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_12
- run: sleep 10
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--features postgres,all-types
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx