Last active
April 12, 2019 17:11
-
-
Save 030/9a74cf6537b32dfa666cdcbd9c0ccac7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
readonly ARTIFACT_NAME=$1 | |
formatting() { | |
echo "Go formatting..." | |
diff -u <(echo -n) <(gofmt -d ./) | |
} | |
version() { | |
echo "Checking the golang version..." | |
go version | |
} | |
go_test() { | |
ls | |
echo "Run the tests..." | |
go test -short -cover -v -coverprofile=coverage.out -covermode=atomic ./... | |
} | |
buid_and_checksum() { | |
LOCAL_DELIVERABLE="${ARTIFACT_NAME}-${1}${2}" | |
echo "Creating artifact ${LOCAL_DELIVERABLE}..." | |
env GOOS=$1 GOARCH=amd64 go build -o $LOCAL_DELIVERABLE | |
sha512sum $LOCAL_DELIVERABLE > ${LOCAL_DELIVERABLE}.sha512.txt | |
} | |
artifacts() { | |
buid_and_checksum darwin | |
buid_and_checksum linux | |
buid_and_checksum windows .exe | |
} | |
main() { | |
version | |
formatting | |
go_test | |
artifacts | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment