[WIP] Backend Rewrite #3266
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: Rust | |
on: | |
pull_request: | |
branches: [main, "renovate/*"] | |
push: | |
branches: ["renovate/*"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: chaos | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup env file | |
run: | | |
echo "DATABASE_URL=postgres://postgres:password@localhost:5432/chaos" >> backend/.env | |
echo "JWT_SECRET=test_secret" >> backend/.env | |
echo "GOOGLE_CLIENT_ID=test" >> backend/.env | |
echo "GOOGLE_CLIENT_SECRET=test" >> backend/.env | |
echo "GOOGLE_REDIRECT_URI=http://localhost:3000/auth/callback" >> backend/.env | |
echo "ROCKET_DATABASES='{}'" >> backend/.env | |
# selecting a toolchain either by action or manual `rustup` calls should happen | |
# before the plugin, as it uses the current rustc version as its cache key | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
working-directory: backend/ | |
- name: Migrate DB | |
working-directory: ./prisma-cli | |
run: cargo run db push | |
- name: Build | |
working-directory: ./server | |
run: cargo build | |
- name: Cargo Clippy | |
working-directory: ./server | |
run: cargo clippy | |
- name: RustFmt | |
working-directory: ./server | |
run: cargo fmt --manifest-path backend/server/Cargo.toml |