Upgrade dependencies and local dev setup #29
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 | |
| defaults: | |
| run: | |
| working-directory: server | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| cache-dependency-path: server/yarn.lock | |
| - name: Install server dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run server lint | |
| run: yarn lint | |
| - name: Run server unit tests | |
| run: yarn test | |
| client: | |
| name: Client lint and unit tests | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18.18.2 | |
| cache: yarn | |
| cache-dependency-path: client/yarn.lock | |
| - name: Install client dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run client lint | |
| run: yarn lint | |
| - name: Run client unit tests | |
| run: CI=true yarn test --watchAll=false --passWithNoTests | |
| 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: 18.18.2 | |
| cache: yarn | |
| cache-dependency-path: client/yarn.lock | |
| - name: Install client dependencies | |
| working-directory: client | |
| run: yarn install --frozen-lockfile | |
| - name: Start client | |
| working-directory: client | |
| run: BROWSER=none yarn start > ../client.log 2>&1 & | |
| - name: Set up Node for server and Cypress | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| cache-dependency-path: | | |
| yarn.lock | |
| server/yarn.lock | |
| - name: Install root dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Install server dependencies | |
| working-directory: server | |
| run: yarn install --frozen-lockfile | |
| - name: Start backing services | |
| run: docker compose up -d | |
| - name: Start server | |
| working-directory: server | |
| run: LETSCUBE_TEST_AUTH=true node index.js > ../server.log 2>&1 & | |
| - name: Start socket server | |
| working-directory: server | |
| run: 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 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 ps || true |