Skip to content

Commit 5941044

Browse files
authored
[Build] Build ARM64 for deb and rpm (#1285)
* [Build] Build ARM64 for deb and rpm Build ARM64 for deb with the following commands: yarn build --deb-arm --skip-archives yarn build --deb-arm --skip-archives --release Build ARM64 for rpm with the following commands: yarn build --rpm-arm --skip-archives yarn build --rpm-arm --skip-archives --release Issue partially resolved: #1259 Signed-off-by: Kawika Avilla <[email protected]>
1 parent 7cb8297 commit 5941044

13 files changed

+342
-11
lines changed

DEVELOPER_GUIDE.md

+31-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ access it.
7474

7575
### Building the artifacts
7676

77-
To build the artifacts for all supported platforms, run the following:
77+
To build the artifacts for all supported platforms, run the following:
7878

7979
```
8080
yarn build --skip-os-packages
@@ -86,7 +86,36 @@ If you want to build a specific platform, pass the platform flag after `yarn bui
8686
yarn build-platform --darwin
8787
```
8888

89-
You could pass one or multiple flags. If you don't pass any flag, `yarn build-platform` will use your local environment. Currenly we only support `darwin` (darwin x64), `linux` (linux x64) and `linux-arm` (linux arm64).
89+
You could pass one or multiple flags. If you don't pass any flag, `yarn build-platform` will build an artifact based on your local environment.
90+
91+
Currently, the supported flags for this script are:
92+
* `darwin` (builds Darwin x64)
93+
* `linux` (builds Linux x64)
94+
* `linux-arm` (builds Linux ARM64).
95+
96+
If you would like to build only a DEB x64 artifact, run the following:
97+
98+
```
99+
yarn build --deb --skip-archives
100+
```
101+
102+
If you would like to build only a DEB ARM64 artifact, run the following:
103+
104+
```
105+
yarn build --deb-arm --skip-archives
106+
```
107+
108+
If you would like to build only a RPM x64 artifact, run the following:
109+
110+
```
111+
yarn build --rpm --skip-archives
112+
```
113+
114+
If you would like to build only a RPM ARM64 artifact, run the following:
115+
116+
```
117+
yarn build --rpm-arm --skip-archives
118+
```
90119

91120
### Building the Docker Image
92121

src/dev/build/args.test.ts

+18
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ it('build dist for current platform, without packages, by default', () => {
4646
Object {
4747
"buildOptions": Object {
4848
"createArchives": true,
49+
"createDebArmPackage": false,
4950
"createDebPackage": false,
5051
"createDockerPackage": false,
5152
"createDockerUbiPackage": false,
53+
"createRpmArmPackage": false,
5254
"createRpmPackage": false,
5355
"downloadFreshNode": true,
5456
"isRelease": false,
@@ -72,9 +74,11 @@ it('build dist for linux x64 platform, without packages, if --linux is passed',
7274
Object {
7375
"buildOptions": Object {
7476
"createArchives": true,
77+
"createDebArmPackage": false,
7578
"createDebPackage": false,
7679
"createDockerPackage": false,
7780
"createDockerUbiPackage": false,
81+
"createRpmArmPackage": false,
7882
"createRpmPackage": false,
7983
"downloadFreshNode": true,
8084
"isRelease": false,
@@ -98,9 +102,11 @@ it('build dist for linux arm64 platform, without packages, if --linux-arm is pas
98102
Object {
99103
"buildOptions": Object {
100104
"createArchives": true,
105+
"createDebArmPackage": false,
101106
"createDebPackage": false,
102107
"createDockerPackage": false,
103108
"createDockerUbiPackage": false,
109+
"createRpmArmPackage": false,
104110
"createRpmPackage": false,
105111
"downloadFreshNode": true,
106112
"isRelease": false,
@@ -124,9 +130,11 @@ it('build dist for darwin x64 platform, without packages, if --darwin is passed'
124130
Object {
125131
"buildOptions": Object {
126132
"createArchives": true,
133+
"createDebArmPackage": false,
127134
"createDebPackage": false,
128135
"createDockerPackage": false,
129136
"createDockerUbiPackage": false,
137+
"createRpmArmPackage": false,
130138
"createRpmPackage": false,
131139
"downloadFreshNode": true,
132140
"isRelease": false,
@@ -150,9 +158,11 @@ it('builds packages if --all-platforms is passed', () => {
150158
Object {
151159
"buildOptions": Object {
152160
"createArchives": true,
161+
"createDebArmPackage": true,
153162
"createDebPackage": true,
154163
"createDockerPackage": true,
155164
"createDockerUbiPackage": true,
165+
"createRpmArmPackage": true,
156166
"createRpmPackage": true,
157167
"downloadFreshNode": true,
158168
"isRelease": false,
@@ -176,9 +186,11 @@ it('limits packages if --rpm passed with --all-platforms', () => {
176186
Object {
177187
"buildOptions": Object {
178188
"createArchives": true,
189+
"createDebArmPackage": false,
179190
"createDebPackage": false,
180191
"createDockerPackage": false,
181192
"createDockerUbiPackage": false,
193+
"createRpmArmPackage": false,
182194
"createRpmPackage": true,
183195
"downloadFreshNode": true,
184196
"isRelease": false,
@@ -202,9 +214,11 @@ it('limits packages if --deb passed with --all-platforms', () => {
202214
Object {
203215
"buildOptions": Object {
204216
"createArchives": true,
217+
"createDebArmPackage": false,
205218
"createDebPackage": true,
206219
"createDockerPackage": false,
207220
"createDockerUbiPackage": false,
221+
"createRpmArmPackage": false,
208222
"createRpmPackage": false,
209223
"downloadFreshNode": true,
210224
"isRelease": false,
@@ -229,9 +243,11 @@ it('limits packages if --docker passed with --all-platforms', () => {
229243
Object {
230244
"buildOptions": Object {
231245
"createArchives": true,
246+
"createDebArmPackage": false,
232247
"createDebPackage": false,
233248
"createDockerPackage": true,
234249
"createDockerUbiPackage": true,
250+
"createRpmArmPackage": false,
235251
"createRpmPackage": false,
236252
"downloadFreshNode": true,
237253
"isRelease": false,
@@ -256,9 +272,11 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform
256272
Object {
257273
"buildOptions": Object {
258274
"createArchives": true,
275+
"createDebArmPackage": false,
259276
"createDebPackage": false,
260277
"createDockerPackage": true,
261278
"createDockerUbiPackage": false,
279+
"createRpmArmPackage": false,
262280
"createRpmPackage": false,
263281
"downloadFreshNode": true,
264282
"isRelease": false,

src/dev/build/args.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export function readCliArgs(argv: string[]) {
3737
'skip-archives',
3838
'skip-os-packages',
3939
'rpm',
40+
'rpm-arm',
4041
'deb',
42+
'deb-arm',
4143
'docker',
4244
'skip-docker-ubi',
4345
'release',
@@ -61,7 +63,9 @@ export function readCliArgs(argv: string[]) {
6163
default: {
6264
debug: true,
6365
rpm: null,
66+
'rpm-arm': null,
6467
deb: null,
68+
'deb-arm': null,
6569
docker: null,
6670
'version-qualifier': '',
6771
},
@@ -98,7 +102,13 @@ export function readCliArgs(argv: string[]) {
98102
}
99103

100104
// build all if no flags specified
101-
if (flags.rpm === null && flags.deb === null && flags.docker === null) {
105+
if (
106+
flags.rpm === null &&
107+
flags['rpm-arm'] === null &&
108+
flags.deb === null &&
109+
flags['deb-arm'] === null &&
110+
flags.docker === null
111+
) {
102112
return true;
103113
}
104114

@@ -111,7 +121,9 @@ export function readCliArgs(argv: string[]) {
111121
downloadFreshNode: !Boolean(flags['skip-node-download']),
112122
createArchives: !Boolean(flags['skip-archives']),
113123
createRpmPackage: isOsPackageDesired('rpm'),
124+
createRpmArmPackage: isOsPackageDesired('rpm-arm'),
114125
createDebPackage: isOsPackageDesired('deb'),
126+
createDebArmPackage: isOsPackageDesired('deb-arm'),
115127
createDockerPackage: isOsPackageDesired('docker'),
116128
createDockerUbiPackage: isOsPackageDesired('docker') && !Boolean(flags['skip-docker-ubi']),
117129
targetPlatforms: {

src/dev/build/build_distributables.ts

+10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export interface BuildOptions {
3535
downloadFreshNode: boolean;
3636
createArchives: boolean;
3737
createRpmPackage: boolean;
38+
createRpmArmPackage: boolean;
3839
createDebPackage: boolean;
40+
createDebArmPackage: boolean;
3941
createDockerPackage: boolean;
4042
createDockerUbiPackage: boolean;
4143
versionQualifier: string | undefined;
@@ -107,10 +109,18 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions
107109
// control w/ --deb or --skip-os-packages
108110
await run(Tasks.CreateDebPackage);
109111
}
112+
if (options.createDebArmPackage) {
113+
// control w/ --deb-arm or --skip-os-packages
114+
await run(Tasks.CreateDebArmPackage);
115+
}
110116
if (options.createRpmPackage) {
111117
// control w/ --rpm or --skip-os-packages
112118
await run(Tasks.CreateRpmPackage);
113119
}
120+
if (options.createRpmArmPackage) {
121+
// control w/ --rpm-arm or --skip-os-packages
122+
await run(Tasks.CreateRpmArmPackage);
123+
}
114124
if (options.createDockerPackage) {
115125
// control w/ --docker or --skip-docker-ubi or --skip-os-packages
116126
await run(Tasks.CreateDockerPackage);

src/dev/build/lib/runner.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ const setup = async () => {
6969
isRelease: true,
7070
targetAllPlatforms: true,
7171
versionQualifier: '-SNAPSHOT',
72+
targetPlatforms: {
73+
linux: false,
74+
linuxArm: false,
75+
darwin: false,
76+
},
7277
});
7378

7479
const run = createRunner({

src/dev/build/tasks/nodejs/download_node_builds_task.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ async function setup({ failOnUrl }: { failOnUrl?: string } = {}) {
5858
const config = await Config.create({
5959
isRelease: true,
6060
targetAllPlatforms: true,
61+
targetPlatforms: {
62+
linux: false,
63+
linuxArm: false,
64+
darwin: false,
65+
},
6166
});
6267

6368
getNodeDownloadInfo.mockImplementation((_: Config, platform: Platform) => {

src/dev/build/tasks/nodejs/extract_node_builds_task.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ async function setup() {
6262
const config = await Config.create({
6363
isRelease: true,
6464
targetAllPlatforms: true,
65+
targetPlatforms: {
66+
linux: false,
67+
linuxArm: false,
68+
darwin: false,
69+
},
6570
});
6671

6772
return { config };

src/dev/build/tasks/nodejs/verify_existing_node_builds_task.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ async function setup(actualShaSums?: Record<string, string>) {
6767
const config = await Config.create({
6868
isRelease: true,
6969
targetAllPlatforms: true,
70+
targetPlatforms: {
71+
linux: false,
72+
linuxArm: false,
73+
darwin: false,
74+
},
7075
});
7176

7277
getNodeShasums.mockReturnValue(

0 commit comments

Comments
 (0)