Skip to content

Commit

Permalink
[Build] Build ARM64 for deb and rpm (#1285)
Browse files Browse the repository at this point in the history
* [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 <kavilla414@gmail.com>
  • Loading branch information
kavilla authored Mar 2, 2022
1 parent 7cb8297 commit 5941044
Show file tree
Hide file tree
Showing 13 changed files with 342 additions and 11 deletions.
33 changes: 31 additions & 2 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ access it.

### Building the artifacts

To build the artifacts for all supported platforms, run the following:
To build the artifacts for all supported platforms, run the following:

```
yarn build --skip-os-packages
Expand All @@ -86,7 +86,36 @@ If you want to build a specific platform, pass the platform flag after `yarn bui
yarn build-platform --darwin
```

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).
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.

Currently, the supported flags for this script are:
* `darwin` (builds Darwin x64)
* `linux` (builds Linux x64)
* `linux-arm` (builds Linux ARM64).

If you would like to build only a DEB x64 artifact, run the following:

```
yarn build --deb --skip-archives
```

If you would like to build only a DEB ARM64 artifact, run the following:

```
yarn build --deb-arm --skip-archives
```

If you would like to build only a RPM x64 artifact, run the following:

```
yarn build --rpm --skip-archives
```

If you would like to build only a RPM ARM64 artifact, run the following:

```
yarn build --rpm-arm --skip-archives
```

### Building the Docker Image

Expand Down
18 changes: 18 additions & 0 deletions src/dev/build/args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ it('build dist for current platform, without packages, by default', () => {
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": false,
"createDebPackage": false,
"createDockerPackage": false,
"createDockerUbiPackage": false,
"createRpmArmPackage": false,
"createRpmPackage": false,
"downloadFreshNode": true,
"isRelease": false,
Expand All @@ -72,9 +74,11 @@ it('build dist for linux x64 platform, without packages, if --linux is passed',
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": false,
"createDebPackage": false,
"createDockerPackage": false,
"createDockerUbiPackage": false,
"createRpmArmPackage": false,
"createRpmPackage": false,
"downloadFreshNode": true,
"isRelease": false,
Expand All @@ -98,9 +102,11 @@ it('build dist for linux arm64 platform, without packages, if --linux-arm is pas
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": false,
"createDebPackage": false,
"createDockerPackage": false,
"createDockerUbiPackage": false,
"createRpmArmPackage": false,
"createRpmPackage": false,
"downloadFreshNode": true,
"isRelease": false,
Expand All @@ -124,9 +130,11 @@ it('build dist for darwin x64 platform, without packages, if --darwin is passed'
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": false,
"createDebPackage": false,
"createDockerPackage": false,
"createDockerUbiPackage": false,
"createRpmArmPackage": false,
"createRpmPackage": false,
"downloadFreshNode": true,
"isRelease": false,
Expand All @@ -150,9 +158,11 @@ it('builds packages if --all-platforms is passed', () => {
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": true,
"createDebPackage": true,
"createDockerPackage": true,
"createDockerUbiPackage": true,
"createRpmArmPackage": true,
"createRpmPackage": true,
"downloadFreshNode": true,
"isRelease": false,
Expand All @@ -176,9 +186,11 @@ it('limits packages if --rpm passed with --all-platforms', () => {
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": false,
"createDebPackage": false,
"createDockerPackage": false,
"createDockerUbiPackage": false,
"createRpmArmPackage": false,
"createRpmPackage": true,
"downloadFreshNode": true,
"isRelease": false,
Expand All @@ -202,9 +214,11 @@ it('limits packages if --deb passed with --all-platforms', () => {
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": false,
"createDebPackage": true,
"createDockerPackage": false,
"createDockerUbiPackage": false,
"createRpmArmPackage": false,
"createRpmPackage": false,
"downloadFreshNode": true,
"isRelease": false,
Expand All @@ -229,9 +243,11 @@ it('limits packages if --docker passed with --all-platforms', () => {
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": false,
"createDebPackage": false,
"createDockerPackage": true,
"createDockerUbiPackage": true,
"createRpmArmPackage": false,
"createRpmPackage": false,
"downloadFreshNode": true,
"isRelease": false,
Expand All @@ -256,9 +272,11 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform
Object {
"buildOptions": Object {
"createArchives": true,
"createDebArmPackage": false,
"createDebPackage": false,
"createDockerPackage": true,
"createDockerUbiPackage": false,
"createRpmArmPackage": false,
"createRpmPackage": false,
"downloadFreshNode": true,
"isRelease": false,
Expand Down
14 changes: 13 additions & 1 deletion src/dev/build/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export function readCliArgs(argv: string[]) {
'skip-archives',
'skip-os-packages',
'rpm',
'rpm-arm',
'deb',
'deb-arm',
'docker',
'skip-docker-ubi',
'release',
Expand All @@ -61,7 +63,9 @@ export function readCliArgs(argv: string[]) {
default: {
debug: true,
rpm: null,
'rpm-arm': null,
deb: null,
'deb-arm': null,
docker: null,
'version-qualifier': '',
},
Expand Down Expand Up @@ -98,7 +102,13 @@ export function readCliArgs(argv: string[]) {
}

// build all if no flags specified
if (flags.rpm === null && flags.deb === null && flags.docker === null) {
if (
flags.rpm === null &&
flags['rpm-arm'] === null &&
flags.deb === null &&
flags['deb-arm'] === null &&
flags.docker === null
) {
return true;
}

Expand All @@ -111,7 +121,9 @@ export function readCliArgs(argv: string[]) {
downloadFreshNode: !Boolean(flags['skip-node-download']),
createArchives: !Boolean(flags['skip-archives']),
createRpmPackage: isOsPackageDesired('rpm'),
createRpmArmPackage: isOsPackageDesired('rpm-arm'),
createDebPackage: isOsPackageDesired('deb'),
createDebArmPackage: isOsPackageDesired('deb-arm'),
createDockerPackage: isOsPackageDesired('docker'),
createDockerUbiPackage: isOsPackageDesired('docker') && !Boolean(flags['skip-docker-ubi']),
targetPlatforms: {
Expand Down
10 changes: 10 additions & 0 deletions src/dev/build/build_distributables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export interface BuildOptions {
downloadFreshNode: boolean;
createArchives: boolean;
createRpmPackage: boolean;
createRpmArmPackage: boolean;
createDebPackage: boolean;
createDebArmPackage: boolean;
createDockerPackage: boolean;
createDockerUbiPackage: boolean;
versionQualifier: string | undefined;
Expand Down Expand Up @@ -107,10 +109,18 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions
// control w/ --deb or --skip-os-packages
await run(Tasks.CreateDebPackage);
}
if (options.createDebArmPackage) {
// control w/ --deb-arm or --skip-os-packages
await run(Tasks.CreateDebArmPackage);
}
if (options.createRpmPackage) {
// control w/ --rpm or --skip-os-packages
await run(Tasks.CreateRpmPackage);
}
if (options.createRpmArmPackage) {
// control w/ --rpm-arm or --skip-os-packages
await run(Tasks.CreateRpmArmPackage);
}
if (options.createDockerPackage) {
// control w/ --docker or --skip-docker-ubi or --skip-os-packages
await run(Tasks.CreateDockerPackage);
Expand Down
5 changes: 5 additions & 0 deletions src/dev/build/lib/runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ const setup = async () => {
isRelease: true,
targetAllPlatforms: true,
versionQualifier: '-SNAPSHOT',
targetPlatforms: {
linux: false,
linuxArm: false,
darwin: false,
},
});

const run = createRunner({
Expand Down
5 changes: 5 additions & 0 deletions src/dev/build/tasks/nodejs/download_node_builds_task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ async function setup({ failOnUrl }: { failOnUrl?: string } = {}) {
const config = await Config.create({
isRelease: true,
targetAllPlatforms: true,
targetPlatforms: {
linux: false,
linuxArm: false,
darwin: false,
},
});

getNodeDownloadInfo.mockImplementation((_: Config, platform: Platform) => {
Expand Down
5 changes: 5 additions & 0 deletions src/dev/build/tasks/nodejs/extract_node_builds_task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ async function setup() {
const config = await Config.create({
isRelease: true,
targetAllPlatforms: true,
targetPlatforms: {
linux: false,
linuxArm: false,
darwin: false,
},
});

return { config };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ async function setup(actualShaSums?: Record<string, string>) {
const config = await Config.create({
isRelease: true,
targetAllPlatforms: true,
targetPlatforms: {
linux: false,
linuxArm: false,
darwin: false,
},
});

getNodeShasums.mockReturnValue(
Expand Down
Loading

0 comments on commit 5941044

Please sign in to comment.