-
Notifications
You must be signed in to change notification settings - Fork 771
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from kadel/travis-tests
Run tests on travis-ci
- Loading branch information
Showing
8 changed files
with
100 additions
and
29 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 |
---|---|---|
@@ -1,18 +1,21 @@ | ||
# we need trusty because test-cmd depends on jq version >= 1.5 | ||
dist : trusty | ||
sudo: required | ||
|
||
|
||
language: go | ||
|
||
go: | ||
- 1.6 | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
install: | ||
- go get github.com/mitchellh/gox | ||
- go get github.com/tools/godep | ||
- ./script/godep-restore.sh | ||
- true | ||
|
||
script: | ||
- make binary | ||
- make binary | ||
# $GOPATH/bin is in $PATH | ||
- mkdir -p $GOPATH/bin | ||
- cp kompose $GOPATH/bin/ | ||
|
||
- make test-unit | ||
- make test-cmd |
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
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
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,5 @@ | ||
#!/bin/bash | ||
|
||
GITCOMMIT=$(git rev-parse --short HEAD) | ||
|
||
BUILD_FLAGS=(-tags experimental -ldflags="-w -X github.com/skippbox/kompose/version.GITCOMMIT=${GITCOMMIT}") |
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 |
---|---|---|
@@ -1,26 +1,21 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [ -z "$1" ]; then | ||
OS_PLATFORM_ARG=(-os="darwin linux windows") | ||
else | ||
OS_PLATFORM_ARG=($1) | ||
fi | ||
|
||
if [ -z "$2" ]; then | ||
OS_ARCH_ARG=(-arch="386 amd64") | ||
else | ||
OS_ARCH_ARG=($2) | ||
fi | ||
source "$(dirname "$BASH_SOURCE")/.build" | ||
|
||
GITCOMMIT=$(git rev-parse --short HEAD) | ||
OUT_FILE="./kompose" | ||
|
||
# Get rid of existing binaries | ||
rm -f kompose* | ||
# Get rid of existing binary | ||
rm -f $OUT_FILE | ||
|
||
# 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 binary | ||
go build \ | ||
"${BUILD_FLAGS[@]}" \ | ||
-o $OUT_FILE \ | ||
./cli/main | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Build successful. Program saved as ${OUT_FILE}" | ||
else | ||
echo "Build failed." | ||
fi |
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,27 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
source "$(dirname "$BASH_SOURCE")/.build" | ||
|
||
if [ -z "$1" ]; then | ||
OS_PLATFORM_ARG=(-os="darwin linux windows") | ||
else | ||
OS_PLATFORM_ARG=($1) | ||
fi | ||
|
||
if [ -z "$2" ]; then | ||
OS_ARCH_ARG=(-arch="386 amd64") | ||
else | ||
OS_ARCH_ARG=($2) | ||
fi | ||
|
||
GITCOMMIT=$(git rev-parse --short HEAD) | ||
|
||
# Get rid of existing binaries | ||
rm -f kompose* | ||
|
||
# Build binaries | ||
gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \ | ||
-output="bundles/kompose_{{.OS}}-{{.Arch}}/kompose" \ | ||
"${BUILD_FLAGS[@]}" \ | ||
./cli/main |
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,3 @@ | ||
#!/bin/bash | ||
|
||
./script/test/cmd/tests.sh |
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,26 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
source "$(dirname "$BASH_SOURCE")/.build" | ||
|
||
find_dirs() { | ||
( | ||
find . -not \( \ | ||
\( \ | ||
-path './vendor/*' \ | ||
\) -prune \ | ||
\) -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | sort -u | ||
) | ||
} | ||
|
||
TEST_FLAGS=("${BUILD_FLAGS[@]}" -cover -coverprofile=cover.out) | ||
|
||
if [ -z "$TEST_DIRS" ]; then | ||
TEST_DIRS=$(find_dirs '*_test.go') | ||
fi | ||
|
||
TESTS_FAILED=() | ||
|
||
for dir in $TEST_DIRS; do | ||
go test "${TEST_FLAGS[@]}" "./${dir}" | ||
done |