Skip to content

Commit

Permalink
Merge pull request #480 from shogo82148/introduce-m1-macos
Browse files Browse the repository at this point in the history
introduce M1 macOS
  • Loading branch information
shogo82148 committed Feb 5, 2024
2 parents 3b3be97 + 27b1363 commit 1e54661
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 10 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'action/go.mod'
go-version-file: "action/go.mod"
- run: go version

- name: Set up the action
Expand Down Expand Up @@ -50,11 +50,17 @@ jobs:
os:
- ubuntu-latest
- macos-latest
- macos-14 # for arm64
- macos-13 # for x64
- windows-latest
go:
- "1.11" # minumum version goveralls supports
- "oldstable"
- "stable"
exclude:
# Go 1.11 is not supported on Apple Silicon
- os: macos-14
go: "1.11"

runs-on: ${{ matrix.os }}
steps:
Expand Down
16 changes: 12 additions & 4 deletions Makefile
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
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 1e54661

Please sign in to comment.