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

feat: update test command to reflect new matchstick version #1470

Merged
merged 1 commit into from
Sep 28, 2023
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
5 changes: 5 additions & 0 deletions .changeset/curvy-rats-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-cli': patch
---

Update 'test' command to reflect new matchstick version
44 changes: 29 additions & 15 deletions packages/cli/src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async function runBinary(
const latestVersion = opts.latestVersion;
const recompileOpt = opts.recompile;

const platform = await getPlatform.bind(this)(logsOpt);
const platform = await getPlatform.bind(this)(versionOpt || latestVersion, logsOpt);

const url = `https://github.com/LimeChain/matchstick/releases/download/${
versionOpt || latestVersion
Expand All @@ -171,7 +171,11 @@ async function runBinary(
args.length > 0 ? binary.run(...args) : binary.run();
}

async function getPlatform(this: TestCommand, logsOpt: boolean | undefined) {
async function getPlatform(
this: TestCommand,
matchstickVersion: string | null,
logsOpt: boolean | undefined,
) {
const type = os.type();
const arch = os.arch();
const cpuCore = os.cpus()[0];
Expand All @@ -192,23 +196,33 @@ async function getPlatform(this: TestCommand, logsOpt: boolean | undefined) {
}

if (arch === 'x64' || isAppleSilicon) {
if (type === 'Darwin') {
if (majorVersion === 18 || majorVersion === 19) {
return 'binary-macos-10.15'; // GitHub dropped support for macOS 10.14 in Actions, but it seems 10.15 binary works on 10.14 too
if (semver.gt(matchstickVersion!, '0.5.4')) {
if (type === 'Darwin') {
if (isAppleSilicon) {
return 'binary-macos-12-m1';
}
return 'binary-macos-12';
}
if (isAppleSilicon) {
return 'binary-macos-11-m1';
if (type === 'Linux' && majorVersion === 22) {
return 'binary-linux-22';
}
return 'binary-macos-11';
}
if (type === 'Linux') {
if (majorVersion === 18) {
return 'binary-linux-18';
} else {
if (type === 'Darwin') {
if (majorVersion === 18 || majorVersion === 19) {
return 'binary-macos-10.15';
}
if (isAppleSilicon) {
return 'binary-macos-11-m1';
}
return 'binary-macos-11';
}
if (majorVersion === 22) {
return 'binary-linux-22';
if (type === 'Linux') {
return majorVersion === 18
? 'binary-linux-18'
: majorVersion === 22
? 'binary-linux-22'
: 'binary-linux-20';
}
return 'binary-linux-20';
}
}

Expand Down
Loading