-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgomake.yml
59 lines (55 loc) · 1.43 KB
/
gomake.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
vars:
goarchs:
{{range $i, $value := list "amd64" "arm64" "386" "arm" }}
- {{$value}}
{{- end}}
gooss: "darwin|linux|windows"
dist: "dist"
binary: "gomake"
dockername: "fasibio/gomake"
version: "1.0.27"
dockerfile: Dockerfile.gomake
---
{{$root := .}}
buildAll:
script:
{{include "build"}}
{{include "buildDocker"}}
{{include "test"}}
on_failure:
{{include "build"}}
{{include "buildDocker"}}
build:
stage: b
doc: create a Binary for each GOOS and GOARCH
color: "{{$root.Colors.purple}}"
script:
- mkdir {{.Vars.dist}}
{{- range $goosKey, $goos := splitList "|" $root.Vars.gooss}}
{{- range $goarchKey, $goarch := $root.Vars.goarchs}}
- env GOOS={{$goos}} GOARCH={{$goarch}} go build -o {{$root.Vars.dist}}/{{$root.Vars.binary}}_{{$goos}}_{{$goarch}}
{{- end}}
{{- end}}
on_failure:
- rm -rf {{.Vars.dist}}
buildDocker:
stage: b
color: "{{$root.Colors.red}}"
script:
- docker build -t {{$root.Vars.dockername}}:{{$root.Vars.version}} -f {{$root.Vars.dockerfile}} .
on_failure:
- docker rmi {{$root.Vars.dockername}}:{{$root.Vars.version}}
test:
script:
- docker run --rm {{$root.Vars.dockername}}:{{$root.Vars.version}} --help
# Wrap build into a docker image
buildContainer:
color: {{$root.Colors.yellow}}
image:
name: alpine:latest
volumes:
- {{.Env.PWD}}:/build
script:
- cd /build
- ls
on_failure: