Skip to content
# This pipelines runs when a pull request is mades and validates the build
on:
push:
branches: main
pull_request:
branches: ["*"]
env:
DATABASE_URL: postgres://postgres:password@localhost/api
jobs:
build-validation:
name: build-validation
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: api
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- uses: baptiste0928/cargo-install@v2
with:
crate: sqlx-cli
- run: sqlx migrate run
- run: cargo build --bins --tests --release
- run: cargo test --release
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo fmt --all -- --check