-
-
Notifications
You must be signed in to change notification settings - Fork 125
195 lines (162 loc) · 5.87 KB
/
main.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# https://stackoverflow.com/a/72408109/3443137
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
base:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version-file: ".nvmrc"
# https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
- name: Reuse npm cache folder
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# reuse the npm-cache and some node_modules folders
path: |
~/.npm
./node_modules
./test-electron/node_modules
# invalidate cache when any package.json changes
key: ${{ runner.os }}-npm-x3-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-npm-x3-${{ env.cache-name }}-
${{ runner.os }}-npm-x3-
${{ runner.os }}-
# install
- name: install node modules
run: npm install --legacy-peer-deps
- name: build
run: npm run build
- name: check build size webpack
run: npm run size:webpack
- name: check build size browserify
run: npm run size:browserify
- name: check build size rollup
run: npm run size:rollup
- name: code format
run: npm run lint
- name: test typings
run: npm run test:typings
- name: test modules
run: npm run test:modules
- name: test browser
uses: GabrielBB/xvfb-action@v1
with:
working-directory: ./ #optional
run: npm run test:browser
- name: test performance
run: npm run test:performance
- name: test e2e
uses: GabrielBB/xvfb-action@v1
with:
working-directory: ./ #optional
run: npm run test:e2e
# run the node test in an own task, so we can use a node-version matrix.
test-node:
runs-on: ubuntu-22.04
strategy:
matrix:
node: ['18.18.2', '20.9.0']
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
# https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
- name: Reuse npm cache folder
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
./node_modules
./test-electron/node_modules
# invalidate cache when any package.json changes
key: ${{ runner.os }}-npm-test-node-x3-${{ matrix.node }}-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-npm-test-node-x3-${{ matrix.node }}-${{ env.cache-name }}-
${{ runner.os }}-npm-test-node
${{ runner.os }}-test-node
- name: install node modules
run: npm install --legacy-peer-deps
- name: build
run: npm run build
- name: test node
run: npm run test:node
test-deno:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version-file: ".nvmrc"
# https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
- name: Reuse npm cache folder
uses: actions/cache@v3
env:
cache-name: cache-node-deno-modules
with:
path: |
~/.npm
./node_modules
./test-electron/node_modules
# invalidate cache when any package.json changes
key: ${{ runner.os }}-npm-test-deno-x3-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-npm-test-deno-x3-${{ env.cache-name }}-
${{ runner.os }}-npm-test-deno
${{ runner.os }}-test-deno
- name: install node modules
run: npm install --legacy-peer-deps
- name: build
run: npm run build
- name: Reuse deno cache folder
uses: actions/cache@v3
env:
cache-name: cache-deno-modules
with:
path: |
/home/runner/.cache/deno
# do not cache based on package.json because deno install randomly fails
# and it would then never succeed on the first run on dependency updateds
key: ${{ runner.os }}-deno-x3-
- uses: denoland/setup-deno@v1
with:
# https://github.com/denoland/deno/releases
deno-version: "1.37.2"
- name: run deno tests
run: |
sudo npm i -g cross-env
deno info
npm run test:deno
# TODO this does not work atm. fix this.
# - name: test electron
# uses: GabrielBB/xvfb-action@v1
# with:
# working-directory: ./test-electron
# run: npm install --depth 0 --silent && npm run test