2019-12-30 10:16:00 +00:00
|
|
|
name: Rust
|
|
|
|
|
2020-01-07 07:55:11 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2019-12-30 10:16:00 +00:00
|
|
|
|
|
|
|
jobs:
|
2020-01-17 02:14:47 +00:00
|
|
|
format:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
|
|
|
- run: cargo fmt --all -- --check
|
2019-12-30 10:16:00 +00:00
|
|
|
|
2020-01-17 02:14:47 +00:00
|
|
|
build:
|
2019-12-30 10:16:00 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
2020-01-07 07:55:11 +00:00
|
|
|
# Rust ------------------------------------------------
|
2019-12-30 10:21:54 +00:00
|
|
|
|
2020-01-07 07:55:11 +00:00
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
2019-12-30 10:16:00 +00:00
|
|
|
with:
|
2020-01-07 07:55:11 +00:00
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Cache target/
|
2019-12-30 10:16:00 +00:00
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: target
|
|
|
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
2020-01-07 07:55:11 +00:00
|
|
|
# -----------------------------------------------------
|
2020-01-03 08:02:34 +00:00
|
|
|
|
2020-01-21 20:27:20 +00:00
|
|
|
# check w/deny warnings in sqlx-core: async-std
|
|
|
|
- working-directory: sqlx-core
|
|
|
|
run: cargo rustc --no-default-features --features 'chrono uuid postgres mysql tls runtime-async-std' -- -D warnings --emit=metadata
|
2019-12-30 10:16:00 +00:00
|
|
|
|
2020-01-21 20:27:20 +00:00
|
|
|
# check w/deny warnings in sqlx-core: tokio
|
|
|
|
# `cargo rustc -p sqlx-core` ignores `--no-default-features` and builds with `runtime-async-std` anyway
|
|
|
|
# https://github.com/rust-lang/cargo/issues/5364
|
|
|
|
- working-directory: sqlx-core
|
|
|
|
run: cargo rustc --no-default-features --features 'chrono uuid postgres mysql tls runtime-tokio' -- -D warnings --emit=metadata
|
|
|
|
|
|
|
|
# check w/deny warnings: async-std
|
|
|
|
- run: cargo rustc --no-default-features --features 'chrono uuid postgres mysql macros tls runtime-async-std' -- -D warnings --emit=metadata
|
|
|
|
|
|
|
|
# check w/deny warnings: tokio
|
|
|
|
- run: cargo rustc --no-default-features --features 'chrono uuid postgres mysql macros tls runtime-tokio' -- -D warnings --emit=metadata
|
2020-01-15 09:17:33 +00:00
|
|
|
|
2020-01-17 02:14:47 +00:00
|
|
|
# unit test: async-std
|
|
|
|
- run: cargo test --manifest-path sqlx-core/Cargo.toml --no-default-features --features 'chrono uuid postgres mysql tls runtime-async-std'
|
2020-01-15 09:17:33 +00:00
|
|
|
|
2020-01-17 02:14:47 +00:00
|
|
|
# unit test: tokio
|
|
|
|
- run: cargo test --manifest-path sqlx-core/Cargo.toml --no-default-features --features 'chrono uuid postgres mysql tls runtime-tokio'
|
2020-01-07 07:55:11 +00:00
|
|
|
|
|
|
|
# Rust ------------------------------------------------
|
|
|
|
|
|
|
|
- name: Prepare build directory for cache
|
|
|
|
run: |
|
|
|
|
find ./target/debug -maxdepth 1 -type f -delete \
|
|
|
|
&& rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
|
|
|
|
&& rm -f ./target/.rustc_info.json
|
|
|
|
|
|
|
|
# -----------------------------------------------------
|
2020-01-17 02:14:47 +00:00
|
|
|
|
|
|
|
postgres:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
postgres: [9.4.25, 10.11, 12.1]
|
|
|
|
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:${{ matrix.postgres }}
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: postgres
|
|
|
|
ports:
|
|
|
|
# will assign a random free host port
|
|
|
|
- 5432/tcp
|
|
|
|
# needed because the postgres container does not provide a healthcheck
|
|
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
|
|
|
# Rust ------------------------------------------------
|
|
|
|
|
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Cache target/
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: target
|
|
|
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
# -----------------------------------------------------
|
|
|
|
|
|
|
|
# integration test: async-std
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-async-std postgres macros uuid chrono tls'
|
|
|
|
env:
|
|
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
|
|
|
|
|
|
# integration test: tokio
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-tokio postgres macros uuid chrono tls'
|
|
|
|
env:
|
|
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
|
|
|
2020-01-25 04:24:39 +00:00
|
|
|
# UI feature gate tests: async-std
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-async-std postgres macros tls'
|
|
|
|
env:
|
|
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
|
|
|
|
|
|
# UI feature gate tests: tokio
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-tokio postgres macros tls'
|
|
|
|
env:
|
|
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
|
|
|
|
|
2020-01-17 02:14:47 +00:00
|
|
|
mysql:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
mysql: [5.7.28, 8.0.18]
|
|
|
|
|
|
|
|
services:
|
|
|
|
mysql:
|
|
|
|
image: mysql:${{ matrix.mysql }}
|
|
|
|
env:
|
|
|
|
MYSQL_ROOT_PASSWORD: password
|
|
|
|
MYSQL_DATABASE: sqlx
|
|
|
|
ports:
|
|
|
|
# will assign a random free host port
|
|
|
|
- 3306/tcp
|
|
|
|
# needed because the container does not provide a healthcheck
|
|
|
|
options: >-
|
|
|
|
--health-cmd "mysqladmin ping --silent" --health-interval 30s --health-timeout 30s
|
|
|
|
--health-retries 10 -v /data/mysql:/var/lib/mysql
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
|
|
|
# Rust ------------------------------------------------
|
|
|
|
|
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Cache target/
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: target
|
|
|
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
# -----------------------------------------------------
|
|
|
|
|
|
|
|
# integration test: async-std
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros uuid chrono tls'
|
|
|
|
env:
|
|
|
|
# pass the path to the CA that the MySQL service generated
|
|
|
|
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
|
|
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
|
|
|
|
|
|
# integration test: tokio
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros uuid chrono tls'
|
|
|
|
env:
|
|
|
|
# pass the path to the CA that the MySQL service generated
|
|
|
|
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
|
|
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
|
|
|
2020-01-25 04:24:39 +00:00
|
|
|
# UI feature gate tests: async-std
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros tls' --test ui-tests
|
|
|
|
env:
|
|
|
|
# pass the path to the CA that the MySQL service generated
|
|
|
|
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
|
|
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
|
|
|
|
|
|
# UI feature gate tests: tokio
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros tls' --test ui-tests
|
|
|
|
env:
|
|
|
|
# pass the path to the CA that the MySQL service generated
|
|
|
|
# NOTE: Github Actions' YML parser doesn't handle multiline strings correctly
|
|
|
|
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
|
|
|
|
|
|
|
2020-01-17 02:14:47 +00:00
|
|
|
mariadb:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
mariadb: [10.1.43, 10.4.11]
|
|
|
|
|
|
|
|
services:
|
|
|
|
mariadb:
|
|
|
|
image: mariadb:${{ matrix.mariadb }}
|
|
|
|
env:
|
|
|
|
MYSQL_ROOT_PASSWORD: password
|
|
|
|
MYSQL_DATABASE: sqlx
|
|
|
|
ports:
|
|
|
|
# will assign a random free host port
|
|
|
|
- 3306/tcp
|
|
|
|
# needed because the container does not provide a healthcheck
|
|
|
|
options: --health-cmd "mysqladmin ping --silent" --health-interval 30s --health-timeout 30s --health-retries 10
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
|
|
|
# Rust ------------------------------------------------
|
|
|
|
|
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Cache target/
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: target
|
|
|
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
# -----------------------------------------------------
|
|
|
|
|
|
|
|
# integration test: async-std
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros chrono uuid chrono tls'
|
|
|
|
env:
|
|
|
|
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
|
|
|
|
|
|
# integration test: tokio
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros uuid chrono tls'
|
|
|
|
env:
|
|
|
|
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
2020-01-25 04:24:39 +00:00
|
|
|
|
|
|
|
# UI feature gate tests: async-std
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-async-std mysql macros tls'
|
|
|
|
env:
|
|
|
|
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|
|
|
|
|
|
|
|
# UI feature gate tests: tokio
|
|
|
|
- run: cargo test --no-default-features --features 'runtime-tokio mysql macros tls'
|
|
|
|
env:
|
|
|
|
DATABASE_URL: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3306] }}/sqlx
|