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

add warning if requesting x64 on apple silicon runners #300

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions .github/workflows/example-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ jobs:
exclude:
- os: macOS-latest
julia-arch: x86
include:
- os: macOS-latest
julia-arch: aarch64
julia-version: 'lts'
- os: macOS-latest
julia-arch: aarch64
julia-version: '1'

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,18 @@ jobs:
strategy:
matrix:
julia-version: ['1.0', '1.2.0', '^1.3.0-rc1']
julia-arch: [x64, x86]
julia-arch: [x64, x86, aarch64]
os: [ubuntu-latest, windows-latest, macOS-latest]
# 32-bit Julia binaries are not available on macOS
# exclude unavailable/unwanted architectures
exclude:
- os: macOS-latest
julia-arch: x86
- os: macOS-latest
julia-arch: x64 # can be run but via rosetta on apple silicon runners
- os: ubuntu-latest
julia-arch: aarch64
- os: windows-latest
julia-arch: aarch64

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,9 @@ function run() {
if (!originalArchInput) { // if `originalArchInput` is an empty string
throw new Error(`Arch input must not be null`);
}
if (originalArchInput == 'x64' && os.platform() == 'darwin' && os.arch() == 'arm64') {
core.warning('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 architecture. You may have meant to use the "aarch64" arch instead (or left it unspecified for the correct default).');
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems misleading, since leaving it unspecified causes it to throw an exception and fail:

if (!originalArchInput) { // if `originalArchInput` is an empty string
throw new Error(`Arch input must not be null`)
}

https://github.com/vtjnash/Glob.jl/actions/runs/11898442357/job/33154951261?pr=44

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unspecified as in not an empty string, just not set at all.

Copy link
Member

@DilumAluthge DilumAluthge Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do this:

- uses: julia-actions/setup-julia@desiredtag
  with:
    version: '1.10'

Then setup-julia will default to the architecture of the runner.


In contrast, if you do this:

- uses: julia-actions/setup-julia@desiredtag
  with:
    version: '1.10'
    arch: ''

Then setup-julia will (correctly) throw an error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use a matrix and don't specify arch, then it will get an empty string here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following two are equivalent:

- uses: julia-actions/setup-julia@desiredtag
  with:
    version: '1.10'
- uses: julia-actions/setup-julia@desiredtag
  with:
    version: '1.10'
    arch: 'default'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation says it defaults to '', though I agree that using "default" instead works

setup-julia/README.md

Lines 56 to 57 in 5c9647d

# Defaults to the architecture of the runner executing the job.
arch: ''

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use a matrix, you shouldn't be passing an empty string ''. You should pass 'default' instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the readme is misleading. They're all like that, note the default behaviors are written above the empty string examples. Not sure what the clearest way to write them all is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix up the README. For inputs that are optional (like arch), we should put a reasonable default in there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
let processedArchInput;
if (originalArchInput == "default") {
// If the user sets the `arch` input to `default`, then we use the
Expand Down
3 changes: 3 additions & 0 deletions lib/setup-julia.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/setup-julia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ async function run() {
throw new Error(`Arch input must not be null`)
}

if (originalArchInput == 'x64' && os.platform() == 'darwin' && os.arch() == 'arm64') {
core.warning('[setup-julia] x64 arch has been requested on a macOS runner that has an arm64 architecture. You may have meant to use the "aarch64" arch instead (or left it unspecified for the correct default).')
}

let processedArchInput: string;
if (originalArchInput == "default") {
// If the user sets the `arch` input to `default`, then we use the
Expand Down
Loading