Skip to content

Github Actions #4

Github Actions

Github Actions #4

Workflow file for this run

name: Rust
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo clippy --all-features --all-targets --verbose
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo fmt --verbose
test:
name: Test
runs-on: ubuntu-latest
steps:
- 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') }}
- uses: actions/checkout@v4
- name: Install sqlx
run: cargo install sqlx-cli --no-default-features --features postgres
- name: Run migrations
run: sqlx migrate run
- name: Run tests
run: cargo test --all-features --all-targets --verbose
env:
DATABASE_URL: postgres://${{secrets.POSTGRES_USER}}:${{secrets.POSTGRES_PASSWORD}}@database:5432/${{secrets.POSTGRES_DB}}
environment: "Rust CI"
services:
database:
image: postgres:16
env:
POSTGRES_PASSWORD: ${{secrets.POSTGRES_PASSWORD}}
POSTGRES_USER: ${{secrets.POSTGRES_USER}}
POSTGRES_DB: ${{secrets.POSTGRES_DB}}