tutorbookapp/tutorbook

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Test

on:
  push:

env:
  NODE_ENV: test
  PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
  PERCY_PARALLEL_NONCE: ${{ github.run_id }}
  PERCY_PARALLEL_TOTAL: 10
  CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
  FIREBASE_ADMIN_CLIENT_EMAIL: ${{ secrets.FIREBASE_ADMIN_CLIENT_EMAIL }}
  FIREBASE_ADMIN_KEY: ${{ secrets.FIREBASE_ADMIN_KEY }}
  INTERCOM_KEY: ${{ secrets.INTERCOM_KEY }}
  REMIND_TOKEN: ${{ secrets.REMIND_TOKEN }}
  SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
  SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
  SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '12'
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cache/firebase/emulators
            ~/.cache/Cypress
            ~/.cache/yarn
            .next/cache
            node_modules
          key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
      - run: yarn install --immutable --immutable-cache
      - run: yarn build
      - uses: actions/upload-artifact@v2
        with:
          name: build
          path: |
            .next
            public/sw.js
  test:
    needs: build
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        browser: [chrome]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '12'
      - uses: actions/download-artifact@v2
        with:
          name: build
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cache/firebase/emulators
            ~/.cache/Cypress
            ~/.cache/yarn
            .next/cache
            node_modules
          key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
      - run: yarn install --immutable --immutable-cache
      - run: yarn start & yarn wait-on http-get://localhost:3000
      - run: yarn start:cy --record --parallel --headless --group ${{ matrix.browser }} -b ${{ matrix.browser }}
      - uses: codecov/codecov-action@v1
        if: ${{ success() || failure() }}