Skip to content

Enable postgresql tests #37

Enable postgresql tests

Enable postgresql tests #37

Workflow file for this run

name: CI
on: [ push, pull_request ]
jobs:
test:
strategy:
matrix:
include:
- { name: "Rust stable", rust: stable, cargo_args: "" }
- { name: "Rust nightly", rust: nightly, cargo_args: "" }
- { name: "Rust nightly, release", rust: nightly, cargo_args: "--release" }
fail-fast: false
runs-on: ubuntu-latest
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt
- name: Install dependencies
run: |
curl -s https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main $POSTGRESQL" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-$POSTGRESQL postgresql-server-dev-$POSTGRESQL
env:
POSTGRESQL: 16
- name: Prepare postgresql
run: |
sudo sed -i -e 's|peer|trust|' /etc/postgresql/$POSTGRESQL/main/pg_hba.conf
sudo pg_ctlcluster $POSTGRESQL main restart
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
target/
key: cargo-${{ matrix.rust }}-${{ matrix.cargo_args }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-${{ matrix.rust }}-${{ matrix.cargo_args }}-
cargo-${{ matrix.rust }}-
- name: Build
run: cargo build ${{ matrix.cargo_args }}
env:
RUSTFLAGS: -Dwarnings -Adead_code
- name: Test
run: cargo test ${{ matrix.cargo_args }}
env:
DATABASE_URL: postgres://postgres@localhost:5433/
- name: Format check
run: cargo fmt --check