Skip to content

chore: add postgres testing #31

chore: add postgres testing

chore: add postgres testing #31

Workflow file for this run

name: Test
on:
push:
branches: [ main ]
pull_request:
branches: '*'
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.nightly }}
strategy:
fail-fast: false
matrix:
toolchain: [ 'stable' ]
nightly: [false]
include:
- toolchain: 'nightly'
nightly: true
steps:
- uses: actions/checkout@v3
- name: Install rust tooling
run: |
rustup update ${{ matrix.toolchain }}
rustup component add --toolchain ${{ matrix.toolchain }} clippy rustfmt
- name: Print rust tooling information
run: |
rustup run ${{ matrix.toolchain }} rustc --version
rustup run ${{ matrix.toolchain }} cargo --version --verbose
rustup run ${{ matrix.toolchain }} cargo clippy --version
rustup run ${{ matrix.toolchain }} cargo fmt --version
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: rust_${{ matrix.toolchain }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Run cargo fmt
run: rustup run ${{ matrix.toolchain }} cargo fmt --all -- --check
- name: Run test - sqlite | sqlx | runtime-async-std | macros
run: rustup run ${{ matrix.toolchain }} cargo test --features sqlite,sqlx,runtime-async-std,macros --all-targets --verbose
- name: Run test - sqlite | diesel | runtime-async-std | macros
run: rustup run ${{ matrix.toolchain }} cargo test --features sqlite,diesel,runtime-async-std,macros --all-targets --verbose
- name: Run test - sqlite | diesel
run: rustup run ${{ matrix.toolchain }} cargo test --features sqlite,diesel --all-targets --verbose
- name: Start containers for database tests
run: docker compose -f "docker-compose.yml" up -d
- name: Run test - mysql | diesel
run: rustup run ${{ matrix.toolchain }} cargo test --features mysql,diesel --all-targets --verbose
- name: Run test - mysql | sqlx | runtime-async-std
run: rustup run ${{ matrix.toolchain }} cargo test --features mysql,sqlx,runtime-async-std --all-targets --verbose
- name: Stop containers for database tests
if: always()
run: |
docker compose -f "docker-compose.yml" down --volumes
sudo rm -rf .data/{postgresql-15,mysql-8}
- name: Run doc tests
run: rustup run ${{ matrix.toolchain }} cargo test --features sqlite,sqlx,runtime-async-std,macros --doc --verbose
- name: Run clippy
run: rustup run ${{ matrix.toolchain }} cargo clippy --features sqlite,sqlx,runtime-async-std,macros -- -Dwarnings