Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 40 additions & 26 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
name: tests
name: Tests

on:
pull_request:
push:
branches:
- "master"
# schedule:
# - cron: "00 00 */2 * *"
branches: [main, master]
pull_request:
branches: [main, master]

permissions:
contents: read
env:
CARGO_TERM_COLOR: always

jobs:
test:
name: test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Build multi-query
run: cargo build --verbose --release
- name: Install PostgreSQL client (psql)
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client

- name: Run tests
run: cargo test --verbose
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
- name: Cache cargo index
uses: actions/cache@v4
with:
toolchain: stable
components: rustfmt
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

- name: Check formatting
run: cargo fmt --all --check
run: cargo fmt -- --check

- name: Run clippy
run: cargo clippy -- -D warnings

- name: Run tests
run: cargo test --verbose -- --test-threads=4
env:
# testcontainers needs Docker socket
DOCKER_HOST: unix:///var/run/docker.sock
Loading