mirror of
https://github.com/ysoftdevs/terraform-provider-bitbucketserver.git
synced 2026-05-01 13:04:12 +02:00
Initial Commit
This commit is contained in:
31
scripts/build.sh
Executable file
31
scripts/build.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd `dirname $0`
|
||||
cd ..
|
||||
|
||||
# This script builds executables for multiple platforms and architectures
|
||||
# it is used by the CI system to output releases. When testing locally it shouldn't be required
|
||||
# unless you wish to share a build with someone on a different platform
|
||||
platforms=("linux/amd64" "windows/amd64" "windows/386" "darwin/amd64" "linux/386" "linux/arm")
|
||||
|
||||
for platform in "${platforms[@]}"
|
||||
do
|
||||
platform_split=(${platform//\// })
|
||||
GOOS=${platform_split[0]}
|
||||
GOARCH=${platform_split[1]}
|
||||
CGO_ENABLED=0
|
||||
output_name='./bin/terraform-provider-bitbucketserver-'$GOOS'-'$GOARCH
|
||||
if [ $GOOS = "windows" ]; then
|
||||
output_name+='.exe'
|
||||
fi
|
||||
echo "Building for $GOOS $GOARCH..."
|
||||
|
||||
GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=$CGO_ENABLED go build -a -installsuffix cgo -o $output_name
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo 'An error has occurred! Aborting the script execution...'
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Completed builds, for output see ./bin"
|
||||
24
scripts/errcheck.sh
Executable file
24
scripts/errcheck.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Check gofmt
|
||||
echo "==> Checking for unchecked errors..."
|
||||
|
||||
if ! which errcheck > /dev/null; then
|
||||
echo "==> Installing errcheck..."
|
||||
go get -u github.com/kisielk/errcheck
|
||||
fi
|
||||
|
||||
err_files=$(errcheck -ignoretests \
|
||||
-ignore 'github.com/hashicorp/terraform/helper/schema:Set' \
|
||||
-ignore 'bytes:.*' \
|
||||
-ignore 'io:Close|Write' \
|
||||
$(go list ./...| grep -v /vendor/))
|
||||
|
||||
if [[ -n ${err_files} ]]; then
|
||||
echo 'Unchecked errors found in the following places:'
|
||||
echo "${err_files}"
|
||||
echo "Please handle returned errors. You can check directly with \`make errcheck\`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
13
scripts/gofmtcheck.sh
Executable file
13
scripts/gofmtcheck.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Check gofmt
|
||||
echo "==> Checking that code complies with gofmt requirements..."
|
||||
gofmt_files=$(gofmt -l `find . -name '*.go' | grep -v vendor`)
|
||||
if [[ -n ${gofmt_files} ]]; then
|
||||
echo 'gofmt needs running on the following files:'
|
||||
echo "${gofmt_files}"
|
||||
echo "You can use the command: \`make fmt\` to reformat code."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user