The Gleam installer had two arch-related bugs:
1. Darwin reused the Linux config (installOpts.darwin = installOpts.linux),
downloading x86_64-unknown-linux-musl on macOS, causing ENOEXEC.
2. Linux hardcoded x86_64, downloading the wrong binary on ARM64 runners,
causing 'Syntax error' when trying to execute an x86_64 ELF.
Add arch detection via getRunnerOSArchitecture() to both Linux and
Darwin download URLs, selecting the correct aarch64 or x86_64 binary.
Add a proper Darwin config that downloads apple-darwin archives.
Static ESM imports are hoisted above top-level statements, causing
setup-beam.js to evaluate its main() guard before process.env.NODE_ENV
is set to 'test'. This triggered core.setFailed() during module load,
setting process.exitCode=1 and failing the test file even though all
individual test cases passed.
Switch setup-beam.js to a dynamic await import() so that the env and
input setup runs first, ensuring the NODE_ENV='test' guard works
correctly.
Amp-Thread-ID: https://ampcode.com/threads/T-019ce36a-a18f-7494-ac0a-c094a84f06ad
Co-authored-by: Amp <amp@ampcode.com>