forked from JCMais/node-libcurl
-
Notifications
You must be signed in to change notification settings - Fork 7
260 lines (247 loc) · 8.29 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
## GitHub Actions is used to build:
## - Electron (macOs)
## - Nwjs (macOs)
## - Node.js (macOs, linux)
name: build-and-release
on:
push:
tags:
- '*'
branches:
- develop
env:
NODE_LIBCURL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# all jobs here must have a matrix identical to the ones inside build-lint-test.yaml
jobs:
scan:
permissions:
packages: write
contents: write # publish sbom to GH releases/tag assets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ github.repository }}
# Perform SCA analysis for the code repository
# Produces SBOM and CVE report
# Helps understand vulnerabilities / license compliance across third party dependencies
# Drift: Doesn't track any npm global or OS specific packages that involves scanning entire root file system.
# (TODO): Produce OS specific SBOM to detect build time depdencies.
- id: sca-project
uses: Kong/public-shared-actions/security-actions/sca@2f02738ecb1670f01391162e43fe3f5d4e7942a1 # v2.2.2
with:
dir: ${{ github.repository }}
upload-sbom-release-assets: true
build-and-release-nodejs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-13
- ubuntu-22.04
libcurl-release:
- 7.79.1
node-libcurl-cpp-std:
- c++17
node:
- 20.16.0
env:
LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
NODE_LIBCURL_CPP_STD: ${{ matrix.node-libcurl-cpp-std }}
steps:
- if: runner.os == 'macOS'
name: Install Needed packages on macOS
run: brew install coreutils wget automake libtool cmake gnu-sed m4 [email protected] groff
- if: runner.os == 'Linux'
name: Install Needed packages on Linux
run: sudo apt-get install -y cmake
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: package-lock.json
- 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 }}-fork
restore-keys: |
v4-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}-fork
- name: 'Set GIT_TAG'
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
run: |
pip install packaging
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG RUNNER_OS=${{ runner.os }} ./scripts/ci/build.sh
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.node }}
path: ./logs/
retention-days: 5
build-and-release-electron:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-13
- ubuntu-22.04
libcurl-release:
- 7.79.1
node:
- 20.16.0
electron-version:
- 31.4.0
env:
LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
ELECTRON_VERSION: ${{ matrix.electron-version }}
NODE_LIBCURL_CPP_STD: c++17
steps:
- if: runner.os == 'macOS'
name: Install Needed packages
run: brew install coreutils wget automake libtool cmake gnu-sed m4 [email protected] groff
- if: runner.os == 'Linux'
name: Install Needed packages on Linux
run: sudo apt-get install -y cmake
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: package-lock.json
- 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 }}-fork
restore-keys: |
v4-${{ runner.os }}-libcurl-deps-cache-electron-${{ matrix.electron-version }}-fork
- name: 'Set GIT_TAG'
if: startsWith(github.ref, 'refs/tags')
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Publish Binary'
run: |
pip install packaging
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
# Perform SCA analysis for the code repository
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.electron-version }}
path: ./logs/
retention-days: 5
build-and-release-nodejs-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
node:
- 20.16.0
env:
npm_config_msvs_version: 2022
npm_config_build_from_source: true
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: |
choco install nasm -y
$env:PATH=$env:PROGRAMFILES + "\NASM;" + $env:Path
python deps\curl-for-windows\configure.py
- name: Build
run: |
$env:PATH=$env:PROGRAMFILES + "\NASM;" + $env:Path
npm ci
- name: Test
run: |
npm run ts-node -e "console.log(require('./lib').Curl.getVersionInfoString())"
npm run test
if ($LASTEXITCODE -eq 0) {
$host.SetShouldExit(0)
}
- name: Publish binary
if: startsWith(github.ref, 'refs/tags/')
run: |
pip install packaging
npm run pregyp package testpackage --verbose
node scripts\module-packaging.js --publish $(npm run -s pregyp reveal staged_tarball --silent)
build-and-release-electron-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
node:
- 20.16.0
electron-version:
- 31.4.0
env:
ELECTRON_VERSION: ${{ matrix.electron-version }}
npm_config_msvs_version: 2022
npm_config_build_from_source: true
npm_config_runtime: 'electron'
npm_config_dist_url: 'https://electronjs.org/headers'
npm_config_target: ${{ matrix.electron-version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: |
choco install nasm -y
$env:PATH=$env:PROGRAMFILES + "\NASM;" + $env:Path
python deps\curl-for-windows\configure.py
npm i -g electron@${env:ELECTRON_VERSION}
- name: Build
run: |
$env:PATH=$env:PROGRAMFILES + "\NASM;" + $env:Path
npm ci
- name: Test
run: |
npm run test:electron
if ($LASTEXITCODE -eq 0) {
$host.SetShouldExit(0)
}
- name: Publish binary
if: startsWith(github.ref, 'refs/tags/')
run: |
pip install packaging
npm run pregyp package testpackage --verbose
node scripts\module-packaging.js --publish $(npm run -s pregyp reveal staged_tarball --silent)