38 lines
1.0 KiB
YAML
38 lines
1.0 KiB
YAML
name: Backend CI
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ["backend/**", ".github/workflows/backend.yml"]
|
|
pull_request:
|
|
branches: [main]
|
|
paths: ["backend/**", ".github/workflows/backend.yml"]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: pass
|
|
POSTGRES_DB: loft_test
|
|
ports: ["5432:5432"]
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres"
|
|
--health-interval 5s --health-timeout 5s --health-retries 5
|
|
env:
|
|
DATABASE_URL: postgres://postgres:pass@localhost:5432/loft_test
|
|
STORAGE_PATH: /tmp/loft-files-test
|
|
SQLX_OFFLINE: "true"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- run: cargo install sqlx-cli --no-default-features --features postgres,rustls
|
|
- run: sqlx migrate run
|
|
- run: mkdir -p /tmp/loft-files-test
|
|
- run: cargo test |