-
-
Notifications
You must be signed in to change notification settings - Fork 119
342 lines (332 loc) · 12.8 KB
/
build-and-release.yaml
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
## GitHub Actions is used to build:
## - Electron (macOs)
## - Nwjs (macOs)
## - Node.js (macOs, linux)
name: build-and-release
on:
push:
tags:
- '*'
branches:
- master
- develop
workflow_dispatch:
inputs:
publish-binary:
type: boolean
default: false
description: Publish binary?
required: true
env:
NODE_LIBCURL_GITHUB_TOKEN: ${{ secrets.NODE_LIBCURL_GITHUB_TOKEN }}
PUBLISH_BINARY: ${{ github.event.inputs.publish-binary }}
NODE_LIBCURL_CPP_STD: c++17
# all jobs here must have a matrix identical to the ones inside build-lint-test.yaml
jobs:
build-and-release-nodejs:
runs-on: ${{ matrix.os }}
container: ${{ matrix.os == 'ubuntu-18.04' && 'ubuntu:xenial' || '' }}
strategy:
fail-fast: false
matrix:
os:
- macos-11
- ubuntu-20.04
libcurl-release:
- 7.86.0
node:
- 18
- 20
- 21
- 22
env:
LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
steps:
- id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +%s)"
- name: Restore the previous run result
uses: actions/cache@v3
with:
path: |
run_result
key: v1-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.node }}-${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
v1-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.node }}-${{ github.run_id }}-${{ github.job }}-
- id: run_result
run: cat run_result 2>/dev/null || echo 'default'
- if: runner.os == 'Linux'
name: Install Needed packages on Linux
run: |
if ! command -v sudo; then
apt-get update && apt-get install -y sudo
else
sudo apt-get update
fi
if ! command -v cmake; then
sudo apt-get install -y cmake
fi
if ! command -v curl; then
# we will assume a lot of other ones are missing
sudo apt-get install -y software-properties-common
sudo apt-add-repository ppa:git-core/ppa && sudo apt-get update && sudo apt-get install -y git curl wget python autoconf libtool-bin m4 groff groff-base pkg-config automake bzip2 apt-transport-https ca-certificates
fi
if ! command -v yarn; then
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
sudo apt-get update && sudo apt-get install -y yarn
fi
- name: Checkout
uses: actions/checkout@main
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
if: matrix.node-libcurl-cpp-std
- if: runner.os == 'macOS'
name: Install Needed packages on macOS
run: brew install coreutils wget automake libtool cmake gnu-sed m4
# not using brew for that one as we need 2.69
- if: runner.os == 'macOS'
name: Install autoconf on macOS
run: |
curl -O -L http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar -xzf autoconf-2.69.tar.gz
cd autoconf-*
./configure
make
make install
autoconf --version
ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
- name: Output yarn cache dir
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore Yarn Cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: v1-${{ runner.os }}-yarn-cache-${{ github.ref }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
v1-${{ runner.os }}-yarn-cache-${{ github.ref }}-
v1-${{ runner.os }}-yarn-cache-
- name: Restore libcurl deps cache
uses: actions/cache@v3
id: libcurl-deps-cache
with:
path: |
~/.node-gyp
~/deps
key: v4-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}
restore-keys: |
v4-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}
- name: 'Set GIT_TAG'
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
if: steps.run_result.outputs.run_result != 'success'
run: |
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
- name: Upload artifacts
if: always() && steps.run_result.outputs.run_result != 'success'
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.node }}
path: ./logs/
retention-days: 5
- run: echo "::set-output name=run_result::success" > run_result
build-and-release-electron:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# we use CircleCI for linux binaries
os:
- macos-11
libcurl-release:
- 7.86.0
node:
- 20
electron-version:
- 33.2.1
- 32.2.6
- 31.7.5
- 27.1.3
- 26.6.2
- 28.0.0
- 27.1.3
- 26.6.2
env:
LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
ELECTRON_VERSION: ${{ matrix.electron-version }}
steps:
- id: timestamp
run: echo "::set-output name=timestamp::$(timestamp +%s)"
- name: Restore the previous run result
uses: actions/cache@v3
with:
path: |
run_result
key: v1-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.electron-version }}-${{ github.run_id }}-${{ runner.os }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
restore-keys: |
v1-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.electron-version }}-${{ github.run_id }}-${{ runner.os }}-${{ github.job }}-
- id: run_result
run: cat run_result 2>/dev/null || echo 'default'
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@main
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Install Needed packages
run: brew install coreutils wget automake libtool cmake gnu-sed m4
# not using brew for that one as we need 2.69
- name: Install autoconf
run: |
curl -O -L http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar -xzf autoconf-2.69.tar.gz
cd autoconf-*
./configure
make
make install
autoconf --version
ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
- name: Output yarn cache dir
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore Yarn Cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: v1-${{ runner.os }}-yarn-cache-${{ github.ref }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
v1-${{ runner.os }}-yarn-cache-${{ github.ref }}-
v1-${{ runner.os }}-yarn-cache-
- name: Restore Electron Cache
uses: actions/cache@v3
with:
path: ~/Library/Caches/electron
key: v1-${{ runner.os }}-electron-cache-${{ matrix.electron-version }}
restore-keys: |
v1-${{ runner.os }}-electron-cache-${{ matrix.electron-version }}
v1-${{ runner.os }}-electron-cache-
- name: Restore libcurl deps cache
uses: actions/cache@v3
id: libcurl-deps-cache
with:
path: |
~/.node-gyp
~/deps
key: v4-${{ runner.os }}-libcurl-deps-cache-electron-${{ matrix.electron-version }}
restore-keys: |
v4-${{ runner.os }}-libcurl-deps-cache-electron-${{ matrix.electron-version }}
- name: 'Set GIT_TAG'
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
if: steps.run_result.outputs.run_result != 'success'
run: |
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
- name: Upload artifacts
if: always() && steps.run_result.outputs.run_result != 'success'
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.electron-version }}
path: ./logs/
retention-days: 5
- run: echo "::set-output name=run_result::success" > run_result
# disabled until nwjs supports newer node-gyp versions + python 3
# build-and-release-nwjs:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# # we use CircleCI for linux binaries
# os:
# - macos-11
# libcurl-release:
# - 7.86.0
# node:
# - 18
# nwjs-version:
# - 0.69.1
# - 0.68.1
# - 0.67.1
# env:
# LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
# LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
# NWJS_VERSION: ${{ matrix.nwjs-version }}
# steps:
# - id: timestamp
# run: echo "::set-output name=timestamp::$(timestamp +%s)"
# - name: Restore the previous run result
# uses: actions/cache@v3
# with:
# path: |
# run_result
# key: v1-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.nwjs-version }}-${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
# restore-keys: |
# v1-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.nwjs-version }}-${{ github.run_id }}-${{ github.job }}-
# - id: run_result
# run: cat run_result 2>/dev/null || echo 'default'
# - run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
# - name: Checkout
# uses: actions/checkout@main
# - name: Setup Node.js
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node }}
# - name: Install Needed packages
# run: brew install coreutils wget automake libtool cmake gnu-sed m4
# # not using brew for that one as we need 2.69
# - name: Install autoconf
# run: |
# curl -O -L http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
# tar -xzf autoconf-2.69.tar.gz
# cd autoconf-*
# ./configure
# make
# make install
# autoconf --version
# ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
# - name: Output yarn cache dir
# id: yarn-cache-dir
# run: echo "::set-output name=dir::$(yarn cache dir)"
# - name: Restore Yarn Cache
# uses: actions/cache@v3
# id: yarn-cache
# with:
# path: ${{ steps.yarn-cache-dir.outputs.dir }}
# key: v1-${{ runner.os }}-yarn-cache-${{ github.ref }}-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# v1-${{ runner.os }}-yarn-cache-${{ github.ref }}-
# v1-${{ runner.os }}-yarn-cache-
# - name: Restore libcurl deps cache
# uses: actions/cache@v3
# id: libcurl-deps-cache
# with:
# path: |
# ~/.node-gyp
# ~/deps
# key: v4-${{ runner.os }}-libcurl-deps-cache-nwjs-${{ matrix.nwjs-version }}
# restore-keys: |
# v4-${{ runner.os }}-libcurl-deps-cache-nwjs-${{ matrix.nwjs-version }}
# - name: 'Set GIT_TAG'
# if: startsWith(github.ref, 'refs/tags')
# run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# - name: 'Publish Binary'
# if: steps.run_result.outputs.run_result != 'success'
# run: |
# GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
# - name: Upload artifacts
# if: always() && steps.run_result.outputs.run_result != 'success'
# uses: actions/upload-artifact@v4
# with:
# name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.nwjs-version }}
# path: ./logs/
# retention-days: 5
# - run: echo "::set-output name=run_result::success" > run_result