-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
# The basename of our binary | ||
BASE="go.vm" | ||
|
||
# Get the dependencies | ||
go mod init | ||
|
||
# | ||
# We build on multiple platforms/archs | ||
# | ||
BUILD_PLATFORMS="linux windows darwin freebsd" | ||
BUILD_ARCHS="amd64 386" | ||
|
||
# For each platform | ||
for OS in ${BUILD_PLATFORMS[@]}; do | ||
|
||
# For each arch | ||
for ARCH in ${BUILD_ARCHS[@]}; do | ||
|
||
# Setup a suffix for the binary | ||
SUFFIX="${OS}" | ||
|
||
# i386 is better than 386 | ||
if [ "$ARCH" = "386" ]; then | ||
SUFFIX="${SUFFIX}-i386" | ||
else | ||
SUFFIX="${SUFFIX}-${ARCH}" | ||
fi | ||
|
||
# Windows binaries should end in .EXE | ||
if [ "$OS" = "windows" ]; then | ||
SUFFIX="${SUFFIX}.exe" | ||
fi | ||
|
||
echo "Building for ${OS} [${ARCH}] -> ${BASE}-${SUFFIX}" | ||
|
||
# Run the build | ||
export GOARCH=${ARCH} | ||
export GOOS=${OS} | ||
export CGO_ENABLED=1 | ||
|
||
go build -ldflags "-X main.version=$(git describe --tags)" -o "${BASE}-${SUFFIX}" | ||
|
||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# pushes trigger the testsuite | ||
workflow "Push Event" { | ||
on = "push" | ||
resolves = ["Test"] | ||
} | ||
|
||
# pull-requests trigger the testsuite | ||
workflow "Pull Request" { | ||
on = "pull_request" | ||
resolves = ["Test"] | ||
} | ||
|
||
# releases trigger new binary artifacts | ||
workflow "Handle Release" { | ||
on = "release" | ||
resolves = ["Upload"] | ||
} | ||
|
||
## | ||
## The actions | ||
## | ||
|
||
|
||
## | ||
## Run the test-cases, via .github/run-tests.sh | ||
## | ||
action "Test" { | ||
uses = "skx/github-action-tester@master" | ||
} | ||
|
||
## | ||
## Build the binaries, via .github/build, then upload them. | ||
## | ||
action "Upload" { | ||
uses = "skx/github-action-publish-binaries@master" | ||
args = "go.vm-*" | ||
secrets = ["GITHUB_TOKEN"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# init modules | ||
go mod init | ||
|
||
# Run golang tests | ||
go test ./... | ||
|