Initial alarm adapter implementation
[ric-plt/alarm-go.git] / adapter / build_adapter.sh
1 #==================================================================================
2 #   Copyright (c) 2020 AT&T Intellectual Property.
3 #   Copyright (c) 2020 Nokia
4 #
5 #   Licensed under the Apache License, Version 2.0 (the "License");
6 #   you may not use this file except in compliance with the License.
7 #   You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #   Unless required by applicable law or agreed to in writing, software
12 #   distributed under the License is distributed on an "AS IS" BASIS,
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #   See the License for the specific language governing permissions and
15 #   limitations under the License.
16 #==================================================================================
17
18 set -e
19 set -x
20
21 # setup version tag
22 if [ -f container-tag.yaml ]
23 then
24     tag=$(grep "tag:" container-tag.yaml | awk '{print $2}')
25 else
26     tag="-"
27 fi
28
29 hash=$(git rev-parse --short HEAD || true)
30
31 export GOPATH=$HOME/go
32 export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
33 export CFG_FILE=../config/config-file.json
34 export RMR_SEED_RT=../config/uta_rtg.rt
35
36 GO111MODULE=on GO_ENABLED=0 GOOS=linux
37
38 # Build
39 go build -a -installsuffix cgo -ldflags "-X main.Version=$tag -X main.Hash=$hash" -o alarm-adapter ./cmd/adapter.go
40
41 # Run UT
42 go test -v -p 1 -coverprofile cover.out ./cmd/ -c -o ./adapter_test && ./adapter_test
43 cd ../alarm && RMR_SEED_RT=../config/uta_rtg_lib.rt go test . -v -coverprofile cover.out