From 8858bfa3c62072db8f51a3fd3f1c2660d41ffc0c Mon Sep 17 00:00:00 2001 From: stefiosif Date: Sat, 6 Jun 2026 20:30:05 +0300 Subject: [PATCH] ci: add backend test workflow --- .github/workflows/backend.yml | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/backend.yml diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml new file mode 100644 index 0000000..8a23245 --- /dev/null +++ b/.github/workflows/backend.yml @@ -0,0 +1,38 @@ +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 \ No newline at end of file