name: Cargo tests
on:
push:
branches:
- main
pull_request:
jobs:
clippy:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
components: clippy
override: true
toolchain: stable
- name: Install dependencies
run: sudo apt install -y openssl libkrb5-dev
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features=all
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
components: rustfmt
override: true
toolchain: stable
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
cargo-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- "--lib --features=all"
- "--lib --no-default-features --features=sqlite"
- "--lib --no-default-features --features=sqlite --features=pooled"
- "--lib --no-default-features --features=postgresql"
- "--lib --no-default-features --features=postgresql --features=pooled"
- "--lib --no-default-features --features=mysql"
- "--lib --no-default-features --features=mysql --features=pooled"
- "--lib --no-default-features --features=mssql"
- "--lib --no-default-features --features=mssql --features=pooled"
- "--doc --features=all"
env:
TEST_MYSQL: "mysql://root:prisma@localhost:3306/prisma"
TEST_MYSQL8: "mysql://root:prisma@localhost:3307/prisma"
TEST_MYSQL_MARIADB: "mysql://root:prisma@localhost:3308/prisma"
TEST_PSQL: "postgres://postgres:prisma@localhost:5432/postgres"
TEST_MSSQL: "jdbc:sqlserver://localhost:1433;database=master;user=SA;password=<YourStrong@Passw0rd>;trustServerCertificate=true"
TEST_CRDB: "postgresql://prisma@127.0.0.1:26259/postgres"
RUSTFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.features }}
- name: Start Databases
run: docker compose -f docker-compose.yml up -d --wait
- name: Run tests
run: cargo test ${{ matrix.features }}
rustdoc:
needs: [clippy, format, cargo-test]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: linux-cargo-rustdoc
- name: Generate documentation
run: |
cargo +nightly rustdoc --all-features
- name: Deploy Documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./target/doc
SCRIPT_MODE: true
run: |
wget https://gist.githubusercontent.com/pimeys/73853d2718a99a471ce82d481002de50/raw/13ccccccfb0a11db3fbe90eeacafa487a80e6068/entrypoint.sh
bash ./entrypoint.sh