Skip to content

Allow Postgres tests to be run on a different database #505

Allow Postgres tests to be run on a different database

Allow Postgres tests to be run on a different database #505

Workflow file for this run

on: [push, pull_request]
name: "CI"
jobs:
ci-pass:
name: CI is green
runs-on: ubuntu-latest
needs:
- cargo-fmt-clippy
- test-macros-and-cli
- test-sqlite
- test-postgres
- test-tokio-postgres
- test-mysql
- test-mysql-async
- test-tiberius
- doc
steps:
- run: exit 0
set-rust-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.set-versions.outputs.versions }}
steps:
- name: checkout repo
uses: actions/checkout@v2
- id: set-versions
run: |
MSRV=$(grep -oP 'rust-version\s*=\s*"\K[^"]+' ./refinery/Cargo.toml)
echo "versions=['stable', 'nightly', '$MSRV']" >> $GITHUB_OUTPUT
cargo-fmt-clippy:
name: Cargo fmt and clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: beta
- run: rustup self update
- run: rustup component add clippy
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets --all-features
test-macros-and-cli:
name: test-macros-and-cli
needs: set-rust-versions
strategy:
matrix:
rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }}
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: rustup self update
- run: cd refinery_core && cargo test --all-features -- --test-threads 1
- run: cd refinery && cargo build --all-features
- run: cd refinery_macros && cargo test --features=enums
- run: cd refinery_cli && cargo test
test-sqlite:
name: Test Sqlite
needs: set-rust-versions
runs-on: ubuntu-latest
strategy:
matrix:
rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cargo install --path ./refinery_cli --no-default-features --features=sqlite-bundled
- run: cd refinery && cargo test --features rusqlite --test rusqlite
test-postgres:
name: Test postgres
needs: set-rust-versions
runs-on: ubuntu-latest
strategy:
matrix:
rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }}
services:
postgres:
image: postgres:9.6.13-alpine
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cargo install --path ./refinery_cli --no-default-features --features=postgresql
- run: cd refinery && cargo test --features postgres --test postgres -- --test-threads 1
test-tokio-postgres:
name: Test tokio-postgres
needs: set-rust-versions
strategy:
matrix:
rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }}
runs-on: ubuntu-latest
services:
postgres:
image: postgres:9.6.13-alpine
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cd refinery && cargo test --features tokio-postgres --test tokio_postgres -- --test-threads 1
test-mysql:
name: Test mysql
needs: set-rust-versions
runs-on: ubuntu-latest
strategy:
matrix:
rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }}
services:
postgres:
image: mysql:latest
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: refinery
MYSQL_PASSWORD: root
MYSQL_DATABASE: refinery_test
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cargo install --path ./refinery_cli --no-default-features --features=mysql
- run: cd refinery && cargo test --features mysql --test mysql -- --test-threads 1
test-mysql-async:
name: Test mysql-async
needs: set-rust-versions
runs-on: ubuntu-latest
strategy:
matrix:
rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }}
services:
postgres:
image: mysql:latest
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: refinery
MYSQL_PASSWORD: root
MYSQL_DATABASE: refinery_test
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cd refinery && cargo test --features mysql_async --test mysql_async -- --test-threads 1
test-tiberius:
name: Test tiberius
needs: set-rust-versions
runs-on: ubuntu-latest
strategy:
matrix:
rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }}
services:
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: yes
SA_PASSWORD: Passw0rd
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cargo install --path ./refinery_cli --no-default-features --features=mssql
- run: cd refinery && cargo test --features tiberius-config --test tiberius -- --test-threads 1
doc:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: cd refinery && cargo rustdoc --all-features -- -D rustdoc::broken_intra_doc_links
audit:
name: cargo-audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Rust
# actions-rs/audit seems to be unmaintained and it's output doesn't give interverted tree dependencies
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: cargo install cargo-audit
- run: cargo audit