forked from mittwald/spacectl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
72 lines (65 loc) · 1.71 KB
/
.gitlab-ci.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
stages:
- test
- compile
- publish
go-test:
image: golang:1.9.3-alpine
stage: test
before_script:
- mkdir -p $GOPATH/src/github.com/mittwald
- ln -nfs $PWD $GOPATH/src/github.com/mittwald/spacectl
- cd $GOPATH/src/github.com/mittwald/spacectl
script:
- go test ./...
go-compile:test:
image: golang:1.9.3-alpine
stage: test
before_script:
- mkdir -p $GOPATH/src/github.com/mittwald
- ln -nfs $PWD $GOPATH/src/github.com/mittwald/spacectl
- cd $GOPATH/src/github.com/mittwald/spacectl
script:
- go generate
- go build
.compile-template: &compile_template
image: golang:1.9.3-alpine
stage: compile
before_script:
- mkdir -p $GOPATH/src/github.com/mittwald
- ln -nfs $PWD $GOPATH/src/github.com/mittwald/spacectl
- cd $GOPATH/src/github.com/mittwald/spacectl
script:
- GOOS=linux go generate
- CGO_ENABLED=0 go build -o spacectl-${GOOS}-${GOARCH}${EXT} -ldflags "-s" -a -installsuffix cgo
artifacts:
paths:
- ./spacectl-${GOOS}-${GOARCH}${EXT}
only:
- tags
go-compile:linux-amd64:
<<: *compile_template
variables:
GOOS: linux
GOARCH: amd64
go-compile:darwin:
<<: *compile_template
variables:
GOOS: darwin
GOARCH: amd64
go-compile:windows-amd64:
<<: *compile_template
variables:
GOOS: windows
GOARCH: amd64
EXT: .exe
publish:
stage: publish
image: python:3.5.3-slim
before_script:
- pip install awscli==1.11.117
script:
- echo ${CI_BUILD_TAG} > latest.txt
- aws s3 cp . s3://static.spaces.de/cli/${CI_BUILD_TAG}/ --recursive --exclude "*" --include "spacectl-*" --acl public-read
- aws s3 cp latest.txt s3://static.spaces.de/cli/latest.txt --acl public-read
only:
- tags