Skip to content

chore: add caching to CI, use new toolchain action and remove actions… #20

chore: add caching to CI, use new toolchain action and remove actions…

chore: add caching to CI, use new toolchain action and remove actions… #20

Workflow file for this run

on: [push, pull_request]
name: Continuous integration
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- name: Run cargo check
run: cargo check
test:
name: Test Suite
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: laskugeneraattori
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- name: Install Diesel
run: cargo install diesel_cli --features=postgres
- name: Create Test DB
env:
DATABASE_URL: postgres://postgres:postgres@localhost/laskugeneraattori
run: diesel migration run
- name: Run tests
env:
DATABASE_URL: postgres://postgres:postgres@localhost/laskugeneraattori
run: cargo test
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Run cargo clippy
run: cargo clippy -- -D warnings