Add GitHub handle support #13
Workflow file for this run
This file contains hidden or 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 CI | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| jobs: | |
| backend_tests: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: guild_genesis_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test | |
| TEST_MODE: "1" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Cache cargo | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Cache sqlx-data | |
| uses: actions/cache@v3 | |
| with: | |
| path: .sqlx | |
| key: ${{ runner.os }}-sqlx-${{ hashFiles('backend/Cargo.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-sqlx- | |
| - name: Install sqlx-cli | |
| run: cargo install sqlx-cli --no-default-features --features postgres,rustls | |
| - name: Wait for Postgres | |
| run: | | |
| until pg_isready -h localhost -p 5432 -U postgres; do | |
| echo "Waiting for Postgres..." | |
| sleep 2 | |
| done | |
| - name: Run migrations | |
| working-directory: backend | |
| run: sqlx migrate run | |
| env: | |
| DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test | |
| - name: Verify tables exist | |
| run: | | |
| PGPASSWORD=postgres psql -h localhost -U postgres -d guild_genesis_test -c "\dt" | |
| - name: Run tests | |
| working-directory: backend | |
| run: cargo test -- --nocapture | |
| env: | |
| SQLX_OFFLINE: true |