Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setup-bazel for Windows ARM64 #28

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ Default `false`.
```
</details>

## Note for Windows ARM64 Users

When using this action on Windows ARM64 architecture, the setup will temporarily use the x64 version of Bazelisk due to the current unavailability of a native ARM64 binary. This is a temporary workaround until an ARM64 binary becomes available. For more details, see [bazelbuild/bazelisk#572](https://github.com/bazelbuild/bazelisk/issues/572).

## Migrating from [`bazelbuild/setup-bazelisk`][6]

You can simply replace `bazelbuild/setup-bazelisk` action with `bazel-contrib/setup-bazel`.
Expand Down
31 changes: 17 additions & 14 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92596,8 +92596,6 @@ class Lexer {
*/
*lex(source, incomplete = false) {
if (source) {
if (typeof source !== 'string')
throw TypeError('source is not a string');
this.buffer = this.buffer ? this.buffer + source : source;
this.lineEndPos = null;
}
Expand Down Expand Up @@ -92697,16 +92695,11 @@ class Lexer {
}
if (line[0] === '%') {
let dirEnd = line.length;
let cs = line.indexOf('#');
while (cs !== -1) {
const cs = line.indexOf('#');
if (cs !== -1) {
const ch = line[cs - 1];
if (ch === ' ' || ch === '\t') {
if (ch === ' ' || ch === '\t')
dirEnd = cs - 1;
break;
}
else {
cs = line.indexOf('#', cs + 1);
}
}
while (true) {
const ch = line[dirEnd - 1];
Expand Down Expand Up @@ -94476,7 +94469,7 @@ const floatNaN = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,
resolve: str => str.slice(-3).toLowerCase() === 'nan'
? NaN
: str[0] === '-'
Expand Down Expand Up @@ -94893,7 +94886,7 @@ const floatNaN = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
resolve: (str) => str.slice(-3).toLowerCase() === 'nan'
? NaN
: str[0] === '-'
Expand Down Expand Up @@ -96085,7 +96078,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
if (keyComment) {
throw new Error('With simple keys, key nodes cannot have comments');
}
if (identity.isCollection(key) || (!identity.isNode(key) && typeof key === 'object')) {
if (identity.isCollection(key)) {
const msg = 'With simple keys, collection cannot be used as a key value';
throw new Error(msg);
}
Expand Down Expand Up @@ -96930,6 +96923,11 @@ async function downloadBazelisk() {
let platform = config.os.platform
if (platform == "win32") {
platform = "windows"
// Temporary workaround for ARM64 on Windows until an ARM64 binary is available.
// See https://github.com/bazelbuild/bazelisk/issues/572 for details.
if (arch == 'arm64') {
arch = 'amd64'
}
}

let filename = `bazelisk-${platform}-${arch}`
Expand Down Expand Up @@ -96962,9 +96960,14 @@ async function downloadBazelisk() {
core.debug(`Downloading from ${url}`)
const downloadPath = await tc.downloadTool(url, undefined, `token ${token}`)

let binaryName = 'bazel'
if (platform == 'windows') {
binaryName = `${binaryName}.exe`
}

core.debug('Adding to the cache...');
fs.chmodSync(downloadPath, '755');
const cachePath = await tc.cacheFile(downloadPath, 'bazel', 'bazelisk', version)
const cachePath = await tc.cacheFile(downloadPath, binaryName, 'bazelisk', version)
core.debug(`Successfully cached bazelisk to ${cachePath}`)

return cachePath
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

19 changes: 6 additions & 13 deletions dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91665,8 +91665,6 @@ class Lexer {
*/
*lex(source, incomplete = false) {
if (source) {
if (typeof source !== 'string')
throw TypeError('source is not a string');
this.buffer = this.buffer ? this.buffer + source : source;
this.lineEndPos = null;
}
Expand Down Expand Up @@ -91766,16 +91764,11 @@ class Lexer {
}
if (line[0] === '%') {
let dirEnd = line.length;
let cs = line.indexOf('#');
while (cs !== -1) {
const cs = line.indexOf('#');
if (cs !== -1) {
const ch = line[cs - 1];
if (ch === ' ' || ch === '\t') {
if (ch === ' ' || ch === '\t')
dirEnd = cs - 1;
break;
}
else {
cs = line.indexOf('#', cs + 1);
}
}
while (true) {
const ch = line[dirEnd - 1];
Expand Down Expand Up @@ -93545,7 +93538,7 @@ const floatNaN = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,
resolve: str => str.slice(-3).toLowerCase() === 'nan'
? NaN
: str[0] === '-'
Expand Down Expand Up @@ -93962,7 +93955,7 @@ const floatNaN = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
resolve: (str) => str.slice(-3).toLowerCase() === 'nan'
? NaN
: str[0] === '-'
Expand Down Expand Up @@ -95154,7 +95147,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
if (keyComment) {
throw new Error('With simple keys, key nodes cannot have comments');
}
if (identity.isCollection(key) || (!identity.isNode(key) && typeof key === 'object')) {
if (identity.isCollection(key)) {
const msg = 'With simple keys, collection cannot be used as a key value';
throw new Error(msg);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ async function downloadBazelisk() {
let platform = config.os.platform
if (platform == "win32") {
platform = "windows"
// Temporary workaround for ARM64 on Windows until an ARM64 binary is available.
// See https://github.com/bazelbuild/bazelisk/issues/572 for details.
if (arch == 'arm64') {
arch = 'amd64'
}
}

let filename = `bazelisk-${platform}-${arch}`
Expand Down Expand Up @@ -94,9 +99,14 @@ async function downloadBazelisk() {
core.debug(`Downloading from ${url}`)
const downloadPath = await tc.downloadTool(url, undefined, `token ${token}`)

let binaryName = 'bazel'
if (platform == 'windows') {
binaryName = `${binaryName}.exe`
}

core.debug('Adding to the cache...');
fs.chmodSync(downloadPath, '755');
const cachePath = await tc.cacheFile(downloadPath, 'bazel', 'bazelisk', version)
const cachePath = await tc.cacheFile(downloadPath, binaryName, 'bazelisk', version)
core.debug(`Successfully cached bazelisk to ${cachePath}`)

return cachePath
Expand Down