forked from chirpstack/chirpstack-gateway-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
77 lines (70 loc) · 2.03 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
73
74
75
76
77
stages:
- test
- build
- package
variables:
PACKAGE_NAME: github.com/brocaar/lora-gateway-bridge
CONTAINER_NAME: $CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
before_script:
- mkdir -p $GOPATH/src/$PACKAGE_NAME
- cp -R . $GOPATH/src/$PACKAGE_NAME
tests:
stage: test
image: golang:latest
services:
- ansi/mosquitto
variables:
TEST_MQTT_SERVER: tcp://ansi-mosquitto:1883
script:
- go get github.com/golang/lint/golint
- go get github.com/kisielk/errcheck
- pushd $GOPATH/src/$PACKAGE_NAME
- make test
- popd
binaries:
stage: build
image: golang:latest
script:
- pushd $GOPATH/src/$PACKAGE_NAME
- make build
- popd
- mkdir build
- cp -R $GOPATH/src/$PACKAGE_NAME/build/* build/
artifacts:
paths:
- build/
gitlab-image:
stage: package
image: docker:git
services:
- "docker:dind"
script:
- cd $GOPATH/src/$PACKAGE_NAME
- docker build -t $CI_PROJECT_NAME .
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" registry.gitlab.com
- docker tag $CI_PROJECT_NAME registry.gitlab.com/$CONTAINER_NAME:$CI_BUILD_REF_NAME
- if [[ "$CI_BUILD_REF_NAME" == "master" ]]; then docker tag $CI_PROJECT_NAME registry.gitlab.com/$CONTAINER_NAME:latest; fi
- docker push registry.gitlab.com/$CONTAINER_NAME
dockerhub-image:
only:
- master@thethingsnetwork/lora-gateway-bridge
stage: package
image: docker:git
services:
- "docker:dind"
script:
- cd $GOPATH/src/$PACKAGE_NAME
- docker build -t $CI_PROJECT_NAME .
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD"
- docker tag $CI_PROJECT_NAME $CONTAINER_NAME:$CI_BUILD_REF_NAME
- docker tag $CI_PROJECT_NAME $CONTAINER_NAME:latest
- docker push $CONTAINER_NAME
azure-binaries:
only:
- master@thethingsnetwork/lora-gateway-bridge
stage: package
image: registry.gitlab.com/thethingsindustries/upload
script:
- cd build
- export STORAGE_CONTAINER=gateway-bridge STORAGE_KEY=$AZURE_STORAGE_KEY ZIP=true TGZ=true PREFIX=$CI_BUILD_REF_NAME/
- upload *