-
Notifications
You must be signed in to change notification settings - Fork 0
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
112 changed files
with
17,379 additions
and
7,898 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,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
TOOL_SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "$TOOL_SOURCE" ] ; do TOOL_SOURCE="$(readlink "$TOOL_SOURCE")"; done | ||
SDLC_DIR="$( cd -P "$( dirname "$TOOL_SOURCE" )" && pwd )" | ||
PRJ_HOME="$( cd -P "$( dirname "$SDLC_DIR" )" && pwd )" | ||
|
||
source "${SDLC_DIR}/config" | ||
|
||
CMDS_DIR="${PRJ_HOME}/cmd" | ||
BIN_DIR="${PRJ_HOME}/bin" | ||
[[ -d "$BIN_DIR" ]] && rm -r "$BIN_DIR" | ||
mkdir "$BIN_DIR" | ||
|
||
cd "${PRJ_HOME}" | ||
|
||
buildtime=$(TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ') | ||
git_hash="$(git rev-parse HEAD)" | ||
git_dirty="$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)" | ||
git_commit="${git_hash}${git_dirty}" | ||
echo "building ${GH_REPO}" | ||
echo "version : ${APP_VERSION}" | ||
echo "git : ${git_commit}" | ||
echo "build time : ${buildtime}" | ||
|
||
command -v dep >/dev/null || { | ||
echo "dep not found" | ||
exit 1 | ||
} | ||
echo 'Running dep ensure' | ||
dep ensure -v | ||
|
||
for dir in $(find "$CMDS_DIR" -mindepth 1 -maxdepth 1 -type d); do | ||
app_name=$(basename "$dir") | ||
echo " ===== Process ${app_name} ${dir} =====" | ||
go build -ldflags "-s \ | ||
-X github.com/${GH_OWNER}/${GH_REPO}/lib/core.Version=${APP_VERSION} \ | ||
-X github.com/${GH_OWNER}/${GH_REPO}/lib/core.BuildTime=${buildtime} \ | ||
-X github.com/${GH_OWNER}/${GH_REPO}/lib/core.GitCommit=${git_commit}" \ | ||
-o "${BIN_DIR}/${app_name}" \ | ||
"github.com/${GH_OWNER}/${GH_REPO}/cmd/${app_name}" | ||
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,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
TOOL_SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "$TOOL_SOURCE" ] ; do TOOL_SOURCE="$(readlink "$TOOL_SOURCE")"; done | ||
SDLC_DIR="$( cd -P "$( dirname "$TOOL_SOURCE" )" && pwd )" | ||
PRJ_HOME="$( cd -P "$( dirname "$SDLC_DIR" )" && pwd )" | ||
|
||
source "${SDLC_DIR}/config" | ||
DIST_DIR="${PRJ_HOME}/${DIST_DIR}" | ||
CMDS_DIR="${PRJ_HOME}/cmd" | ||
|
||
buildtime=$(TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ') | ||
git_hash="$(git rev-parse HEAD)" | ||
git_dirty="$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)" | ||
git_commit="${git_hash}${git_dirty}" | ||
echo "building ${GH_REPO}" | ||
echo "version : ${APP_VERSION}" | ||
echo "git : ${git_commit}" | ||
echo "build time : ${buildtime}" | ||
|
||
[[ -z "$DIST_DIR" ]] && { | ||
echo "no dist dir set" | ||
exit 1 | ||
} | ||
|
||
[[ -d "${PRJ_HOME}/bin" ]] && rm -r "${PRJ_HOME}/bin" | ||
[[ -d "$DIST_DIR" ]] && rm -r "$DIST_DIR" | ||
mkdir -p "$DIST_DIR" | ||
|
||
platforms="windows/amd64 linux/amd64 darwin/amd64" | ||
|
||
for dir in $(find "$CMDS_DIR" -mindepth 1 -maxdepth 1 -type d); do | ||
app_name=$(basename "$dir") | ||
echo " ===== Process ${app_name} ${dir} =====" | ||
for platform in $platforms; do | ||
cd "$PRJ_HOME" | ||
target_goos=$(echo $platform | cut -d/ -f1) | ||
target_goarch=$(echo $platform | cut -d/ -f2) | ||
echo "building for ${target_goos} ${target_goarch}" | ||
platform_dist_basename="${GH_REPO}-${APP_VERSION}_${target_goos}_${target_goarch}" | ||
platform_dist_dir="${DIST_DIR}/${platform_dist_basename}" | ||
mkdir -p "$platform_dist_dir" | ||
ext='' | ||
[[ "windows" = "$target_goos" ]] && ext='.exe' | ||
built="${PRJ_HOME}/bin/${app_name}-${target_goos}-${target_goarch}${ext}" | ||
GOOS="$target_goos" GOARCH="$target_goarch" go build -ldflags "-s \ | ||
-X github.com/${GH_OWNER}/${GH_REPO}/lib/core.Version=${APP_VERSION} \ | ||
-X github.com/${GH_OWNER}/${GH_REPO}/lib/core.BuildTime=${buildtime} \ | ||
-X github.com/${GH_OWNER}/${GH_REPO}/lib/core.GitCommit=${git_commit}" \ | ||
-o "$built" \ | ||
"github.com/${GH_OWNER}/${GH_REPO}/cmd/${app_name}" | ||
[[ -e "$built" ]] || { | ||
echo "expected file not found: ${built}" | ||
exit 1 | ||
} | ||
mv "${PRJ_HOME}/bin/${app_name}-${target_goos}-${target_goarch}${ext}" "${platform_dist_dir}/${app_name}${ext}" | ||
# cd "$DIST_DIR" | ||
# zip -r "${platform_dist_basename}.zip" "$platform_dist_basename" | ||
# rm -r "$platform_dist_basename" | ||
done | ||
done | ||
|
||
cd "$DIST_DIR" | ||
for dir in $(find "$DIST_DIR" -mindepth 1 -maxdepth 1 -type d); do | ||
dist_folder=$(basename "$dir") | ||
echo " ===== Create dist ${dist_folder} ${dir} =====" | ||
zip -r "${dist_folder}.zip" "$dist_folder" | ||
rm -r "$dist_folder" | ||
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,49 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
TOOL_SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "$TOOL_SOURCE" ] ; do TOOL_SOURCE="$(readlink "$TOOL_SOURCE")"; done | ||
SDLC_DIR="$( cd -P "$( dirname "$TOOL_SOURCE" )" && pwd )" | ||
PRJ_HOME="$( cd -P "$( dirname "$SDLC_DIR" )" && pwd )" | ||
|
||
source "${SDLC_DIR}/config" | ||
app_name="$GH_REPO" | ||
|
||
SRC_DIR="${PRJ_HOME}/src" | ||
CMDS_DIR="${PRJ_HOME}/cmd" | ||
BIN_DIR="${PRJ_HOME}/bin" | ||
|
||
[[ -d "${PRJ_HOME}/bin" ]] && rm -r "${PRJ_HOME}/bin" | ||
|
||
hash golint 2>/dev/null || { | ||
go get -u github.com/golang/lint/golint | ||
} | ||
|
||
hash goimports 2>/dev/null || { | ||
go get golang.org/x/tools/cmd/goimports | ||
} | ||
|
||
cd "${PRJ_HOME}" | ||
|
||
for dir in $(find "$CMDS_DIR" -mindepth 1 -maxdepth 1 -type d); do | ||
app_name=$(basename "$dir") | ||
echo "===== Process ${app_name} [${dir}]" | ||
cd "$dir" | ||
echo "----- golint" | ||
diff <(golint ./...) <(printf "") | ||
echo "----- go fmt" | ||
go fmt ./... | ||
echo "----- go vet" | ||
go vet ./... | ||
echo "----- goimports" | ||
goimports -w . | ||
diff <(goimports -d .) <(printf "") | ||
cd "$PRJ_HOME" | ||
echo "----- go build" | ||
# we need binaries for some e2e test | ||
go build -o "${BIN_DIR}/${app_name}" "github.com/${GH_OWNER}/${GH_REPO}/cmd/${app_name}" | ||
cd "$dir" | ||
echo "----- go test -cover ./..." | ||
go test -cover ./... | ||
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ GH_OWNER='enr' | |
GH_REPO='dups' | ||
DIST_DIR='dist' | ||
|
||
APP_VERSION='0.2' | ||
APP_VERSION='0.3.0' |
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,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
TOOL_SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "$TOOL_SOURCE" ] ; do TOOL_SOURCE="$(readlink "$TOOL_SOURCE")"; done | ||
SDLC_DIR="$( cd -P "$( dirname "$TOOL_SOURCE" )" && pwd )" | ||
PRJ_HOME="$( cd -P "$( dirname "$SDLC_DIR" )" && pwd )" | ||
|
||
cd "$PRJ_HOME" | ||
|
||
command -v dep >/dev/null || { | ||
echo "dep not found" | ||
exit 1 | ||
} | ||
|
||
dep ensure -update -v |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,42 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/enr/go-commons" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/enr/go-files" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/enr/runcmd" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.