test: add searching events' route tests #583
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Server test | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
name: test | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
services: | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: nittei | |
ports: | |
- 5432:5432 | |
env: | |
# Needed for sqlx | |
DATABASE_URL: postgresql://postgres:postgres@localhost/nittei | |
NITTEI__HTTP_PORT: 5000 | |
NITTEI__DATABASE_URL: postgresql://postgres:postgres@localhost/nittei | |
RUST_BACKTRACE: 1 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly | |
components: rustfmt | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
# Install Nextest | |
- name: Install nextest | |
uses: taiki-e/install-action@nextest | |
- name: Run migrations | |
run: | | |
# run the migrations first | |
cargo install sqlx-cli --no-default-features --features postgres || true | |
(cd crates/infra && sqlx migrate run) | |
- name: Formatting | |
run: | | |
cargo +nightly fmt --all -- --check | |
- name: Clippy | |
run: | | |
cargo clippy --all | |
# To re-enable | |
# cargo clippy --all -- --deny "warnings" | |
# Commented out for now as it's pretty slow in the CI | |
# TODO: find a solution (e.g. by using caching) or re-enable only on master | |
# - name: Unused dependencies | |
# run: | | |
# cargo install cargo-udeps --locked | |
# cargo +nightly udeps --all-targets | |
# - name: Outdated dependencies | |
# run: | | |
# # cargo outdated --exit-code 1 --workspace | |
# cargo outdated --workspace | |
- name: Run server tests | |
run: | | |
cargo test --workspace -- --skip export_bindings_ |