-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathMakefile
More file actions
161 lines (125 loc) · 3.03 KB
/
Makefile
File metadata and controls
161 lines (125 loc) · 3.03 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
GO111MODULE=on
export GO111MODULE
BASE_TAG := $(shell git describe --tags --always --exclude 'nebraska-helm*' 2>/dev/null)
# We work only with one staging tag as per the one staging environment for Nebraska.
# Appending the short hash code helps checking the new deployments by
# asserting the version label in the footer that the hash changed.
TAG := $(shell \
if [ "$(BASE_TAG)" = "staging" ]; then \
echo "staging-$$(git rev-parse --short HEAD)"; \
else \
echo "$(BASE_TAG)"; \
fi)
SHELL = /bin/bash
DOCKER_CMD ?= "docker"
DOCKER_REPO ?= "ghcr.io/flatcar"
DOCKER_IMAGE_NEBRASKA ?= "nebraska"
ifndef $(GOPATH)
GOPATH=$(shell go env GOPATH)
export GOPATH
endif
VERSION ?=
ifeq ($(VERSION),)
## Adds a '-dirty' suffix to version string if there are uncommitted changes
changes := $(shell git status ./backend ./frontend --porcelain)
ifeq ($(changes),)
VERSION := $(TAG)
else
VERSION := $(TAG)-dirty
endif
endif
.PHONY: all
all: backend tools frontend
.PHONY: check
check:
$(MAKE) -C backend $@
.PHONY: check-code-coverage
check-code-coverage:
$(MAKE) -C backend $@
.PHONY: coverage.out
coverage.out:
$(MAKE) -C backend $@
.PHONY: print-code-coverage
print-code-coverage:
$(MAKE) -C backend $@
.PHONY: container_id
container_id:
$(MAKE) -C backend $@
.PHONY: check-backend-with-container
check-backend-with-container:
$(MAKE) -C backend $@
.PHONY: frontend
frontend:
$(MAKE) -C frontend
.PHONY: frontend-watch
frontend-watch: run-frontend
run-frontend:
$(MAKE) -C frontend run
.PHONY: frontend-install
frontend-install:
$(MAKE) -C frontend install
.PHONY: frontend-install-ci
frontend-install-ci:
$(MAKE) -C frontend install-ci
.PHONY: frontend-build
frontend-build:
$(MAKE) -C frontend build
.PHONY: frontend-test
frontend-test:
$(MAKE) -C frontend test
.PHONY: test-oidc
test-oidc:
$(MAKE) -C frontend test-oidc
.PHONY: test-oidc-ci
test-oidc-ci:
$(MAKE) -C frontend test-oidc-ci
.PHONY: frontend-lint
frontend-lint:
$(MAKE) -C frontend lint
.PHONY: frontend-tsc
frontend-tsc:
$(MAKE) -C frontend tsc
.PHONY: i18n
i18n:
$(MAKE) -C frontend $@
run:
$(MAKE) -j 2 run-frontend run-backend
run-backend: backend-binary
$(MAKE) -C backend run
.PHONY: backend
backend:
$(MAKE) -C backend
.PHONY: backend-binary
backend-binary:
$(MAKE) -C backend build
.PHONY: test-clean-work-tree-backend
test-clean-work-tree-backend:
$(MAKE) -C backend $@
.PHONY: tools
tools:
$(MAKE) -C backend $@
.PHONY: image
image:
$(DOCKER_CMD) build \
--network=host \
--build-arg NEBRASKA_VERSION=$(VERSION) \
-t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NEBRASKA):$(VERSION)" \
-t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NEBRASKA):latest" \
-f Dockerfile .
.PHONY: container
container: image
.PHONY: backend-ci
backend-ci:
$(MAKE) -C backend ci
.PHONY: run-generators
run-generators:
$(MAKE) -C backend $@
.PHONY: build-backend-binary
build-backend-binary:
$(MAKE) -C backend build
.PHONY: backend-code-checks
backend-code-checks:
$(MAKE) -C backend code-checks
.PHONY: swagger-install
swagger-install:
$(MAKE) -C backend tools/swag