#!/usr/bin/make -f

# Exclude the 'example' directory, which contains binaries
# (usr/bin/{proxy,scp,ssh,stream}) that should not be installed on any real
# system.
export DH_GOLANG_EXCLUDES = example

%:
	dh $@ --builddirectory=debian/.build/upstream --buildsystem=golang

# The upstream test suite requires a running sshd server which is not feasible
# in a post-build environment. Limit tests to `TestGetKeyFile`, which seems to
# be the only test that does not require a sshd server.
override_dh_auto_test:
	# The unit test `TestGetKeyFile` needs data from the `tests/` directory.
	# We copy it into the build area before running the test.
	cp -r tests debian/.build/upstream/src/github.com/appleboy/easyssh-proxy/
	dh_auto_test -- -run '^TestGetKeyFile$$'
