-
Notifications
You must be signed in to change notification settings - Fork 209
/
Copy pathconfig.yml
146 lines (137 loc) · 4.09 KB
/
config.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
142
143
144
145
146
version: 2.1
orbs:
node: circleci/node@5.0.0
slack: circleci/slack@4.4.2
browser-tools: circleci/browser-tools@1.5.1
gh-pages: sugarshin/gh-pages@1.0.0
parameters:
ubuntu_machine:
type: string
default: 'ubuntu-2004:202111-02'
ubuntu_docker:
type: string
default: 'ubuntu:focal'
workflows:
circleci_build_and_test:
jobs:
- ESLint
- prettier
- compile_test
- build_and_test:
name: build_and_test_<< matrix.browser >>
context: slack-secrets
matrix:
parameters:
browser: ['node', 'chrome', 'firefox']
- generate_docs:
requires:
- ESLint
- prettier
- compile_test
- build_and_test
filters:
branches:
only:
- master
jobs:
ESLint:
docker:
- image: << pipeline.parameters.ubuntu_docker >>
steps:
- checkout
- install_dependencies
- run: npm run lint
prettier:
docker:
- image: << pipeline.parameters.ubuntu_docker >>
steps:
- checkout
- install_dependencies
- run: npx prettier --check .
compile_test:
docker:
- image: << pipeline.parameters.ubuntu_docker >>
steps:
- checkout
- install_dependencies
- run:
name: Compile test
command: |
npm run build
npx tsc -p tests/compile
build_and_test:
parameters:
browser:
type: string
machine:
image: << pipeline.parameters.ubuntu_machine >>
resource_class: medium
steps:
- checkout
- install_dependencies:
sudo: 'sudo'
browser: << parameters.browser >>
- run:
name: Install docker
command: |
export SUDO=sudo
$SUDO apt update
if [ "<< parameters.browser >>" == "chrome" ]; then $SUDO apt -y install google-chrome-stable; else echo "skipping chrome install" ; fi
$SUDO apt -y install ca-certificates curl gnupg lsb-release
$SUDO curl -fsSL https://download.docker.com/linux/ubuntu/gpg | $SUDO gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$SUDO echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | $SUDO tee /etc/apt/sources.list.d/docker.list > /dev/null
$SUDO apt update
$SUDO apt -y install docker-ce docker-ce-cli containerd.io
- when:
condition:
not:
equal: ['node', << parameters.browser >>]
steps:
browser-tools/install-browser-tools:
replace-existing-chrome: true
- run:
name: << parameters.browser >> test
command: |
if [ "<< parameters.browser >>" == "node" ]; then unset TEST_BROWSER; else export TEST_BROWSER=<< parameters.browser >> ; fi
npm test
make docker-test
generate_docs:
docker:
- image: << pipeline.parameters.ubuntu_docker >>
steps:
- checkout
- install_dependencies
- run:
name: Generate docs for GitHub Pages
command: |
rm -rf docs
npm run docs
touch docs/.nojekyll
- gh-pages/deploy:
ssh-fingerprints: '67:e9:d0:1a:e5:98:06:4d:fc:68:32:02:8e:ea:36:3a'
build-dir: docs
commit-message: 'Automated docs update'
commands:
install_dependencies:
parameters:
sudo:
type: string
default: ''
browser:
type: string
default: ''
steps:
- run:
name: Install Dependencies
command: |
<< parameters.sudo >> apt -y update
<< parameters.sudo >> apt -y install curl make git build-essential jq unzip
- node/install:
node-version: '18'
- run:
name: npm ci
command: |
set -e
npm ci
if [ "<< parameters.browser >>" == "chrome" ]; then npm install chromedriver@latest; fi