forked from TheThingsArchive/packet_forwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
123 lines (115 loc) · 3.77 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
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
stages:
- build
- sign
- package
cache:
key: "$CI_PROJECT_PATH"
paths:
- .govendor
- go
before_script:
# Creating release path
- mkdir release
# Go build environment variables
- export GOROOT=$PWD/go
- export GOPATH=$PWD/gopath
- export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# Creating govendor cache folder
- mkdir -p $PWD/.govendor
- rm -rf $GOPATH
- mkdir -p $GOPATH/.cache && ln -s $PWD/.govendor $GOPATH/.cache/govendor
# Downloading go if not installed yet
- apt-get update -y && apt-get install make git tar -y
- "([[ ! $(go version) =~ \"version\" ]] && apt-get install wget -y && wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz && tar -C $PWD -xvzf go1.8.1.linux-amd64.tar.gz) || echo \"Expected Go toolset available in cache\""
# Copying the packet-forwarder in the gopath
- mkdir -p $GOPATH/src/github.com/TheThingsNetwork
- ln -s $PWD $GOPATH/src/github.com/TheThingsNetwork/packet_forwarder
# Build environment variables
- export CI_BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
- echo "date $CI_BUILD_DATE" >> release/info
- echo "commit $CI_BUILD_DATE" >> release/info
# Downloading dependencies
- pushd $GOPATH/src/github.com/TheThingsNetwork/packet_forwarder
- make dev-deps
- make deps
- popd
after_script:
- cp -r release release_files
- pushd release_files
# Change name of the binary
- mv packet-forwarder* packet-forwarder
# Create archive
- tar -cvzf $CI_JOB_NAME.tar.gz *
- popd
- rm -rf release/*
- cp release_files/$CI_JOB_NAME.tar.gz release
multitech-conduit-pktfwd:
stage: build
image: registry.gitlab.com/thethingsnetwork/packet_forwarder/multitech-toolchain
script:
# Remove the toolchain's CFLAGS
- "sed 's/.*CFLAGS.*//g' /opt/mlinux/3.2.0/environment-setup-arm926ejste-mlinux-linux-gnueabi -i.bak"
# Enable mLinux toolchain
- sdk_enable_file=$(ls /opt/mlinux/*/*setup*)
- source $sdk_enable_file
# Go to packet forwarder file
- pushd $GOPATH/src/github.com/TheThingsNetwork/packet_forwarder
- GOOS=linux GOARM=5 GOARCH=arm make build
- cp scripts/multitech/* release
- popd
artifacts:
paths:
- release/
kerlink-iot-station-pktfwd:
stage: build
image: registry.gitlab.com/thethingsnetwork/packet_forwarder/klk-toolchain
script:
- pushd $GOPATH/src/github.com/TheThingsNetwork/packet_forwarder
- ./scripts/kerlink/build-kerlink.sh /opt
- cp scripts/kerlink/create-package.sh release
- popd
artifacts:
paths:
- release/
imst-rpi-pktfwd:
stage: build
image: "ubuntu:xenial"
script:
- pushd $GOPATH/src/github.com/TheThingsNetwork/packet_forwarder
- apt install -y gcc-arm-linux-gnueabi # Installing cross-compiler
- GOOS=linux GOARM=7 GOARCH=arm PLATFORM=imst_rpi CFG_SPI=native CC=arm-linux-gnueabi-gcc make build
- cp scripts/rpi/install-systemd.sh release
- popd
artifacts:
paths:
- release/
sign:
before_script: []
after_script: []
only:
- develop@thethingsnetwork/packet_forwarder
- master@thethingsnetwork/packet_forwarder
stage: sign
image: golang:latest
script:
- pushd release
- shasum -a 256 $(ls) > checksums
- gpg --no-tty --batch --import /gpg/signing.ci.gpg-key
- gpg --no-tty --batch --no-use-agent --passphrase $GPG_PASSPHRASE --detach-sign checksums
- popd
artifacts:
paths:
- release/checksums
- release/checksums.sig
azure-binaries:
before_script: []
after_script: []
only:
- develop@thethingsnetwork/packet_forwarder
- master@thethingsnetwork/packet_forwarder
stage: package
image: registry.gitlab.com/thethingsindustries/upload
script:
- cd release
- export STORAGE_CONTAINER=packet-forwarder STORAGE_KEY=$AZURE_STORAGE_KEY ZIP=false TGZ=false PREFIX=$CI_BUILD_REF_NAME/
- upload *