Make test fails due to keeping github.com autogenerated folder in root (#1713)
This commit is contained in:
parent
def9e1d688
commit
8959618471
|
|
@ -20,6 +20,6 @@ jobs:
|
||||||
- name: Compile
|
- name: Compile
|
||||||
run: make linux
|
run: make linux
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: go test ./...
|
run: make test
|
||||||
- name: Run end-2-end tests
|
- name: Run end-2-end tests
|
||||||
run: make e2e
|
run: make e2e
|
||||||
|
|
|
||||||
3
Makefile
3
Makefile
|
|
@ -103,5 +103,8 @@ test:
|
||||||
hack/verify-codegen.sh
|
hack/verify-codegen.sh
|
||||||
GO111MODULE=on go test ./...
|
GO111MODULE=on go test ./...
|
||||||
|
|
||||||
|
codegen:
|
||||||
|
hack/update-codegen.sh
|
||||||
|
|
||||||
e2e: docker # build operator image to be tested
|
e2e: docker # build operator image to be tested
|
||||||
cd e2e; make e2etest
|
cd e2e; make e2etest
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,22 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
GENERATED_PACKAGE_ROOT="github.com"
|
||||||
|
OPERATOR_PACKAGE_ROOT="${GENERATED_PACKAGE_ROOT}/zalando/postgres-operator"
|
||||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
|
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
|
||||||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ${GOPATH}/src/k8s.io/code-generator)}
|
TARGET_CODE_DIR=${1-${SCRIPT_ROOT}/pkg}
|
||||||
|
CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo "${GOPATH}"/src/k8s.io/code-generator)}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
rm -rf "${GENERATED_PACKAGE_ROOT}"
|
||||||
|
}
|
||||||
|
trap "cleanup" EXIT SIGINT
|
||||||
|
|
||||||
bash "${CODEGEN_PKG}/generate-groups.sh" all \
|
bash "${CODEGEN_PKG}/generate-groups.sh" all \
|
||||||
github.com/zalando/postgres-operator/pkg/generated github.com/zalando/postgres-operator/pkg/apis \
|
"${OPERATOR_PACKAGE_ROOT}/pkg/generated" "${OPERATOR_PACKAGE_ROOT}/pkg/apis" \
|
||||||
"acid.zalan.do:v1" \
|
"acid.zalan.do:v1" \
|
||||||
--go-header-file "${SCRIPT_ROOT}"/hack/custom-boilerplate.go.txt
|
--go-header-file "${SCRIPT_ROOT}"/hack/custom-boilerplate.go.txt
|
||||||
|
|
||||||
|
cp -r "${OPERATOR_PACKAGE_ROOT}"/pkg/* "${TARGET_CODE_DIR}"
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,14 @@ cleanup
|
||||||
mkdir -p "${TMP_DIFFROOT}"
|
mkdir -p "${TMP_DIFFROOT}"
|
||||||
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
|
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
|
||||||
|
|
||||||
"${SCRIPT_ROOT}/hack/update-codegen.sh"
|
"${SCRIPT_ROOT}/hack/update-codegen.sh" "${TMP_DIFFROOT}"
|
||||||
echo "diffing ${DIFFROOT} against freshly generated codegen"
|
echo "diffing ${DIFFROOT} against freshly generated codegen"
|
||||||
ret=0
|
ret=0
|
||||||
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
|
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
|
||||||
cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}"
|
|
||||||
if [[ $ret -eq 0 ]]
|
if [[ $ret -eq 0 ]]
|
||||||
then
|
then
|
||||||
echo "${DIFFROOT} up to date."
|
echo "${DIFFROOT} up to date."
|
||||||
else
|
else
|
||||||
echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh"
|
echo "${DIFFROOT} is out of date. Please run 'make codegen'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build !ignore_autogenerated
|
||||||
// +build !ignore_autogenerated
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue