Skip to content

Commit

Permalink
feat: pack win32-arm64 tarballs (oclif#1559)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
mdonnalley and svc-cli-bot authored Sep 30, 2024
1 parent 63c4369 commit fc165fe
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 20 deletions.
7 changes: 4 additions & 3 deletions docs/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
1 change: 1 addition & 0 deletions docs/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Initialize a new oclif CLI

- [`oclif init`](#oclif-init)
- [`oclif init`](#oclif-init-1)

## `oclif init`

Expand Down
3 changes: 2 additions & 1 deletion docs/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]`

Expand Down
11 changes: 6 additions & 5 deletions docs/pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -99,7 +100,7 @@ FLAGS
checkbox. Set to "hidden" to hide the option (will let defender do its thing).
<options: checked|unchecked|hidden>
--prune-lockfiles remove lockfiles in the tarball.
--targets=<value> Comma-separated targets to pack (e.g.: win32-x64,win32-x86).
--targets=<value> Comma-separated targets to pack (e.g.: win32-x64,win32-x86,win32-arm64).
DESCRIPTION
Create windows installer from oclif CLI
Expand Down
1 change: 1 addition & 0 deletions docs/promote.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Promote CLI builds to a S3 release channel.

- [`oclif promote`](#oclif-promote)
- [`oclif promote`](#oclif-promote-1)

## `oclif promote`

Expand Down
1 change: 1 addition & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Adds commands to README.md in current directory.

- [`oclif readme`](#oclif-readme)
- [`oclif readme`](#oclif-readme-1)

## `oclif readme`

Expand Down
11 changes: 6 additions & 5 deletions docs/upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -71,7 +72,7 @@ USAGE
FLAGS
-r, --root=<value> (required) [default: .] Path to oclif CLI root.
--targets=<value> Comma-separated targets to pack (e.g.: win32-x64,win32-x86).
--targets=<value> Comma-separated targets to pack (e.g.: win32-x64,win32-x86,win32-arm64).
DESCRIPTION
Upload windows installers built with `pack win`.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/pack/win.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).',
}),
}

Expand Down
6 changes: 3 additions & 3 deletions src/commands/upload/win.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
Expand Down Expand Up @@ -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,
Expand All @@ -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}`)
}
Expand Down
6 changes: 6 additions & 0 deletions src/tarballs/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion src/tarballs/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/tarballs/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit fc165fe

Please sign in to comment.