k8c.io/api/v3@v3.0.0-20230904060738-b0a93889c0b6/hack/verify.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2023 The Kubermatic Kubernetes Platform contributors. 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 -euo pipefail 18 19 cd $(dirname $0)/.. 20 source hack/lib.sh 21 22 EXIT_CODE=0 23 24 try() { 25 local title="$1" 26 shift 27 28 heading "$title" 29 echo -e "$@\n" 30 31 start_time=$(date +%s) 32 33 set +e 34 $@ 35 exitCode=$? 36 set -e 37 38 elapsed_time=$(($(date +%s) - $start_time)) 39 TEST_NAME="$title" write_junit $exitCode "$elapsed_time" 40 41 if [[ $exitCode -eq 0 ]]; then 42 echo -e "\n[${elapsed_time}s] SUCCESS :)" 43 else 44 echo -e "\n[${elapsed_time}s] FAILED." 45 EXIT_CODE=1 46 fi 47 48 git reset --hard --quiet 49 git clean --force 50 51 echo 52 } 53 54 try "Verify go.mod" make check-dependencies 55 try "Verify boilerplate" ./hack/verify-boilerplate.sh 56 try "Verify code generation" ./hack/verify-codegen.sh 57 try "Verify license compatibility" ./hack/verify-licenses.sh 58 59 exit $EXIT_CODE