-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (59 loc) · 2.35 KB
/
testing.yml
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Testing Yari
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.4
with:
node-version: "12"
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: cached-node_modules
with:
path: |
node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install all yarn packages
if: steps.cached-node_modules.outputs.cache-hit != 'true'
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
run: |
yarn --frozen-lockfile
- name: Lint prettier
run: yarn prettier-check
- name: Lint ESLint
run: yarn eslint
- name: Unit testing build
run: yarn test:build
- name: Unit testing client
run: yarn test:client
- name: Functional testing
env:
# Make this env var explicit for GitHub Actions because in local
# dev/debug you're encouraged to start it yourself in a separate
# terminal.
TESTING_START_SERVER: true
# Use local chrome installs since we skip downloading it as part
# of the yarn installs above
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
run: |
# Needed for the puppeteer tests that start a static Express server,
# but it starts it from within the testing/ path.
echo "CONTENT_ROOT=content/files" >> .env
# In terms of the --maxWorkers option, it's not yet clear which
# is best.
# See https://jestjs.io/docs/en/troubleshooting#tests-are-extremely-slow-on-docker-andor-continuous-integration-ci-server
# and https://www.peterbe.com/plog/ideal-number-of-workers-in-jest-maxWorkers
# CI tends to have fewer CPUs than laptops so let's stay conservative
# for now.
# Also note that `--runInBand` is the same as `--maxWorkers=1`
./testing/scripts/functional-test.sh --runInBand