...
1#!/bin/bash
2
3# Copyright 2019 Google LLC
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
17set -o errexit
18set -o nounset
19set -o pipefail
20
21PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
22
23# We can't install in the current directory without changing the current module.
24TMP_DIR="$(mktemp -d)"
25export PATH="${PATH}:${TMP_DIR}/bin"
26export GOPATH="${TMP_DIR}"
27pushd ${TMP_DIR}
28trap popd EXIT
29go install honnef.co/go/tools/cmd/staticcheck@v0.3.3
30popd
31
32pushd ${PROJECT_ROOT}
33trap popd EXIT
34
35staticcheck ./pkg/...
36
37# Verify that all source files are correctly formatted.
38find . -name "*.go" | grep -v vendor/ | xargs gofmt -d -e -l
39
40# Verify that generated crane docs are up-to-date.
41mkdir -p /tmp/gendoc && go run cmd/crane/help/main.go --dir /tmp/gendoc && diff -Naur /tmp/gendoc/ cmd/crane/doc/
42
43go test ./...
44./pkg/name/internal/must_test.sh
45
46./cmd/crane/rebase_test.sh
47
48pushd ${PROJECT_ROOT}/cmd/krane
49trap popd EXIT
50go build ./...
51
52pushd ${PROJECT_ROOT}/pkg/authn/k8schain
53trap popd EXIT
54go build ./...
55
56pushd ${PROJECT_ROOT}/pkg/authn/kubernetes
57trap popd EXIT
58go test ./...
View as plain text