#!/usr/bin/make -f

# Exclude cas/cloudcas, kms/cloudkms and cmd/step-cloudkms-init until
# golang-google-cloud in Debian has been updated to v0.83.0+
export DH_GOLANG_EXCLUDES := \
	cmd \
	cas/cloudcas \
	kms/cloudkms \
	kms/azurekms \
	cas/vaultcas \
	examples \
	scripts/badger-migration \
	# EOF

export DH_GOLANG_INSTALL_EXTRA := authority/provisioner/aws_certificates.pem

%:
	dh $@ --builddirectory=_build --buildsystem=golang

execute_before_dh_auto_configure:
	chmod -v -x policy/engine.go policy/engine_test.go policy/options.go
	rm -fv authority/provisioner/nebula*.go

override_dh_auto_install:
	dh_auto_install -- --no-binaries

# TestCustomTemplateOptions: https://github.com/smallstep/certificates/issues/2441
SKIP_TESTS="Test_newHTTPClient|TestPKI_GenerateConfig|TestDB_GetDpopToken|TestDB_CreateDpopToken|TestDB_GetOidcToken|TestDB_CreateOidcToken|TestCustomTemplateOptions"
override_dh_auto_test:
	dh_auto_test $(DH_BUILD_OPTS) -- -skip $(SKIP_TESTS)
	-timeout 5m dh_auto_test $(DH_BUILD_OPTS) -- -run $(SKIP_TESTS)
