-
Notifications
You must be signed in to change notification settings - Fork 45
141 lines (134 loc) · 4.28 KB
/
ci-test.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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge.
name: ci-test
# Trigger the workflow when:
on:
# A push occurs to one of the matched branches.
push:
branches:
- master
- stable/*
# Or when a pull request event occurs for a pull request against one of the
# matched branches.
pull_request:
branches:
- master
- stable/*
# Explicitly disable secrets.GITHUB_TOKEN permissions.
permissions: {}
jobs:
yarn_cache:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
id: yarn-cache
with:
node-version: 18
cache: yarn
- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
jest:
# NOTE: This name appears in GitHub's Checks API.
name: jest
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: yarn test --coverage
- name: 'Upload coverage report'
uses: actions/upload-artifact@v3
with:
name: jest-coverage
path: coverage
retention-days: 5
playwright:
# NOTE: This name appears in GitHub's Checks API.
name: playwright
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: REACT_APP_E2E_TEST=1 yarn build:ext
- run: REACT_APP_E2E_TEST=1 yarn start:prod &
- name: Install playwright's npm dependencies
working-directory: ./playwright/
run: yarn install --frozen-lockfile
- name: Install playwright's system dependencies
working-directory: ./playwright/
run: npx playwright install --with-deps
- run: npx wait-on http://localhost:5000/ --timeout 60000
- name: Run playwright tests (with xvfb-run to support headed extension test)
working-directory: ./playwright/
run: BASE_URL=http://localhost:5000 EXTENSION_PATH=../build-ext/ xvfb-run yarn test
- name: 'Upload playwright test-results'
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: playwright-test-results
path: playwright/test-results
retention-days: 5
cypress:
# NOTE: This name appears in GitHub's Checks API.
name: cypress
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: docker-compose pull
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- run: REACT_APP_LOCALNET=1 REACT_APP_BACKEND=oasismonitor yarn start &
- run: docker-compose up --build -d
- run: npx wait-on http://localhost:3000/ --timeout 60000
- run: yarn cypress:run
- name: 'Upload coverage report'
uses: actions/upload-artifact@v3
with:
name: cypress-coverage
path: cypress-coverage
retention-days: 5
upload-coverage:
# NOTE: This name appears in GitHub's Checks API.
name: coverage
needs: [cypress, jest]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download coverage reports
uses: actions/download-artifact@v3
- uses: codecov/codecov-action@v3
with:
files: ./jest-coverage/coverage-final.json
flags: jest
- uses: codecov/codecov-action@v3
with:
files: ./cypress-coverage/coverage-final.json
flags: cypress