blob: 82c10f6bd2b5f44527a4e4acf2686cc8513737e5 (
plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
TEMPDIR := `mktemp -d`
BUILDDIR := "_build"
ALL_VERSIONS := BUILDDIR / "ALL_VERSIONS"
NEW_VERSION := BUILDDIR / "NEW_VERSION"
CURRENT_VERSION := BUILDDIR / "CURRENT_VERSION"
COMMIT := `git rev-parse --short HEAD`
TAGS := `git tag -l`
default:
@just --choose
docker-build: new-ver
new_ver=$(cat {{ NEW_VERSION }}); \
docker build --build-arg="version=$new_ver" -t unbound-ads:$new_ver .
builddir:
mkdir -p {{ BUILDDIR }}/etc
mkdir -p {{ BUILDDIR }}/bin
clean:
rm -r {{ BUILDDIR }}
new-ver part="latest": builddir
#!/usr/bin/env bash
set -euxo pipefail
echo "{{ TAGS }}" > {{ ALL_VERSIONS }}
cat {{ ALL_VERSIONS }} | bumpver --last-version patch - > {{ CURRENT_VERSION }}
if [[ {{part}} == "latest" ]];
then
bumpver patch --prerelease --prerelease-fmt 'latest.$KeyArg commit.$BumpInt' -k commit={{COMMIT}} {{ CURRENT_VERSION }} > {{ NEW_VERSION }}
git tag $(cat {{ NEW_VERSION }})
else
bumpver {{part}} <(git tag -l) > {{ NEW_VERSION }}
fi
git-push tag:
git push origin master
git push origin {{ tag }}
git-tag-release:
#!/usr/bin/env bash
set -euxo pipefail
new_ver=$(cat {{ NEW_VERSION }})
current_ver=$(cat {{ CURRENT_VERSION}})
# temp light weight tag for building release notes
git tag $new_ver
echo "v${new_ver} release" > {{ TEMPDIR }}/chglog
git-chglog $current_ver..$new_ver >> {{ TEMPDIR }}/chglog
echo "## Coverage" >> {{ TEMPDIR }}/chglog
echo "" >> {{ TEMPDIR }}/chglog
go tool cover -func={{ TEMPDIR }}/testcover.out >> {{ TEMPDIR }}/chglog
# end temp tag
git tag -d $new_ver
git tag --annotate --sign --cleanup=whitespace --file {{ TEMPDIR }}/chglog ${new_ver}
release part: test builddir (new-ver part) docker-build git-tag-release push
build version: test builddir
CGO_ENABLED=0 go build -a -ldflags "-s -X 'main.Version={{version}}'" -o {{ BUILDDIR }}/bin/unbound-ads main.go
push:
just docker-push; \
just git-push
@echo "pushed to all endpoints"
docker-push registry="public.ecr.aws/s0f9o2k5":
new_ver=$(cat {{ NEW_VERSION }}); \
docker tag unbound-ads:$new_ver {{registry}}/unbound-ads:$new_ver; \
docker push {{registry}}/unbound-ads:$new_ver
run repo=(TEMPDIR):
go run main.go
test:
golangci-lint run
go test -v -coverprofile={{ TEMPDIR }}/testcover.out ./...
go tool cover -func={{ TEMPDIR }}/testcover.out
|