fix cypress test #494
This file contains 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] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2.1.4 | |
- uses: bahmutov/npm-install@v1 | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Run prettier check | |
run: npm run format:ci | |
- name: Run lint check | |
run: npm run lint | |
- name: Run typecheck | |
run: npm run typecheck | |
- name: Run unit tests | |
run: npm run test | |
cypress-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2.1.4 | |
- uses: bahmutov/npm-install@v1 | |
- name: nextjs cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }} | |
- name: Run build | |
run: npm run build:ci | |
- name: Start server | |
run: | | |
PORT=3000 npm run start & | |
sleep 5 && | |
curl http://localhost:3000/api/status -I | |
- name: Cypress run | |
uses: cypress-io/github-action@v5 | |
with: | |
record: true | |
quiet: true | |
# we have already installed all dependencies above | |
install: false | |
env: | |
DB_PATH: ./db/game.sqlite | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |