-
Notifications
You must be signed in to change notification settings - Fork 179
124 lines (109 loc) · 3.79 KB
/
tests-karma-dashboard.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
name: Dashboard Integration Tests
on:
push:
# Only run if dashboard-related files changed.
paths:
- 'assets/src/dashboard/**.js'
- 'babel.config.cjs'
- 'karma-dashboard.config.cjs'
- 'webpack.config.cjs'
- 'webpack.config.test.cjs'
- 'packages/**/*.js'
- '**/package.json'
- 'package-lock.json'
- '__static__/**'
branches:
- main
- release/*
pull_request:
# Only run if dashboard-related files changed.
paths:
- 'assets/src/dashboard/**.js'
- 'babel.config.cjs'
- 'karma-dashboard.config.cjs'
- 'webpack.config.cjs'
- 'webpack.config.test.cjs'
- 'packages/**/*.js'
- '**/package.json'
- 'package-lock.json'
- '__static__/**'
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
karma:
name: Karma
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Setup Node
uses: actions/setup-node@v2.2.0
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
cache: npm
# TODO: Remove need for `npm install puppeteer`.
- name: Install dependencies
run: |
npm ci
npm install puppeteer
env:
CI: true
PUPPETEER_PRODUCT: chrome
# FIXME: https://github.com/google/web-stories-wp/issues/4364
- name: Increase max number of file watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Run integration tests
run: npm run test:karma:dashboard -- --headless --viewport=1600:1000 --coverage || npm run test:karma:dashboard:retry-failed -- --headless --viewport=1600:1000
env:
DISABLE_ERROR_BOUNDARIES: true
- name: Upload code coverage report
uses: codecov/codecov-action@v1
with:
file: build/logs/karma-coverage/dashboard/lcov.info
flags: karmatests
- name: Upload CUJ coverage
uses: actions/upload-artifact@v2
with:
name: cuj-coverage-dashboard
path: build/cuj-coverage-dashboard.md
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
deploy-cuj-coverage:
name: Deploy CUJ Coverage
needs: [karma]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: gh-pages
- name: Download coverage file
uses: actions/download-artifact@v2
with:
name: cuj-coverage-dashboard
- name: Move file
run: |
mkdir -p critical-user-journeys
rm -rf critical-user-journeys/dashboard.md
mv cuj-coverage-dashboard.md critical-user-journeys/dashboard.md
- name: Commit updates
run: |
git add .
git status
git diff --staged --quiet && echo 'No changes to commit; exiting!' && exit 0
git commit -m "Deploy CUJ coverage for ${{ github.sha }}"
git pull --no-edit --quiet
git push origin gh-pages
env:
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_COMMITTER_NAME: ${{ github.actor }}