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
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
source "$(dirname "$BASH_SOURCE")/.build"
|
||||||
|
|
||||||
|
OUT_FILE="./kompose"
|
||||||
|
|
||||||
# Get rid of existing binary
|
# Get rid of existing binary
|
||||||
rm -f kompose
|
rm -f $OUT_FILE
|
||||||
|
|
||||||
# Build binary
|
# Build binary
|
||||||
go build \
|
go build \
|
||||||
-tags experimental \
|
"${BUILD_FLAGS[@]}" \
|
||||||
-o kompose \
|
-o $OUT_FILE \
|
||||||
-ldflags="-w -X github.com/skippbox/kompose/version.GITCOMMIT=${GITCOMMIT}" \
|
|
||||||
./cli/main
|
./cli/main
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
source "$(dirname "$BASH_SOURCE")/.build"
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
OS_PLATFORM_ARG=(-os="darwin linux windows")
|
OS_PLATFORM_ARG=(-os="darwin linux windows")
|
||||||
else
|
else
|
||||||
@ -21,6 +23,5 @@ rm -f kompose*
|
|||||||
# Build binaries
|
# Build binaries
|
||||||
gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \
|
gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \
|
||||||
-output="bundles/kompose_{{.OS}}-{{.Arch}}/kompose" \
|
-output="bundles/kompose_{{.OS}}-{{.Arch}}/kompose" \
|
||||||
-tags experimental \
|
"${BUILD_FLAGS[@]}" \
|
||||||
-ldflags="-w -X github.com/skippbox/kompose/version.GITCOMMIT=${GITCOMMIT}" \
|
|
||||||
./cli/main
|
./cli/main
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
source "$(dirname "$BASH_SOURCE")/.build"
|
||||||
|
|
||||||
find_dirs() {
|
find_dirs() {
|
||||||
(
|
(
|
||||||
find . -not \( \
|
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
|
if [ -z "$TEST_DIRS" ]; then
|
||||||
TEST_DIRS=$(find_dirs '*_test.go')
|
TEST_DIRS=$(find_dirs '*_test.go')
|
||||||
@ -19,7 +21,6 @@ fi
|
|||||||
|
|
||||||
TESTS_FAILED=()
|
TESTS_FAILED=()
|
||||||
|
|
||||||
set +e
|
|
||||||
for dir in $TEST_DIRS; do
|
for dir in $TEST_DIRS; do
|
||||||
go test ${TEST_FLAGS} "./${dir}"
|
go test "${TEST_FLAGS[@]}" "./${dir}"
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user