This repository was archived by the owner on Dec 10, 2025. It is now read-only.
forked from homebridge/node-pty-prebuilt-multiarch
-
Notifications
You must be signed in to change notification settings - Fork 5
170 lines (147 loc) · 5.53 KB
/
Copy pathprebuild.yml
File metadata and controls
170 lines (147 loc) · 5.53 KB
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
name: "Prebuild"
on:
workflow_call:
inputs:
ref:
required: true
description: The SHA ref of the commit to check out
type: string
default: ${{ github.head_ref || github.ref }}
repository:
required: true
description: The fully qualified name of the repository to check out the commit from
type: string
default: ${{ github.repository }}
prebuild_count:
required: true
description: How many prebuilt versions are expected to be generated
type: number
node_version:
required: false
description: Version of Node to use for setup-node
type: string
default: lts/*
permissions:
contents: read
jobs:
prebuild:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name:
[
alpine-x86_64,
alpine-arm32v6,
alpine-arm64v8,
debian-x86_64,
debian-i386,
debian-arm32v6,
debian-arm64v8,
darwin-x86_64,
darwin-arm64,
windows-x86_64,
]
include:
- name: alpine-x86_64
os: ubuntu-latest
BASE_IMAGE: library/node:16-alpine
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: x86_64
- name: alpine-arm32v6
os: ubuntu-latest
BASE_IMAGE: arm32v6/node:16-alpine
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: arm
- name: alpine-arm64v8
os: ubuntu-latest
BASE_IMAGE: arm64v8/node:16-alpine
DOCKERFILE: Dockerfile.alpine
QEMU_ARCH: aarch64
- name: debian-x86_64
os: ubuntu-latest
BASE_IMAGE: library/debian:bullseye-slim
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: x86_64
- name: debian-i386
os: ubuntu-latest
BASE_IMAGE: i386/debian:bullseye-slim
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: i386
- name: debian-arm32v6
os: ubuntu-latest
BASE_IMAGE: balenalib/raspberrypi3-debian:bullseye
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: arm
- name: debian-arm64v8
os: ubuntu-latest
BASE_IMAGE: arm64v8/debian:bullseye
DOCKERFILE: Dockerfile.debian
QEMU_ARCH: aarch64
PLATFORM: --platform=linux/arm64
- name: darwin-x86_64
os: macOS-latest
- name: darwin-arm64
# xlarge is arm64
# https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners#about-macos-larger-runners
os: macos-13-xlarge
- name: windows-x86_64
os: windows-2022
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ inputs.ref }}
repository: ${{ inputs.repository }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ inputs.node_version }}
- 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 ${{ matrix.DOCKERFILE }} - ${{ matrix.BASE_IMAGE }} - ${{ matrix.QEMU_ARCH }}
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 ${{ matrix.PLATFORM }} .
- name: Linux - Prebuild Binaries
if: runner.os == 'Linux'
run: |
docker run --rm -v $(pwd):/node-pty multiarch-build
- name: macOS - Setup Python
if: runner.os == 'macOS'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.11"
architecture: x64
- name: macOS - Prebuild Binaries
if: runner.os == 'macOS'
run: |
corepack enable # we use yarn
yarn install --ignore-scripts --ignore-engines
node .prebuild/buildify.js
- name: Windows - Prebuild Binaries
if: runner.os == 'Windows'
shell: bash
run: |
yarn install --ignore-scripts --ignore-engines
node .prebuild/buildify-windows.js
- name: "Check file existence"
id: check_files
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
with:
files: "prebuilds/*/node*node"
fail: ${{ runner.os != 'Windows' }}
- 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}"
if [ "$fileCount" -ne ${{ inputs.prebuild_count }} ]; then echo "::warning::Release NPM Prebuild count ${fileCount}, expected ${{ inputs.prebuild_count }}"; else echo "::notice::Release NPM Prebuild count ${fileCount}, expected ${{ inputs.prebuild_count }}"; fi
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ matrix.name }}
path: prebuilds
include-hidden-files: true