-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (51 loc) · 1.74 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
.PHONY: default build test docker_test docker_build docker_push docker_nightly
.PHONY: web
web:
KRAB_AUTH=none \
KRAB_AUTH_BASIC_USERNAME=krab \
KRAB_AUTH_BASIC_PASSWORD=secret \
DATABASE_URL="postgres://krab:secret@localhost:5432/krab?sslmode=disable" \
air
.PHONY: gen
gen:
templ generate
.PHONY: install
install:
go install github.com/cosmtrek/air@latest
go install github.com/a-h/templ/cmd/templ@latest
default:
export DATABASE_URL="postgres://krab:secret@localhost:5432/krab?sslmode=disable" && \
export KRAB_ENV=test && \
export KRAB_DIR=./test/fixtures/tests && \
make build && \
./bin/krab test && \
echo "ok"
build:
mkdir -p bin/
go build -o bin/krab main.go
test:
DATABASE_URL="postgres://krab:secret@localhost:5432/krab?sslmode=disable&prefer_simple_protocol=true" go test -v ./... && echo "☑️ "
docker_test:
docker run --rm -e DATABASE_URL="postgres://krab:secret@localhost:5432/krab?sslmode=disable" \
-v ${HOME}/oh/krab/test/fixtures/simple:/etc/krab:ro ohkrab/krab-cli:${BUILD_VERSION} version
docker_build:
docker build -t ohkrab/krab:${BUILD_VERSION} \
--build-arg BUILD_VERSION=${BUILD_VERSION} \
--build-arg BUILD_COMMIT=${BUILD_COMMIT} \
--build-arg BUILD_DATE=${BUILD_DATE} \
.
docker_push:
docker tag ohkrab/krab:${BUILD_VERSION} ohkrab/krab:latest
docker push ohkrab/krab:${BUILD_VERSION}
docker push ohkrab/krab:latest
docker_nightly:
docker build -t ohkrab/krab:nightly \
--build-arg BUILD_VERSION=nightly \
--build-arg BUILD_COMMIT=$$( git log -1 --pretty="format:%h" ) \
--build-arg BUILD_DATE=$$( date -u +"%Y-%m-%dT%H:%M:%SZ" ) \
.
docker tag ohkrab/krab:nightly ohkrab/krab:latest
docker push ohkrab/krab:nightly
.PHONY: changelog
changelog:
git-chglog -o CHANGELOG.md --next-tag ${TAG}