Skip to content

Commit

Permalink
support arm64 arch
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Feb 5, 2024
1 parent 67d536c commit 6b78275
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,26 @@ GO=go
.PHONY: all linux darwin windows
all: linux darwin windows ## build all binaries

linux: bin/goveralls_linux_amd64 ## build Linux binary
linux: bin/goveralls_linux_amd64 bin/goveralls_linux_arm64 ## build Linux binary
bin/goveralls_linux_amd64: go.mod go.sum
mkdir -p bin
GOOS=linux GOARCH=amd64 $(GO) build -o bin/goveralls_linux_amd64 github.com/mattn/goveralls
bin/goveralls_linux_arm64: go.mod go.sum
mkdir -p bin
GOOS=linux GOARCH=arm64 $(GO) build -o bin/goveralls_linux_arm64 github.com/mattn/goveralls

darwin: bin/goveralls_darwin_amd64 ## build macOS binary
darwin: bin/goveralls_darwin_amd64 bin/goveralls_darwin_arm64 ## build macOS binary
bin/goveralls_darwin_amd64: go.mod go.sum
mkdir -p bin
GOOS=darwin GOARCH=amd64 $(GO) build -o bin/goveralls_darwin_amd64 github.com/mattn/goveralls
bin/goveralls_darwin_arm64: go.mod go.sum
mkdir -p bin
GOOS=darwin GOARCH=arm64 $(GO) build -o bin/goveralls_darwin_arm64 github.com/mattn/goveralls

windows: bin/goveralls_windows_amd64.exe ## build windows binary
windows: bin/goveralls_windows_amd64.exe bin/goveralls_windows_arm64.exe ## build windows binary
bin/goveralls_windows_amd64.exe: go.mod go.sum
mkdir -p bin
GOOS=windows GOARCH=amd64 $(GO) build -o bin/goveralls_windows_amd64.exe github.com/mattn/goveralls

bin/goveralls_windows_arm64.exe: go.mod go.sum
mkdir -p bin
GOOS=windows GOARCH=arm64 $(GO) build -o bin/goveralls_windows_arm64.exe github.com/mattn/goveralls
34 changes: 29 additions & 5 deletions src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,33 @@ async function go_env(name: string): Promise<string> {
}

function get_goveralls_path(): string {
const name =
process.platform === "win32"
? "goveralls_windows_amd64.exe"
: `goveralls_${process.platform}_amd64`;
return path.join(__dirname, "..", "bin", name);
let os: string;
let suffix: string = "";
switch (process.platform) {
case "win32":
os = "windows";
suffix = ".exe";
break;
case "darwin":
os = "darwin";
break;
case "linux":
os = "linux";
break;
default:
throw new Error(`unsupported OS: ${process.platform}`);
}

let arch: string;
switch (process.arch) {
case "x64":
arch = "amd64";
break;
case "arm64":
arch = "arm64";
break;
default:
throw new Error(`unsupported architecture: ${process.arch}`);
}
return path.join(__dirname, "..", "bin", `goveralls_${os}_${arch}${suffix}`);
}

0 comments on commit 6b78275

Please sign in to comment.