This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +41
-9
lines changed Expand file tree Collapse file tree 10 files changed +41
-9
lines changed Original file line number Diff line number Diff line change 46
46
${{ runner.os }}-go-
47
47
48
48
- name : Test
49
+ env :
50
+ BUILD_TAGS : example,local
49
51
run : make -f builder.Makefile test
50
52
51
53
- name : Build
54
+ env :
55
+ BUILD_TAGS : example,local
52
56
run : make -f builder.Makefile cli
53
57
54
58
- name : E2E Test
77
81
${{ runner.os }}-go-
78
82
79
83
- name : Test
84
+ env :
85
+ BUILD_TAGS : example,local
80
86
run : make -f builder.Makefile test
81
87
82
88
- name : Build
89
+ env :
90
+ BUILD_TAGS : example,local
83
91
run : make -f builder.Makefile cli
84
92
85
93
- name : E2E Test
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name: releaser
3
3
on :
4
4
push :
5
5
tags :
6
- - ' v* '
6
+ - " v* "
7
7
jobs :
8
8
upload-release :
9
9
runs-on : ubuntu-latest
32
32
artifacts : " bin/*"
33
33
prerelease : true
34
34
token : ${{ secrets.GITHUB_TOKEN }}
35
-
Original file line number Diff line number Diff line change @@ -32,15 +32,19 @@ FROM base AS make-cli
32
32
ENV CGO_ENABLED=0
33
33
ARG TARGETOS
34
34
ARG TARGETARCH
35
+ ARG BUILD_TAGS
35
36
RUN --mount=target=. \
36
37
--mount=type=cache,target=/root/.cache/go-build \
37
38
GOOS=${TARGETOS} \
38
39
GOARCH=${TARGETARCH} \
40
+ BUILD_TAGS=${BUILD_TAGS} \
39
41
make BINARY=/out/docker -f builder.Makefile cli
40
42
41
43
FROM base AS make-cross
44
+ ARG BUILD_TAGS
42
45
RUN --mount=target=. \
43
46
--mount=type=cache,target=/root/.cache/go-build \
47
+ BUILD_TAGS=${BUILD_TAGS} \
44
48
make BINARY=/out/docker -f builder.Makefile cross
45
49
46
50
FROM scratch AS protos
@@ -53,7 +57,9 @@ FROM scratch AS cross
53
57
COPY --from=make-cross /out/* .
54
58
55
59
FROM base as test
60
+ ARG BUILD_TAGS
56
61
ENV CGO_ENABLED=0
57
62
RUN --mount=target=. \
58
63
--mount=type=cache,target=/root/.cache/go-build \
64
+ BUILD_TAGS=${BUILD_TAGS} \
59
65
make -f builder.Makefile test
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ protos: ## Generate go code from .proto files
42
42
cli : # # Compile the cli
43
43
@docker build . --target cli \
44
44
--platform local \
45
+ --build-arg BUILD_TAGS=example,local \
45
46
--output ./bin
46
47
47
48
e2e-local : # # Run End to end local tests
@@ -55,10 +56,13 @@ e2e-aci: ## Run End to end ACI tests (requires azure login)
55
56
56
57
cross : # # Compile the CLI for linux, darwin and windows
57
58
@docker build . --target cross \
59
+ --build-arg BUILD_TAGS \
58
60
--output ./bin \
59
61
60
62
test : # # Run unit tests
61
- @docker build . --target test
63
+ @docker build . \
64
+ --build-arg BUILD_TAGS=example,local \
65
+ --target test
62
66
63
67
cache-clear : # # Clear the builder cache
64
68
@docker builder prune --force --filter type=exec.cachemount --filter=unused-for=24h
@@ -68,6 +72,7 @@ lint: ## run linter(s)
68
72
69
73
serve : cli # # start server
70
74
@./bin/docker serve --address unix:///tmp/backend.sock
75
+
71
76
classic-link : # # create docker-classic symlink if does not already exist
72
77
ln -s $(CLASSIC_DOCKER ) /usr/local/bin/docker-classic
73
78
Original file line number Diff line number Diff line change @@ -25,8 +25,11 @@ The new CLI delegates to the classic docker for default contexts ; delegation is
25
25
$ make
26
26
```
27
27
28
- If you make changes to the ` .proto ` files, make sure to ` make protos ` to generate go code.
28
+ This will make the cli with all backends enabled. ` make cross ` on the other hand will cross-compile the cli without the
29
+ example and local backend. We use ` make cross ` to build for our release, hence the exclusion of those backends. You can
30
+ still cross-compile with all backends enabled: ` BUILD_TAGS=example,local make cross ` .
29
31
32
+ If you make changes to the ` .proto ` files, make sure to ` make protos ` to generate go code.
30
33
31
34
## Tests
32
35
Original file line number Diff line number Diff line change @@ -40,21 +40,26 @@ GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
40
40
BINARY? =bin/docker
41
41
BINARY_WITH_EXTENSION =$(BINARY )$(EXTENSION )
42
42
43
+ TAGS: =
44
+ ifdef BUILD_TAGS
45
+ TAGS =-tags $(BUILD_TAGS )
46
+ endif
47
+
43
48
all : cli
44
49
45
50
protos :
46
51
@protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS}
47
52
48
53
cli :
49
- GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD ) -o $(BINARY_WITH_EXTENSION ) ./cli
54
+ GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD ) $( TAGS ) -o $(BINARY_WITH_EXTENSION ) ./cli
50
55
51
56
cross :
52
- @GOOS=linux GOARCH=amd64 $(GO_BUILD ) -o $(BINARY ) -linux-amd64 ./cli
53
- @GOOS=darwin GOARCH=amd64 $(GO_BUILD ) -o $(BINARY ) -darwin-amd64 ./cli
54
- @GOOS=windows GOARCH=amd64 $(GO_BUILD ) -o $(BINARY ) -windows-amd64.exe ./cli
57
+ @GOOS=linux GOARCH=amd64 $(GO_BUILD ) $( TAGS ) -o $(BINARY ) -linux-amd64 ./cli
58
+ @GOOS=darwin GOARCH=amd64 $(GO_BUILD ) $( TAGS ) -o $(BINARY ) -darwin-amd64 ./cli
59
+ @GOOS=windows GOARCH=amd64 $(GO_BUILD ) $( TAGS ) -o $(BINARY ) -windows-amd64.exe ./cli
55
60
56
61
test :
57
- @go test -cover $(shell go list ./... | grep -vE 'e2e')
62
+ @go test $( TAGS ) -cover $(shell go list ./... | grep -vE 'e2e')
58
63
59
64
lint :
60
65
golangci-lint run --timeout 10m0s ./...
Original file line number Diff line number Diff line change
1
+ // +build example
2
+
1
3
package example
2
4
3
5
import (
Original file line number Diff line number Diff line change
1
+ package example
Original file line number Diff line number Diff line change
1
+ // +build local
2
+
1
3
package local
2
4
3
5
import (
Original file line number Diff line number Diff line change
1
+ package local
You can’t perform that action at this time.
0 commit comments