-
Notifications
You must be signed in to change notification settings - Fork 8
214 lines (186 loc) · 5.68 KB
/
CI.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: CI
on:
pull_request:
push:
branches:
- master
jobs:
JS_BUILD:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies and build JS
run: |
npm install
npm run build.js
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
path: |
./*.js
./*.d.ts
NATIVE_Build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- macos-11.0
- windows-latest
node:
- 12
arch:
- x64
prebuild_cmd:
- npm run prebuild.native
docker:
- ""
include:
- os: windows-2016
node: 12
arch: x86
prebuild_cmd: npm run prebuild.native.ia32
- os: ubuntu-20.04
docker: node:12-alpine
arch: x64
apk: python3 make gcc g++ musl-dev
node: 12
prebuild_cmd: npm run prebuild.native
# - os: macos-11.0
# node: 15
# arch: arm64
# prebuild_cmd: npm run prebuild.native-arm64
name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.docker }}-${{ matrix.node }}
steps:
- uses: actions/checkout@v2
- name: Cache node_modules
uses: actions/cache@v2
env:
cache-name: node_modules
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node }}-${{ matrix.arch }}-${{ hashFiles('package.json') }}
- name: Install Docker
if: ${{ matrix.docker }}
run: |
docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
docker pull ${{ matrix.docker }}
docker tag ${{ matrix.docker }} builder
# - name: Install Compiler for Ubuntu 16.04
# if: ${{ contains(matrix.os, 'ubuntu-16.04') }}
# run: |
# sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
# sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-9 10
# sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10
# sudo update-alternatives --config clang
# sudo update-alternatives --config clang++
# - name: Set Compiler for Ubuntu
# run: |
# echo "CC=clang" >> $GITHUB_ENV
# echo "CXX=clang++" >> $GITHUB_ENV
- name: Install Node
if: ${{ !matrix.docker }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- name: Install dependencies
run: npm install --ignore-scripts
- name: Build native
if: ${{ !matrix.docker }}
run: npm run build.native
- name: Prebuildify
if: ${{ !matrix.docker }}
run: ${{ matrix.prebuild_cmd }}
- name: Prebuildify Docker
if: ${{ matrix.docker }}
run: docker run --volume ${{ github.workspace }}:/projectdir --workdir /projectdir --privileged builder sh -c "apk add --no-cache ${{ matrix.apk }} && ${{ matrix.prebuild_cmd }}"
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
path: ./prebuilds
Test:
needs: [NATIVE_Build, JS_BUILD]
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- macos-11.0
- windows-latest
node:
- 10
- 12
- 14
arch:
- x64
include:
- os: windows-2016
node: 12
arch: x86
- os: ubuntu-16.04
node: 12
- os: macos-10.15
node: 12
# Node arm64 doesn't exist yet
# - os: macos-11.0
# node: 15
# arch: arm64
steps:
- uses: actions/checkout@v2
- name: Cache node_modules
uses: actions/cache@v2
env:
cache-name: node_modules
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node }}-${{ matrix.arch }}-${{ hashFiles('package.json') }}
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- name: Install dependencies only
run: |
npm install --ignore-scripts
- name: Download articats
uses: actions/download-artifact@v4
- name: Install prebuilds
shell: bash
run: |
rm -rf build
mkdir prebuilds
mv ./artifact/*.js .
mv ./artifact/*.d.ts .
mv artifact/* prebuilds/
- name: Run tests
run: npm run test
- name: Run benchmarks
if: ${{ !contains(matrix.arch, 'x86') }} # https://github.com/npm/npm-lifecycle/issues/54
run: npm run benchmark
Lint:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Commit lint ✨
uses: wagoid/commitlint-github-action@v4
- name: Install dependencies
run: npm install
- name: Format ✨
run: npm run test.format
- name: Lint ✨
run: npm run test.lint