forked from microsoft/node-pty
-
Notifications
You must be signed in to change notification settings - Fork 16
195 lines (170 loc) · 6.53 KB
/
prebuild.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
name: "Prebuild node-gyp and package for a GitHub Release"
run-name: Package against ${{ github.event.inputs.tag }}
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: [
darwin-x64,
linux-arm,
linux-arm64,
linux-ia32,
linux-x64,
linuxmusl-arm,
linuxmusl-arm64,
linuxmusl-x64,
win32-ia32,
win32-x64
]
include:
- name: linuxmusl-x64
os: ubuntu-latest
BASE_IMAGE: library/node:16-alpine
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: x86_64
COUNT: 25
NPMCOUNT: 11
- name: linuxmusl-arm
os: ubuntu-latest
BASE_IMAGE: arm32v6/node:16-alpine
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: arm
COUNT: 25
NPMCOUNT: 11
- name: linuxmusl-arm64
os: ubuntu-latest
BASE_IMAGE: arm64v8/node:16-alpine
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: aarch64
COUNT: 25
NPMCOUNT: 11
- name: linux-x64
os: ubuntu-latest
BASE_IMAGE: library/debian:11.7-slim
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: x86_64
COUNT: 25
NPMCOUNT: 11
- name: linux-ia32
os: ubuntu-latest
BASE_IMAGE: i386/debian:11.7-slim
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: i386
COUNT: 23
NPMCOUNT: 11
- name: linux-arm
os: ubuntu-latest
BASE_IMAGE: balenalib/raspberry-pi-debian:bullseye
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: arm
COUNT: 25
NPMCOUNT: 11
- name: linux-arm64
os: ubuntu-latest
BASE_IMAGE: arm64v8/debian:11.7-slim
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: aarch64
COUNT: 25
NPMCOUNT: 11
- name: darwin-x64
os: macOS-latest
COUNT: 25
NPMCOUNT: 11
- name: win32-ia32
os: windows-2019
arch: ia32
COUNT: 21
NPMCOUNT: 0
- name: win32-x64
os: windows-2019
arch: x64
COUNT: 25
NPMCOUNT: 0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Linux - Setup Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get --yes --no-install-recommends install binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static:register --reset
- name: Linux - Build Docker Image
if: runner.os == 'Linux'
run: |
docker build -f .prebuild/${{ matrix.DOCKERFILE }} --build-arg BASE_IMAGE=${{ matrix.BASE_IMAGE }} --build-arg QEMU_ARCH=${{ matrix.QEMU_ARCH }} -t multiarch-build .
- name: Linux - Prebuild Binaries
if: runner.os == 'Linux'
run: |
docker run --rm -v $(pwd):/node-pty multiarch-build
- name: macOS - Prebuild Binaries
if: runner.os == 'macOS'
run: |
npm ci --ignore-scripts
env JOBS=max node .prebuild/build.js
# buildify doesn't work on Mac due to missing spawn_helper
# env JOBS=max node .prebuild/buildify.js
- name: Windows ia32 - Prebuild Binaries
if: ${{ (runner.os == 'Windows') && (matrix.arch == 'ia32') }}
shell: bash
run: |
npm ci --ignore-scripts
env JOBS=max node_modules/.bin/prebuild -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0 -t 17.0.1 --include-regex "\.(node|exe|dll|pdb)" --arch ${{ matrix.arch }}
env JOBS=max node_modules/.bin/prebuild -t 5.0.0 -t 6.0.0 -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.2 -t 15.0.0 -t 16.0.0 -t 17.0.0 --include-regex "\.(node|exe|dll|pdb)" -r electron -a ${{ matrix.arch }}
- name: Windows x64 - Prebuild Binaries
if: ${{ (runner.os == 'Windows') && (matrix.arch == 'x64') }}
shell: bash
run: |
npm ci --ignore-scripts
env JOBS=max node_modules/.bin/prebuild -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.0 -t 15.0.0 -t 16.0.0 -t 17.0.1 -t 18.0.0 -t 20.0.0 -t 21.0.0 --include-regex "\.(node|exe|dll|pdb)" --arch ${{ matrix.arch }}
env JOBS=max node_modules/.bin/prebuild -t 5.0.0 -t 6.0.0 -t 7.0.0 -t 8.0.0 -t 9.0.0 -t 10.0.0 -t 11.0.0 -t 12.0.0 -t 13.0.0 -t 14.0.2 -t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0 --include-regex "\.(node|exe|dll|pdb)" -r electron --arch ${{ matrix.arch }}
- name: Check Release prebuilds exist
shell: bash
run: |
fileCount=$(ls prebuilds/*/node-pty*tar.gz | wc -l)
echo "Release Prebuild count ${fileCount}"
echo "::notice::Release Prebuild count ${fileCount}, expected ${{ matrix.COUNT }}"
if [ "$fileCount" -eq 0 ]; then exit 1; fi
if [ "$fileCount" -ne ${{ matrix.COUNT }} ]; then exit 1; fi
- uses: AButler/[email protected]
name: Upload Release Artifacts to ${{ github.event.inputs.tag }}
with:
files: 'prebuilds/*/node-pty*tar.gz'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.event.inputs.tag }}
- name: "Check file existence"
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "prebuilds/*/node*node"
- name: Check NPM prebuilds exist
if: steps.check_files.outputs.files_exists == 'true'
shell: bash
run: |
fileCount=$(ls prebuilds/*/node*node | wc -l)
echo "NPM Prebuild count ${fileCount}"
echo "::notice::NPM Prebuild count ${fileCount}, expected ${{ matrix.NPMCOUNT }}"
if [ "$fileCount" -eq 0 ]; then exit 1; fi
if [ "$fileCount" -ne ${{ matrix.NPMCOUNT }} ]; then exit 1; fi
- name: Pack NPM prebuilds
if: steps.check_files.outputs.files_exists == 'true'
shell: bash
run: |
tar -cvzf prebuilds.${{ matrix.NAME }}.tar.gz prebuilds/*/node*node
- uses: AButler/[email protected]
name: Upload NPM prebuilds to ${{ github.event.inputs.tag }}
if: steps.check_files.outputs.files_exists == 'true'
with:
files: 'prebuilds.*.tar.gz'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.event.inputs.tag }}