Stabilize room host ownership across rejoins #90
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: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| server: | |
| name: Server lint and unit tests | |
| runs-on: ubuntu-latest | |
| env: | |
| PGHOST: 127.0.0.1 | |
| PGPORT: 5432 | |
| PGDATABASE: letscube | |
| PGUSER: letscube | |
| PGPASSWORD: letscube | |
| services: | |
| postgres: | |
| image: postgres:17-alpine | |
| env: | |
| POSTGRES_DB: letscube | |
| POSTGRES_USER: letscube | |
| POSTGRES_PASSWORD: letscube | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U letscube -d letscube" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.17.0 | |
| cache: yarn | |
| cache-dependency-path: yarn.lock | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Validate Prisma schema | |
| run: yarn workspace letscube-server postgres:schema:validate | |
| - name: Apply PostgreSQL migrations | |
| run: yarn workspace letscube-server postgres:migrate | |
| - name: Check PostgreSQL schema drift | |
| run: yarn workspace letscube-server postgres:schema:check | |
| - name: Run server lint | |
| run: yarn turbo run lint --filter=letscube-server | |
| - name: Run server unit tests | |
| run: yarn turbo run test:ci --filter=letscube-server | |
| client: | |
| name: Client lint and unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.17.0 | |
| cache: yarn | |
| cache-dependency-path: yarn.lock | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run client lint | |
| run: yarn turbo run lint --filter=letscube-client | |
| - name: Run client unit tests | |
| run: yarn turbo run test:ci --filter=letscube-client | |
| cypress: | |
| name: Cypress full-stack smoke | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node for client | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.17.0 | |
| cache: yarn | |
| cache-dependency-path: yarn.lock | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Start client | |
| run: BROWSER=none yarn workspace letscube-client start > client.log 2>&1 & | |
| - name: Set up Node for server and Cypress | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.17.0 | |
| - name: Start backing services | |
| run: docker compose -f compose.yml -f compose.dev.yml up -d mongo redis | |
| - name: Start server | |
| run: LETSCUBE_TEST_AUTH=true yarn workspace letscube-server node index.js > server.log 2>&1 & | |
| - name: Start socket server | |
| run: yarn workspace letscube-server node socket/ > socket.log 2>&1 & | |
| - name: Wait for local stack | |
| run: | | |
| for url in \ | |
| http://localhost:3000/ \ | |
| http://localhost:8080/api/announcements \ | |
| "http://localhost:9000/socket.io/?EIO=4&transport=polling" | |
| do | |
| for i in {1..60}; do | |
| if curl --fail --silent --output /dev/null "$url"; then | |
| break | |
| fi | |
| if [ "$i" -eq 60 ]; then | |
| echo "Timed out waiting for $url" | |
| echo "--- client.log" | |
| cat client.log || true | |
| echo "--- server.log" | |
| cat server.log || true | |
| echo "--- socket.log" | |
| cat socket.log || true | |
| docker compose -f compose.yml -f compose.dev.yml ps | |
| exit 1 | |
| fi | |
| sleep 2 | |
| done | |
| done | |
| - name: Run Cypress | |
| run: yarn cypress:run | |
| - name: Print app logs on failure | |
| if: failure() | |
| run: | | |
| echo "--- client.log" | |
| cat client.log || true | |
| echo "--- server.log" | |
| cat server.log || true | |
| echo "--- socket.log" | |
| cat socket.log || true | |
| docker compose -f compose.yml -f compose.dev.yml ps || true |