forked from LaconicNetwork/kompose
Add script/.build to keep BUILD_FLAGS in one place
This commit is contained in:
parent
a15a8f36ca
commit
e64f1c1215
5
script/.build
Normal file
5
script/.build
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
GITCOMMIT=$(git rev-parse --short HEAD)
|
||||
|
||||
BUILD_FLAGS=(-tags experimental -ldflags="-w -X github.com/skippbox/kompose/version.GITCOMMIT=${GITCOMMIT}")
|
||||
@ -1,14 +1,17 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.build"
|
||||
|
||||
OUT_FILE="./kompose"
|
||||
|
||||
# Get rid of existing binary
|
||||
rm -f kompose
|
||||
rm -f $OUT_FILE
|
||||
|
||||
# Build binary
|
||||
go build \
|
||||
-tags experimental \
|
||||
-o kompose \
|
||||
-ldflags="-w -X github.com/skippbox/kompose/version.GITCOMMIT=${GITCOMMIT}" \
|
||||
"${BUILD_FLAGS[@]}" \
|
||||
-o $OUT_FILE \
|
||||
./cli/main
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.build"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
OS_PLATFORM_ARG=(-os="darwin linux windows")
|
||||
else
|
||||
@ -21,6 +23,5 @@ rm -f kompose*
|
||||
# Build binaries
|
||||
gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \
|
||||
-output="bundles/kompose_{{.OS}}-{{.Arch}}/kompose" \
|
||||
-tags experimental \
|
||||
-ldflags="-w -X github.com/skippbox/kompose/version.GITCOMMIT=${GITCOMMIT}" \
|
||||
"${BUILD_FLAGS[@]}" \
|
||||
./cli/main
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.build"
|
||||
|
||||
find_dirs() {
|
||||
(
|
||||
find . -not \( \
|
||||
@ -11,7 +13,7 @@ find_dirs() {
|
||||
)
|
||||
}
|
||||
|
||||
TEST_FLAGS="-tags experimental -cover -coverprofile=cover.out"
|
||||
TEST_FLAGS=("${BUILD_FLAGS[@]}" -cover -coverprofile=cover.out)
|
||||
|
||||
if [ -z "$TEST_DIRS" ]; then
|
||||
TEST_DIRS=$(find_dirs '*_test.go')
|
||||
@ -19,7 +21,6 @@ fi
|
||||
|
||||
TESTS_FAILED=()
|
||||
|
||||
set +e
|
||||
for dir in $TEST_DIRS; do
|
||||
go test ${TEST_FLAGS} "./${dir}"
|
||||
go test "${TEST_FLAGS[@]}" "./${dir}"
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user