forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (108 loc) · 3.37 KB
/
cypress.yml
File metadata and controls
128 lines (108 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Cypress
on:
push:
branches-ignore:
- 'renovate/**'
pull_request:
jobs:
build-client:
name: Build
runs-on: ubuntu-18.04
steps:
- name: Checkout Source Files
uses: actions/checkout@v2
- name: Checkout client-config
uses: actions/checkout@v2
with:
repository: freeCodeCamp/client-config
path: client-config
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: 'npm'
- name: Set freeCodeCamp Environment Variables
run: cp sample.env .env
- name: Install and Build
run: |
npm ci
npm run build
- name: Move serve.json to Public Folder
run: cp client-config/serve.json client/public/serve.json
# We tar them for performance reasons - uploading a lot of files is slow.
- name: Tar Files
run: tar -cf client-artifact.tar client/public
- name: Upload Client Artifact
uses: actions/upload-artifact@v2
with:
name: client-artifact
path: client-artifact.tar
- name: Upload Webpack Stats
uses: actions/upload-artifact@v2
with:
name: webpack-stats
path: client/public/stats.json
cypress-run:
name: Test
runs-on: ubuntu-18.04
needs: build-client
strategy:
matrix:
browsers: [chrome, firefox, electron]
node-version: [14.x]
include:
- browsers: electron
spec: cypress/integration/learn/challenges/projects.js
services:
mongodb:
image: mongo:3.6.19
ports:
- 27017:27017
# We need mailhog to catch any emails the api tries to send.
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025
steps:
# We use .npmrc to set the default version to 0, and prevents download during development.
# This installs it specifically in the CI runs.
- name: Set Action Environment Variables
run: |
echo "CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "CYPRESS_INSTALL_BINARY=7.7.0" >> $GITHUB_ENV
- name: Checkout Source Files
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: client-artifact
- name: Unpack Client Artifact
run: |
tar -xf client-artifact.tar
rm client-artifact.tar
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Set freeCodeCamp Environment Variables
run: cp sample.env .env
- name: Install and Build
run: |
npm ci
npm run ensure-env
npm run build:curriculum
npm run build:server
- name: Seed Database
run: npm run seed
- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: ${{ env.CYPRESS_RECORD_KEY != 0 }}
start: npm run start-ci
wait-on: http://localhost:8000
wait-on-timeout: 1200
config: baseUrl=http://localhost:8000
browser: ${{ matrix.browsers }}
headless: true
spec: ${{ matrix.spec }}