From fc165fe5fabeb108e9b371bb7a50a31f60a0b902 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Mon, 30 Sep 2024 11:00:00 -0600 Subject: [PATCH] feat: pack win32-arm64 tarballs (#1559) * feat: pack win32-arm64 tarballs * chore(release): 4.14.36-qa.0 [skip ci] * fix: upload arm64 * chore(release): 4.14.36-qa.1 [skip ci] --------- Co-authored-by: svc-cli-bot --- docs/generate.md | 7 ++++--- docs/init.md | 1 + docs/manifest.md | 3 ++- docs/pack.md | 11 ++++++----- docs/promote.md | 1 + docs/readme.md | 1 + docs/upload.md | 11 ++++++----- src/commands/pack/win.ts | 2 +- src/commands/upload/win.ts | 6 +++--- src/tarballs/build.ts | 6 ++++++ src/tarballs/config.ts | 11 ++++++++++- src/tarballs/node.ts | 2 +- 12 files changed, 42 insertions(+), 20 deletions(-) diff --git a/docs/generate.md b/docs/generate.md index 78179f0ea..eee891b50 100644 --- a/docs/generate.md +++ b/docs/generate.md @@ -2,9 +2,10 @@ Generate a new CLI -- [`oclif generate NAME`](#oclif-generate-name) -- [`oclif generate command NAME`](#oclif-generate-command-name) -- [`oclif generate hook NAME`](#oclif-generate-hook-name) +- [`oclif generate`](#oclif-generate) + - [`oclif generate NAME`](#oclif-generate-name) + - [`oclif generate command NAME`](#oclif-generate-command-name) + - [`oclif generate hook NAME`](#oclif-generate-hook-name) ## `oclif generate NAME` diff --git a/docs/init.md b/docs/init.md index ecfe1031c..f6ae8c539 100644 --- a/docs/init.md +++ b/docs/init.md @@ -3,6 +3,7 @@ Initialize a new oclif CLI - [`oclif init`](#oclif-init) + - [`oclif init`](#oclif-init-1) ## `oclif init` diff --git a/docs/manifest.md b/docs/manifest.md index 3129ed9aa..b9bc1e0e2 100644 --- a/docs/manifest.md +++ b/docs/manifest.md @@ -2,7 +2,8 @@ Generates plugin manifest json (oclif.manifest.json). -- [`oclif manifest [PATH]`](#oclif-manifest-path) +- [`oclif manifest`](#oclif-manifest) + - [`oclif manifest [PATH]`](#oclif-manifest-path) ## `oclif manifest [PATH]` diff --git a/docs/pack.md b/docs/pack.md index 18011159f..db81357a7 100644 --- a/docs/pack.md +++ b/docs/pack.md @@ -2,10 +2,11 @@ Package an oclif CLI into installable artifacts. -- [`oclif pack deb`](#oclif-pack-deb) -- [`oclif pack macos`](#oclif-pack-macos) -- [`oclif pack tarballs`](#oclif-pack-tarballs) -- [`oclif pack win`](#oclif-pack-win) +- [`oclif pack`](#oclif-pack) + - [`oclif pack deb`](#oclif-pack-deb) + - [`oclif pack macos`](#oclif-pack-macos) + - [`oclif pack tarballs`](#oclif-pack-tarballs) + - [`oclif pack win`](#oclif-pack-win) ## `oclif pack deb` @@ -99,7 +100,7 @@ FLAGS checkbox. Set to "hidden" to hide the option (will let defender do its thing). --prune-lockfiles remove lockfiles in the tarball. - --targets= Comma-separated targets to pack (e.g.: win32-x64,win32-x86). + --targets= Comma-separated targets to pack (e.g.: win32-x64,win32-x86,win32-arm64). DESCRIPTION Create windows installer from oclif CLI diff --git a/docs/promote.md b/docs/promote.md index 2ab6cf5a2..25e47164c 100644 --- a/docs/promote.md +++ b/docs/promote.md @@ -3,6 +3,7 @@ Promote CLI builds to a S3 release channel. - [`oclif promote`](#oclif-promote) + - [`oclif promote`](#oclif-promote-1) ## `oclif promote` diff --git a/docs/readme.md b/docs/readme.md index 90faea3e9..b64bc04ce 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -3,6 +3,7 @@ Adds commands to README.md in current directory. - [`oclif readme`](#oclif-readme) + - [`oclif readme`](#oclif-readme-1) ## `oclif readme` diff --git a/docs/upload.md b/docs/upload.md index 9ee309c6a..3fe4951a5 100644 --- a/docs/upload.md +++ b/docs/upload.md @@ -2,10 +2,11 @@ Upload installable CLI artifacts to AWS S3. -- [`oclif upload deb`](#oclif-upload-deb) -- [`oclif upload macos`](#oclif-upload-macos) -- [`oclif upload tarballs`](#oclif-upload-tarballs) -- [`oclif upload win`](#oclif-upload-win) +- [`oclif upload`](#oclif-upload) + - [`oclif upload deb`](#oclif-upload-deb) + - [`oclif upload macos`](#oclif-upload-macos) + - [`oclif upload tarballs`](#oclif-upload-tarballs) + - [`oclif upload win`](#oclif-upload-win) ## `oclif upload deb` @@ -71,7 +72,7 @@ USAGE FLAGS -r, --root= (required) [default: .] Path to oclif CLI root. - --targets= Comma-separated targets to pack (e.g.: win32-x64,win32-x86). + --targets= Comma-separated targets to pack (e.g.: win32-x64,win32-x86,win32-arm64). DESCRIPTION Upload windows installers built with `pack win`. diff --git a/src/commands/pack/win.ts b/src/commands/pack/win.ts index 6ab2d85a2..698e5f0ac 100644 --- a/src/commands/pack/win.ts +++ b/src/commands/pack/win.ts @@ -259,7 +259,7 @@ the CLI should already exist in a directory named after the CLI that is the root required: false, }), targets: Flags.string({ - description: 'Comma-separated targets to pack (e.g.: win32-x64,win32-x86).', + description: 'Comma-separated targets to pack (e.g.: win32-x64,win32-x86,win32-arm64).', }), } diff --git a/src/commands/upload/win.ts b/src/commands/upload/win.ts index 747e8cc4c..93207f265 100644 --- a/src/commands/upload/win.ts +++ b/src/commands/upload/win.ts @@ -11,7 +11,7 @@ export default class UploadWin extends Command { static flags = { root: Flags.string({char: 'r', default: '.', description: 'Path to oclif CLI root.', required: true}), - targets: Flags.string({description: 'Comma-separated targets to pack (e.g.: win32-x64,win32-x86).'}), + targets: Flags.string({description: 'Comma-separated targets to pack (e.g.: win32-x64,win32-x86,win32-arm64).'}), } async run(): Promise { @@ -40,7 +40,7 @@ export default class UploadWin extends Command { } const cloudKeyBase = commitAWSDir(config.pjson.version, buildConfig.gitSha, s3Config) - const uploadWin = async (arch: 'x64' | 'x86') => { + const uploadWin = async (arch: 'arm64' | 'x64' | 'x86') => { const templateKey = templateShortKey('win32', { arch, bin: config.bin, @@ -53,7 +53,7 @@ export default class UploadWin extends Command { await aws.s3.uploadFile(localExe, {...S3Options, CacheControl: 'max-age=86400', Key: cloudKey}) } - await Promise.all([uploadWin('x64'), uploadWin('x86')]) + await Promise.all([uploadWin('x64'), uploadWin('x86'), uploadWin('arm64')]) log(`done uploading windows executables for v${config.version}-${buildConfig.gitSha}`) } diff --git a/src/tarballs/build.ts b/src/tarballs/build.ts index 7b28569a7..a686699ba 100644 --- a/src/tarballs/build.ts +++ b/src/tarballs/build.ts @@ -6,6 +6,7 @@ import {existsSync} from 'node:fs' import {mkdir, readdir, rm} from 'node:fs/promises' import * as path from 'node:path' import {promisify} from 'node:util' +import {lt} from 'semver' import {log} from '../log' import {commitAWSDir, templateShortKey} from '../upload-util' @@ -214,6 +215,11 @@ const buildTarget = async ( c: BuildConfig, options: BuildOptions, ) => { + if (target.platform === 'win32' && target.arch === 'arm64' && lt(c.nodeVersion, '20.0.0')) { + ux.warn('win32-arm64 is only supported for node >=20.0.0. Skipping...') + return + } + const workspace = c.workspace(target) const {arch, platform} = target const {bin, version} = c.config diff --git a/src/tarballs/config.ts b/src/tarballs/config.ts index 4ed763541..d61c7116e 100644 --- a/src/tarballs/config.ts +++ b/src/tarballs/config.ts @@ -10,7 +10,16 @@ import {templateShortKey} from '../upload-util' import {castArray, compact} from '../util' const exec = promisify(execSync) -export const TARGETS = ['linux-x64', 'linux-arm', 'linux-arm64', 'win32-x64', 'win32-x86', 'darwin-x64', 'darwin-arm64'] +export const TARGETS = [ + 'linux-x64', + 'linux-arm', + 'linux-arm64', + 'win32-x64', + 'win32-x86', + 'win32-arm64', + 'darwin-x64', + 'darwin-arm64', +] export type S3Config = { acl?: ObjectCannedACL diff --git a/src/tarballs/node.ts b/src/tarballs/node.ts index 6f0d25870..e2e562717 100644 --- a/src/tarballs/node.ts +++ b/src/tarballs/node.ts @@ -40,7 +40,7 @@ export async function fetchNodeBinary({arch, nodeVersion, output, platform, tmp} if (platform === 'win32') cache += '.exe' const download = async () => { - log(`downloading ${nodeBase}`) + log(`downloading ${nodeBase} (${url})`) await Promise.all([ensureDir(path.join(tmp, 'cache', nodeVersion)), ensureDir(path.join(tmp, 'node'))]) const shasums = path.join(tmp, 'cache', nodeVersion, 'SHASUMS256.txt.asc') const {default: got} = await import('got')