Skip to content

Commit 7774218

Browse files
authored
Update dev scripts (#18)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 38eb35c commit 7774218

File tree

6 files changed

+61
-16
lines changed

6 files changed

+61
-16
lines changed

hack/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export GOOS="${OS}"
3535
export GO111MODULE=on
3636
export GOFLAGS="-mod=vendor"
3737

38-
go install \
39-
-installsuffix "static" \
38+
go install \
39+
-installsuffix "static" \
4040
-ldflags " \
4141
-X main.Version=${VERSION} \
4242
-X main.VersionStrategy=${version_strategy:-} \
@@ -47,5 +47,5 @@ go install \
4747
-X main.GoVersion=$(go version | cut -d " " -f 3) \
4848
-X main.Compiler=$(go env CC) \
4949
-X main.Platform=${OS}/${ARCH} \
50-
" \
50+
" \
5151
./...

hack/coverage.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright The Stash Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -eou pipefail
18+
19+
GOPATH=$(go env GOPATH)
20+
REPO_ROOT="$GOPATH/src/stash.appscode.dev/stash"
21+
22+
pushd $REPO_ROOT
23+
24+
echo "" >coverage.txt
25+
26+
for d in $(go list ./... | grep -v -e vendor -e test); do
27+
go test -v -race -coverprofile=profile.out -covermode=atomic "$d"
28+
if [ -f profile.out ]; then
29+
cat profile.out >>coverage.txt
30+
rm profile.out
31+
fi
32+
done
33+
34+
popd

hack/e2e.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ DOCKER_REGISTRY=${DOCKER_REGISTRY:-}
2626

2727
echo "Running e2e tests:"
2828
cmd="ginkgo -r --v -race --progress --trace --noisyPendings=false ${GINKGO_ARGS} test -- --docker-registry=${DOCKER_REGISTRY} ${TEST_ARGS}"
29-
echo $cmd; $cmd
29+
echo $cmd
30+
$cmd

hack/fmt.sh

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,27 @@ export GOFLAGS="-mod=vendor"
2222

2323
TARGETS="$@"
2424

25-
echo "Running reimport.py"
26-
cmd="reimport3.py ${REPO_PKG} ${TARGETS}"
27-
$cmd
28-
echo
25+
if [ -n "$TARGETS" ]; then
26+
echo "Running reimport.py"
27+
cmd="reimport3.py ${REPO_PKG} ${TARGETS}"
28+
$cmd
29+
echo
2930

30-
echo "Running goimports:"
31-
cmd="goimports -w ${TARGETS}"
32-
echo $cmd; $cmd
33-
echo
31+
echo "Running goimports:"
32+
cmd="goimports -w ${TARGETS}"
33+
echo "$cmd"
34+
$cmd
35+
echo
36+
37+
echo "Running gofmt:"
38+
cmd="gofmt -s -w ${TARGETS}"
39+
echo "$cmd"
40+
$cmd
41+
echo
42+
fi
3443

35-
echo "Running gofmt:"
36-
cmd="gofmt -s -w ${TARGETS}"
37-
echo $cmd; $cmd
44+
echo "Running shfmt:"
45+
cmd="find . -path ./vendor -prune -o -name '*.sh' -exec shfmt -l -w -ci -i 4 {} \;"
46+
echo "$cmd"
47+
eval "$cmd" # xref: https://stackoverflow.com/a/5615748/244009
3848
echo

hack/gendocs/make.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
1817
pushd $GOPATH/src/stash.appscode.dev/cli/hack/gendocs
1918
go run main.go
2019
popd

hack/license/go.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16+

0 commit comments

Comments
 (0)