This repository was archived by the owner on Mar 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
63 lines (46 loc) · 1.68 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
59
60
61
62
63
BIN=./build/bubbly
# env vars for running tests
export BUBBLY_HOST=localhost
export BUBBLY_PORT=8111
# Current commit id and (if set) the tag are compiled into the Bubbly binary
commit := $(shell git rev-list -1 HEAD)
version := $(shell git describe --tags --dirty=-dirty)
pre := github.com/valocode/bubbly
all: build
.PHONY: build
build:
go build -o ${BIN} -ldflags "-X 'main.commit=${commit}' -X 'main.version=${version}'"
.PHONY: clean
clean:
rm ${BIN}
## testing
test: test-unit
test-unit:
go test ./...
test-verbose:
go test -v ./...
test-coverage:
go test -coverprofile=coverage.txt -covermode=atomic ./...
display-coverage: test-coverage
go tool cover -html=coverage.txt
test-report:
go test -coverprofile=coverage.txt -covermode=atomic -json ./... > test_report.json
# The integration tests depend on Bubbly Server and its Store (currently Postgres) being accessible.
# This is what the env variables in the beginning of this Makefile are for.
# The count flag prevents Go from caching test results as they are dependent on the DB content.
test-integration:
go test ./integration -tags=integration -count=1
.PHONY: dev
dev:
docker-compose up --build --abort-on-container-exit --remove-orphans
# Run this target in a separate terminal once `dev` is up to get Postgres console access
psql:
docker container exec -it postgres psql -U ${POSTGRES_USER}
# Cleanup the docker things: network, volumes, services
cleanup:
docker-compose down
# Project is CI-enabled with Github Actions. You can run CI locally
# using act (https://github.com/nektos/act).
# There are some caveats, but the following target should work:
act:
act -P ubuntu-latest=golang:latest --env-file act.env -j simple