forked from go-nv/goenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (42 loc) · 1.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.ONESHELL:
.PHONY: test test-goenv test-goenv-go-build bats start-fake-go-build-http-server stop-fake-go-build-http-server run-goenv-go-build-tests
default: test
test: test-goenv test-goenv-go-build
test-goenv: bats
set -e
PATH="./bats-core/bin:$$PATH"
if [ -n "$$GOENV_NATIVE_EXT" ]; then
src/configure
make -C src
fi
test_target=$${test_target:-test}
exec bats $${CI:+--tap} $$test_target
test-goenv-go-build: bats stop-fake-go-build-http-server start-fake-go-build-http-server run-goenv-go-build-tests stop-fake-go-build-http-server
stop-fake-go-build-http-server:
pkill fake_file_server || true
run-goenv-go-build-tests:
set -e
PATH="$$(pwd)/bats-core/bin:$$PATH"
if [ -n "$$GOENV_NATIVE_EXT" ]; then
src/configure
make -C src
fi
test_target=$${test_target:-test}
cd plugins/go-build
exec bats $${CI:+--tap} $$test_target
start-fake-go-build-http-server:
set -e
port=$${port:-8090}
cd plugins/go-build/test
(bash -c "exec -a fake_file_server python3 fake_file_server.py $$port") &
until lsof -Pi :$${port} -sTCP:LISTEN -t >/dev/null; do
echo "wait"
sleep 2
done
bats:
set -e
if [ -d "$(PWD)/bats-core" ]; then
echo "bats-core already exists. Nothing to do" ;
else
git clone --depth 1 --single-branch --branch=v1.1.0 https://github.com/bats-core/bats-core.git ;
fi