feat: add twitter_handle to profiles with case-insensitive uniqueness #319
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: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| frontend: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Run linter | |
| run: | | |
| cd frontend | |
| npm run lint | |
| - name: Run tests | |
| run: | | |
| cd frontend | |
| npm run test:run | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| npm run build | |
| backend: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_USER: postgres | |
| POSTGRES_DB: guild_genesis_test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test | |
| TEST_MODE: "1" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| override: true | |
| - name: Cache cargo registry | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| backend/target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Cache sqlx-data | |
| uses: actions/cache@v3 | |
| with: | |
| path: backend/.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: List migrations folder (debug) | |
| working-directory: backend | |
| run: | | |
| echo "Checking migrations folder:" | |
| ls -lah migrations/ || echo "❌ No migrations folder found" | |
| echo "Migration files:" | |
| ls -lah migrations/*.sql || echo "❌ No .sql files found" | |
| - name: Wait for Postgres | |
| run: | | |
| until pg_isready -h localhost -p 5432 -U postgres; do | |
| echo "Waiting for Postgres..." | |
| sleep 2 | |
| done | |
| - name: Reset and run migrations | |
| working-directory: backend | |
| run: | | |
| echo "Reverting all migrations..." | |
| while sqlx migrate revert -y 2>/dev/null; do | |
| echo "Reverted one migration" | |
| done | |
| echo "Running migrations..." | |
| sqlx migrate run | |
| echo "Migrations completed" | |
| env: | |
| DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test | |
| SQLX_OFFLINE: "false" | |
| - name: Verify tables exist | |
| run: | | |
| echo "Listing all tables in database:" | |
| PGPASSWORD=postgres psql -h localhost -U postgres -d guild_genesis_test -c "\dt" | |
| echo "Checking profiles table schema:" | |
| PGPASSWORD=postgres psql -h localhost -U postgres -d guild_genesis_test -c "\d profiles" | |
| - name: Build backend | |
| working-directory: backend | |
| run: cargo build | |
| env: | |
| SQLX_OFFLINE: true | |
| - name: Run clippy | |
| working-directory: backend | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| env: | |
| SQLX_OFFLINE: true | |
| - name: Run rustfmt | |
| working-directory: backend | |
| run: cargo fmt --all -- --check | |
| - name: Run tests | |
| working-directory: backend | |
| run: cargo test --test integration_github_handle -- --test-threads=1 | |
| env: | |
| DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/guild_genesis_test | |
| SQLX_OFFLINE: true | |
| TEST_MODE: "1" | |
| smart-contracts: | |
| name: Smart Contracts Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: nightly | |
| cache: true | |
| - name: Cache Foundry | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.foundry | |
| the-guild-smart-contracts/cache | |
| the-guild-smart-contracts/out | |
| key: ${{ runner.os }}-foundry-${{ hashFiles('the-guild-smart-contracts/foundry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-foundry- | |
| - name: Install OpenZeppelin | |
| run: | | |
| cd the-guild-smart-contracts | |
| forge install OpenZeppelin/openzeppelin-contracts | |
| - name: Build contracts | |
| run: | | |
| cd the-guild-smart-contracts | |
| forge build | |
| - name: Run tests | |
| run: | | |
| cd the-guild-smart-contracts | |
| forge test --verbosity | |
| - name: Run tests with gas reporting | |
| run: | | |
| cd the-guild-smart-contracts | |
| forge test --gas-report |