-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
105 lines (91 loc) · 3.5 KB
/
Taskfile.yml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
version: "3"
tasks:
build-transitland-route-geometry-generator-dev:
desc: Build transitland-route-geometry-generator executable with support for debugging
deps:
- task: template/go-build-dev
vars:
CMD_NAME: transitland-route-geometry-generator
run-transitland-route-geometry-generator-debug:
desc: "Run transitland-route-geometry-generator binary with delve"
deps:
- task: template/go-run-debug
vars:
CMD_NAME: transitland-route-geometry-generator
build-transitland-route-geometry-generator-prod:
desc: "Build transitland-route-geometry-generator binary for production release"
deps:
- task: template/go-build-binary
vars:
CMD_NAME: "transitland-route-geometry-generator"
build-docker-transitland-route-geometry-generator:
desc: "Build transitland-route-geometry-generator prod container"
deps:
- task: template/docker-build
vars:
IMAGE_NAME: transitland-route-geometry-generator
DOCKER_FILE_PATH: ./docker/transitland-route-geometry-generator.dockerfile
push-docker-transitland-route-geometry-generator:
desc: "Push transitland-route-geometry-generator prod container to nexus"
deps:
- task: template/docker-push
vars:
IMAGE_NAME: transitland-route-geometry-generator
# Group commands
build-and-push-docker-images:
desc: "Build all images, then push to nexus"
# first run build, and only after push
cmds:
- task: build-docker-images
- task: push-docker-images
build-docker-images:
desc: "Build all images"
# do all the builds in parallel
deps:
- task: build-docker-transitland-route-geometry-generator
push-docker-images:
desc: "Push all images to nexus"
# do all the pushes in parallel
deps:
- task: push-docker-transitland-route-geometry-generator
lint:
desc: "lint the project"
cmds:
- golangci-lint -v run
# templates
template/go-build-binary:
env:
CGO_ENABLED: 0
vars:
GO_VERSION:
sh: go version | { read _ _ v _; echo ${v#go}; }
VERSION:
sh: git describe --tags --always --dirty --match=v* 2> /dev/null || cat $(CURDIR)/.version 2> /dev/null || echo v0
BUILD_DATE:
sh: date +%Y%m%d%H%M%S
cmds:
- go build -ldflags '-X "github.com/phoops/transitland-route-geometry-generator/internal/commands.CliVersion={{.VERSION}}" -X "github.com/phoops/transitland-route-geometry-generator/internal/commands.GoVersion={{.GO_VERSION}}" -X "github.com/phoops/transitland-route-geometry-generator/internal/commands.BuildDate={{ .BUILD_DATE }}"' -o ./build/{{.CMD_NAME}} ./cmd/{{.CMD_NAME}}
template/go-build-dev:
cmds:
- go build -gcflags="all=-N -l" -o ./build/{{.CMD_NAME}} ./cmd/{{.CMD_NAME}}
template/go-run-debug:
cmds:
- dlv --continue --listen=:40001 --headless=true --api-version=2 --accept-multiclient exec ./build/{{.CMD_NAME}}
template/docker-build:
vars:
IMAGE_REPO_BASE: "phoops"
TAG:
sh: echo "$RELEASE_TAG"
LOCAL_IMAGE: "{{.IMAGE_NAME}}:{{.TAG}}"
REMOTE_IMAGE: "{{.IMAGE_REPO_BASE}}/{{.LOCAL_IMAGE}}"
cmds:
- docker build -f '{{.DOCKER_FILE_PATH}}' -t '{{.LOCAL_IMAGE}}' -t '{{.REMOTE_IMAGE}}' .
template/docker-push:
vars:
IMAGE_REPO_BASE: "phoops"
TAG:
sh: echo $RELEASE_TAG
LOCAL_IMAGE: "{{.IMAGE_NAME}}:{{.TAG}}"
REMOTE_IMAGE: "{{.IMAGE_REPO_BASE}}/{{.LOCAL_IMAGE}}"
cmds:
- docker push '{{.REMOTE_IMAGE}}'