2020-08-10 20:37:19 +00:00
|
|
|
name: Cypress
|
2020-04-29 10:50:14 +00:00
|
|
|
on:
|
|
|
|
push:
|
2020-04-30 09:33:00 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-08-08 20:11:56 +00:00
|
|
|
|
2020-04-21 08:11:20 +00:00
|
|
|
jobs:
|
|
|
|
cypress-run:
|
2020-08-10 20:37:19 +00:00
|
|
|
name: Test
|
2020-05-07 09:56:18 +00:00
|
|
|
env:
|
|
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2020-08-08 18:09:03 +00:00
|
|
|
# We use .npmrc to set the default version to 0, and prevents download during developement.
|
|
|
|
# This installs it specifically in the CI runs.
|
2020-07-30 09:26:49 +00:00
|
|
|
CYPRESS_INSTALL_BINARY: '4.11.0'
|
2020-07-27 12:36:58 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2020-09-14 07:07:00 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
browsers: [chrome, firefox]
|
2020-04-21 08:11:20 +00:00
|
|
|
services:
|
|
|
|
mongodb:
|
2020-08-08 18:09:03 +00:00
|
|
|
image: mongo:3.6.19
|
2020-04-21 08:11:20 +00:00
|
|
|
ports:
|
|
|
|
- 27017:27017
|
2020-08-08 18:09:03 +00:00
|
|
|
|
2020-04-21 08:11:20 +00:00
|
|
|
steps:
|
2020-08-08 18:09:03 +00:00
|
|
|
- name: Checkout Source Files
|
2020-06-09 20:17:13 +00:00
|
|
|
uses: actions/checkout@v2
|
2020-04-21 08:11:20 +00:00
|
|
|
|
2020-08-08 18:09:03 +00:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
|
|
|
|
- name: Set Environment variables
|
2020-04-21 08:11:20 +00:00
|
|
|
run: cp sample.env .env
|
2020-06-09 20:17:13 +00:00
|
|
|
|
2020-08-08 18:09:03 +00:00
|
|
|
- name: Install Dependencies
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
npm run ensure-env
|
|
|
|
|
|
|
|
- name: Seed Database
|
|
|
|
run: npm run seed
|
|
|
|
|
2020-04-21 08:11:20 +00:00
|
|
|
- name: Cypress run
|
|
|
|
uses: cypress-io/github-action@v1
|
|
|
|
with:
|
2020-05-07 09:56:18 +00:00
|
|
|
record: ${{ env.CYPRESS_RECORD_KEY != 0 }}
|
2020-04-21 08:11:20 +00:00
|
|
|
build: npm run build
|
2020-04-29 11:17:06 +00:00
|
|
|
# this should mirror the production build, but for now we're just using the dev
|
|
|
|
# server and gatsby serve instead (the npm script serve:client needs updating!)
|
2020-04-21 08:11:20 +00:00
|
|
|
start: npm start
|
|
|
|
wait-on: http://localhost:8000
|
2020-04-29 11:17:06 +00:00
|
|
|
# the site builds in about 8 minutes, so there is currently 12 minutes of time
|
|
|
|
# left for testing.
|
2020-04-21 08:11:20 +00:00
|
|
|
wait-on-timeout: 1200
|
|
|
|
config: baseUrl=http://localhost:8000
|
2020-09-14 07:07:00 +00:00
|
|
|
browser: ${{ matrix.browsers }}
|
|
|
|
headless: true
|