Skip to content
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
7 changes: 7 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,12 @@ jobs:
- name: Test
run: go test -v ./... --cover

- name: Test Linux release on a CPU without AVX
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y qemu-user
go run github.com/magefile/mage build linux64
qemu-x86_64 -cpu qemu64 ./coreander --help

- name: Test JavaScript
run: node --test internal/webserver/js-tests/*.test.mjs
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ There are two possibilities for building Coreander from source:
* If you have [Mage](https://magefile.org) installed in your system, just type `mage install` from the source code folder.
* Otherwise, a simple `go build` or `go install` will do, although no version information will be added to the executable.

Release builds (`mage build <platform>` or `mage release`) disable cgo and explicitly target the baseline `GOAMD64=v1` on x86-64, so they do not depend on the build machine's native C compiler CPU settings. For an equivalent portable Linux x86-64 build from source, use `CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOAMD64=v1 go build`.

Reader interaction regression tests can be run with Node.js using its built-in test runner: `node --test internal/webserver/js-tests/*.test.mjs`.

## How to use
Expand Down
50 changes: 15 additions & 35 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,53 +71,33 @@ func binaryName(platform string) string {
}

func env(platform string) (map[string]string, error) {
env := map[string]string{}
env := map[string]string{"CGO_ENABLED": "0"}

switch platform {
case "linux32":
return map[string]string{
"GOOS": "linux",
"GOARCH": "386",
}, nil
env["GOOS"], env["GOARCH"] = "linux", "386"
case "linux64":
return map[string]string{
"GOOS": "linux",
"GOARCH": "amd64",
}, nil
env["GOOS"], env["GOARCH"] = "linux", "amd64"
case "linuxarm32":
return map[string]string{
"GOOS": "linux",
"GOARCH": "arm",
"GOARM": "7",
}, nil
env["GOOS"], env["GOARCH"], env["GOARM"] = "linux", "arm", "7"
case "linuxarm64":
return map[string]string{
"GOOS": "linux",
"GOARCH": "arm64",
}, nil
env["GOOS"], env["GOARCH"] = "linux", "arm64"
case "osxintel":
return map[string]string{
"GOOS": "darwin",
"GOARCH": "amd64",
}, nil
env["GOOS"], env["GOARCH"] = "darwin", "amd64"
case "osxapple":
return map[string]string{
"GOOS": "darwin",
"GOARCH": "arm64",
}, nil
env["GOOS"], env["GOARCH"] = "darwin", "arm64"
case "win32":
return map[string]string{
"GOOS": "windows",
"GOARCH": "386",
}, nil
env["GOOS"], env["GOARCH"] = "windows", "386"
case "win64":
return map[string]string{
"GOOS": "windows",
"GOARCH": "amd64",
}, nil
env["GOOS"], env["GOARCH"] = "windows", "amd64"
default:
return nil, fmt.Errorf("Platform '%s' not supported", platform)
}

return env, fmt.Errorf("Platform '%s' not supported", platform)
if env["GOARCH"] == "amd64" {
env["GOAMD64"] = "v1"
}
return env, nil
}

func createZip(fileName, zipFileName string) error {
Expand Down
Loading