Improve makefile
This commit is contained in:
parent
34d2a816c2
commit
39b0aa6650
21 changed files with 162 additions and 290 deletions
|
@ -1,30 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
rm -f dist/traefik
|
||||
|
||||
FLAGS=()
|
||||
if [ -n "${VERBOSE}" ]; then
|
||||
FLAGS+=(-v)
|
||||
fi
|
||||
|
||||
if [ -z "${VERSION}" ]; then
|
||||
VERSION=$(git rev-parse HEAD)
|
||||
fi
|
||||
|
||||
if [ -z "$CODENAME" ]; then
|
||||
CODENAME=cheddar
|
||||
fi
|
||||
|
||||
if [ -z "$DATE" ]; then
|
||||
DATE=$(date -u '+%Y-%m-%d_%I:%M:%S%p')
|
||||
fi
|
||||
|
||||
# Build binaries
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
CGO_ENABLED=0 GOGC=off go build ${FLAGS[*]} -ldflags "-s -w \
|
||||
-X github.com/traefik/traefik/v2/pkg/version.Version=$VERSION \
|
||||
-X github.com/traefik/traefik/v2/pkg/version.Codename=$CODENAME \
|
||||
-X github.com/traefik/traefik/v2/pkg/version.BuildDate=$DATE" \
|
||||
-installsuffix nocgo -o dist/traefik ./cmd/traefik
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
go generate
|
|
@ -1,35 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://proxy.golang.org
|
||||
|
||||
# List of bundles to create when no argument is passed
|
||||
DEFAULT_BUNDLES=(
|
||||
generate
|
||||
validate-lint
|
||||
binary
|
||||
|
||||
test-unit
|
||||
test-integration
|
||||
)
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd -P)"
|
||||
|
||||
bundle() {
|
||||
local bundle="$1"; shift
|
||||
echo "---> Making bundle: $(basename "${bundle}") (in $SCRIPT_DIR)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${SCRIPT_DIR}/${bundle}"
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
bundles=${DEFAULT_BUNDLES[*]}
|
||||
else
|
||||
bundles=${*}
|
||||
fi
|
||||
# shellcheck disable=SC2048
|
||||
for bundle in ${bundles[*]}; do
|
||||
bundle "${bundle}"
|
||||
echo
|
||||
done
|
28
script/release-packages.sh
Executable file
28
script/release-packages.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [ -n "${SEMAPHORE_GIT_TAG_NAME}" ]; then
|
||||
echo "Releasing packages..."
|
||||
else
|
||||
echo "Skipping release"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rm -rf dist
|
||||
|
||||
for os in linux darwin windows freebsd openbsd; do
|
||||
goreleaser release --snapshot --skip=publish -p 2 --timeout="90m" --config "$(go run ./internal/release "$os")"
|
||||
go clean -cache
|
||||
done
|
||||
|
||||
cat dist/**/*_checksums.txt >> dist/traefik_${VERSION}_checksums.txt
|
||||
rm dist/**/*_checksums.txt
|
||||
tar cfz dist/traefik-${VERSION}.src.tar.gz \
|
||||
--exclude-vcs \
|
||||
--exclude .idea \
|
||||
--exclude .travis \
|
||||
--exclude .semaphoreci \
|
||||
--exclude .github \
|
||||
--exclude dist .
|
||||
|
||||
chown -R $(id -u):$(id -g) dist/
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
export DEST=.
|
||||
|
||||
echo "Testing against..."
|
||||
docker version
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
go test ./integration -test.timeout=20m -failfast -v ${TESTFLAGS[*]}
|
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
RED=$'\033[31m'
|
||||
GREEN=$'\033[32m'
|
||||
TEXTRESET=$'\033[0m' # reset the foreground colour
|
||||
|
||||
# -failfast -timeout=5m
|
||||
TESTFLAGS=(-cover "-coverprofile=cover.out" "${TESTFLAGS}")
|
||||
|
||||
if [ -n "${VERBOSE}" ]; then
|
||||
TESTFLAGS+=(-v)
|
||||
elif [ -n "${VERBOSE_UNIT}" ]; then
|
||||
TESTFLAGS+=(-v)
|
||||
fi
|
||||
|
||||
set +e
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
go test ${TESTFLAGS[*]} ./pkg/...
|
||||
|
||||
CODE=$?
|
||||
if [ ${CODE} != 0 ]; then
|
||||
echo "${RED}Tests failed [code ${CODE}].${TEXTRESET}"
|
||||
exit ${CODE}
|
||||
else
|
||||
echo "${GREEN}Tests succeed.${TEXTRESET}"
|
||||
fi
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
golangci-lint run
|
Loading…
Add table
Add a link
Reference in a new issue