File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ function util::tools::ginkgo::install() {
4040 pushd /tmp > /dev/null || return
4141 GOBIN=" ${dir} " \
4242 go install \
43- github.com/onsi/ginkgo/ginkgo@latest
43+ github.com/onsi/ginkgo/v2/ ginkgo@latest
4444 popd > /dev/null || return
4545 fi
4646}
Original file line number Diff line number Diff line change 1- #! /usr/bin/env bash
2- set -euo pipefail
1+ #! /bin/bash
32
4- # Install required Go tools if not already present
3+ set -e
4+ set -u
5+ set -o pipefail
56
6- # Check for go
7- if ! command -v go & > /dev/null; then
8- echo " ERROR: go is not installed"
7+ function main() {
8+ if [[ " ${CF_STACK:- } " != " cflinuxfs3" && " ${CF_STACK:- } " != " cflinuxfs4" ]]; then
9+ echo " **ERROR** Unsupported stack"
10+ echo " See https://docs.cloudfoundry.org/devguide/deploy-apps/stacks.html for more info"
911 exit 1
10- fi
12+ fi
1113
12- # Check for ginkgo (v2)
13- if ! command -v ginkgo & > /dev/null; then
14- echo " -----> Installing ginkgo v2"
15- go install github.com/onsi/ginkgo/v2/ginkgo@latest
16- fi
14+ local version expected_sha dir
15+ version=" 1.22.5"
16+ expected_sha=" ddb12ede43eef214c7d4376761bd5ba6297d5fa7a06d5635ea3e7a276b3db730"
17+ dir=" /tmp/go${version} "
1718
18- # Check for jq
19- if ! command -v jq & > /dev/null; then
20- echo " ERROR: jq is not installed. Please install jq."
19+ mkdir -p " ${dir} "
20+
21+ if [[ ! -f " ${dir} /bin/go" ]]; then
22+ local url
23+ url=" https://buildpacks.cloudfoundry.org/dependencies/go/go_${version} _linux_x64_${CF_STACK} _${expected_sha: 0: 8} .tgz"
24+
25+ echo " -----> Download go ${version} "
26+ curl " ${url} " \
27+ --silent \
28+ --location \
29+ --retry 15 \
30+ --retry-delay 2 \
31+ --output " /tmp/go.tgz"
32+
33+ local sha
34+ sha=" $( shasum -a 256 /tmp/go.tgz | cut -d ' ' -f 1) "
35+
36+ if [[ " ${sha} " != " ${expected_sha} " ]]; then
37+ echo " **ERROR** SHA256 mismatch: got ${sha} , expected ${expected_sha} "
38+ exit 1
39+ fi
40+
41+ tar xzf " /tmp/go.tgz" -C " ${dir} "
42+ rm " /tmp/go.tgz"
43+ fi
44+
45+ if [[ ! -f " ${dir} /bin/go" ]]; then
46+ echo " **ERROR** Could not download go"
2147 exit 1
22- fi
48+ fi
49+
50+ GoInstallDir=" ${dir} "
51+ export GoInstallDir
52+ }
2353
24- echo " -----> Tools verified "
54+ main " ${ @:- } "
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2- set -euo pipefail
32
4- # Add GOPATH bin to PATH
5- export PATH=" ${PATH} :${HOME} /go/bin"
3+ set -e
4+ set -u
5+ set -o pipefail
66
7- cd " $( dirname " ${BASH_SOURCE[0]} " ) /.."
8- source ./scripts/install_tools.sh
7+ ROOTDIR= " $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd ) "
8+ readonly ROOTDIR
99
10- echo " -----> Running unit tests"
10+ # shellcheck source=SCRIPTDIR/.util/tools.sh
11+ source " ${ROOTDIR} /scripts/.util/tools.sh"
1112
12- # Run ginkgo tests with v2 syntax
13- cd src/java
14- ginkgo -r --skip-package=integration,brats
13+ function main() {
14+ local src
15+ src= " $( find " ${ROOTDIR} /src " -mindepth 1 -maxdepth 1 -type d ) "
1516
16- echo " -----> Unit tests complete"
17+ util::tools::ginkgo::install --directory " ${ROOTDIR} /.bin"
18+ util::tools::buildpack-packager::install --directory " ${ROOTDIR} /.bin"
19+
20+ ginkgo \
21+ -r \
22+ -mod vendor \
23+ --skip-package brats,integration \
24+ ${src}
25+ }
26+
27+ main " ${@:- } "
You can’t perform that action at this time.
0 commit comments