Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup build script #1245

Merged
merged 3 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
cd $GOPATH/src/github.com/loadimpact/k6

echo "Building k6..."
CGO_ENABLED=0 GOARCH=$ARCH go build -a -ldflags '-s -w' -o /tmp/k6
CGO_ENABLED=0 GOARCH=$ARCH go build -a -trimpath -ldflags '-s -w' -o /tmp/k6
echo "Done!"

VERSION=${CIRCLE_TAG:1} ./packaging/gen-packages.sh
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.13-alpine as builder
WORKDIR $GOPATH/src/github.com/loadimpact/k6
ADD . .
RUN apk --no-cache add git
RUN CGO_ENABLED=0 go install -a -ldflags "-s -w -X github.com/loadimpact/k6/lib/consts.VersionDetails=$(date --utc -Is)/$(git describe --always --long --dirty)"
RUN CGO_ENABLED=0 go install -a -trimpath -ldflags "-s -w -X github.com/loadimpact/k6/lib/consts.VersionDetails=$(date -u +"%FT%T%z")/$(git describe --always --long --dirty)"

FROM alpine:3.10
RUN apk add --no-cache ca-certificates
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ build_script:
- cd %APPVEYOR_BUILD_FOLDER%
- pandoc -s -f markdown -t rtf -o packaging\LICENSE.rtf LICENSE.md
- go version
- go build -a -ldflags "-s -w" -o packaging\k6.exe
- go build -a -trimpath -ldflags "-s -w" -o packaging\k6.exe
- cd %APPVEYOR_BUILD_FOLDER%\packaging
- candle.exe -arch x64 -dVERSION=%VERSION% k6.wxs
- light.exe -ext WixUIExtension k6.wixobj
Expand Down
10 changes: 5 additions & 5 deletions build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ eval "$(go env)"
VERSION=${1:-$(git describe --tags --always --dirty)}

# To overwrite the version details, pass something as the second arg. Empty string disables it.
VERSION_DETAILS=${2-"$(date --utc --iso-8601=s)/$(git describe --always --long --dirty)"}
VERSION_DETAILS=${2-"$(date -u +"%FT%T%z")/$(git describe --always --long --dirty)"}

na-- marked this conversation as resolved.
Show resolved Hide resolved
make_archive() {
local FMT="$1" DIR="$2"
Expand All @@ -28,7 +28,7 @@ build_dist() {
local DIR="k6-${VERSION}-${ALIAS}"

local BUILD_ENV=("${@:4}")
local BUILD_ARGS=(-o "dist/$DIR/k6${SUFFIX}")
local BUILD_ARGS=(-o "dist/$DIR/k6${SUFFIX}" -trimpath)

if [ -n "$VERSION_DETAILS" ]; then
BUILD_ARGS+=(-ldflags "-X github.com/loadimpact/k6/lib/consts.VersionDetails=$VERSION_DETAILS")
Expand Down Expand Up @@ -60,16 +60,16 @@ checksum() {
local CHECKSUM_FILE="k6-${VERSION}-checksums.txt"

if command -v sha256sum > /dev/null; then
CHECKSUM_CMD="sha256sum"
CHECKSUM_CMD=("sha256sum")
elif command -v shasum > /dev/null; then
CHECKSUM_CMD="shasum -a 256"
CHECKSUM_CMD=("shasum" "-a" "256")
na-- marked this conversation as resolved.
Show resolved Hide resolved
else
echo "ERROR: unable to find a command to compute sha-256 hash"
return 1
fi

rm -f "dist/$CHECKSUM_FILE"
( cd dist && for x in *; do "$CHECKSUM_CMD" "$x" >> "$CHECKSUM_FILE"; done )
( cd dist && for x in *; do [ -f "$x" ] && "${CHECKSUM_CMD[@]}" -- "$x" >> "$CHECKSUM_FILE"; done )
}

echo "--- Building Release: ${VERSION}"
Expand Down