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: dev-2024-06 packaging differences #38

Merged
merged 3 commits into from
Jun 6, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-14] # macos-14 is an arm machine.
release: [latest, dev-2023-10]
release: [latest, dev-2023-10, dev-2024-05]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
38 changes: 27 additions & 11 deletions dist/setup/index.js

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

2 changes: 1 addition & 1 deletion dist/setup/index.js.map

Large diffs are not rendered by default.

38 changes: 27 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,23 +310,28 @@ async function downloadRelease(inputs) {
// I know this is ugly, please do not come for me!
const maybeZipInZip = `${common.odinPath()}/dist.zip`;
if (fs.existsSync(maybeZipInZip)) {
core.info('Unzipping nested zip');
const zipInZip = new AdmZip(maybeZipInZip);
zipInZip.extractAllTo(common.odinPath(), false, true);

}

// NOTE: after dev-2024-06 releases don't seem to be doubly zipped anymore
// but do still have the nested dist folder we need to move.
const maybeNestedDistName = (os.platform() == 'win32') ? '/windows_artifacts' : '/dist';
const maybeNestedDist = `${common.odinPath()}/${maybeNestedDistName}`;
if (fs.existsSync(maybeNestedDist)) {
core.info('Moving dist folder');
// Basically does a `mv dist/* .`
const entries = fs.readdirSync(`${common.odinPath()}/dist`);
await Promise.all(entries.map((entry) => io.mv(`${common.odinPath()}/dist/${entry}`, `${common.odinPath()}/${entry}`)));
const entries = fs.readdirSync(maybeNestedDist);
await Promise.all(entries.map((entry) => io.mv(`${maybeNestedDist}/${entry}`, `${common.odinPath()}/${entry}`)));

// NOTE: somehow after dev-2024-06 we also need to make it executable again...
makeCompilerExecutable();

return true;
}

// NOTE: after dev-2024-03 these releases have the executable permission by default, we still
// chmod to support older releases.
if (os.platform() == 'linux' || os.platform() == 'darwin') {
const code = await exec.exec(`chmod +x ${common.odinPath()}/odin`);
if (code != 0) {
core.warning(`Exit code ${code} making the compiler executable`);
}
}
makeCompilerExecutable();

// NOTE: Older releases of darwin did not bundle LLVM, from 2023-10 onwards it needs llvm 13 installed via brew.
if (os.platform() == 'darwin') {
Expand All @@ -336,4 +341,15 @@ async function downloadRelease(inputs) {
return true;
}

// NOTE: after dev-2024-03 these releases have the executable permission by default, we still
// chmod to support older releases.
async function makeCompilerExecutable() {
if (os.platform() == 'linux' || os.platform() == 'darwin') {
const code = await exec.exec(`chmod +x ${common.odinPath()}/odin`);
if (code != 0) {
core.warning(`Exit code ${code} making the compiler executable`);
}
}
}

run();
Loading