| 1 |
GOFMT ?= gofumpt -l -s |
| 2 |
GO ?= go |
| 3 |
PACKAGES ?= $(shell $(GO) list ./...) |
| 4 |
SOURCES ?= $(shell find . -name "*.go" -type f) |
| 5 |
|
| 6 |
all: lint |
| 7 |
|
| 8 |
fmt: |
| 9 |
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ |
| 10 |
$(GO) install mvdan.cc/gofumpt; \ |
| 11 |
fi |
| 12 |
$(GOFMT) -w $(SOURCES) |
| 13 |
|
| 14 |
vet: |
| 15 |
$(GO) vet $(PACKAGES) |
| 16 |
|
| 17 |
test: |
| 18 |
@$(GO) test -v -cover -coverprofile coverage.txt $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 |
| 19 |
|
| 20 |
clean: |
| 21 |
go clean -x -i ./... |
| 22 |
rm -rf coverage.txt $(EXECUTABLE) $(DIST) vendor |
| 23 |
|
| 24 |
ssh-server: |
| 25 |
adduser -h /home/drone-scp -s /bin/sh -D -S drone-scp |
| 26 |
echo drone-scp:1234 | chpasswd |
| 27 |
mkdir -p /home/drone-scp/.ssh |
| 28 |
chmod 700 /home/drone-scp/.ssh |
| 29 |
cat tests/.ssh/id_rsa.pub >> /home/drone-scp/.ssh/authorized_keys |
| 30 |
cat tests/.ssh/test.pub >> /home/drone-scp/.ssh/authorized_keys |
| 31 |
chmod 600 /home/drone-scp/.ssh/authorized_keys |
| 32 |
chown -R drone-scp /home/drone-scp/.ssh |
| 33 |
# install ssh and start server |
| 34 |
apk add --update openssh openrc |
| 35 |
rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key |
| 36 |
sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config |
| 37 |
sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/g' /etc/ssh/sshd_config |
| 38 |
./tests/entrypoint.sh /usr/sbin/sshd -D & |