-
Notifications
You must be signed in to change notification settings - Fork 90
/
.gitlab-ci.yml
178 lines (172 loc) · 6.8 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
##
## Copyright (c) 2015-2021 University of Antwerp, Aloxy NV.
##
## This file is part of Sub-IoT.
## See https://github.com/Sub-IoT/Sub-IoT-Stack for further info.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
stages:
- init
- build stack
- flash test boards
- run tests
variables:
GIT_STRATEGY: none
GIT_SUBMODULE_STRATEGY: none
DOCKER_TAG: builder3
DOCKER_BUILD_LOCATION: /opt/$CI_PROJECT_NAME
create_docker_image:
image: "docker"
when: manual
stage: init
tags:
- docker
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/toolchain/8.2018.4/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2'
- docker build --cache-from registry.gitlab.com/aloxy/$CI_PROJECT_NAME/builder:$DOCKER_TAG --pull -t registry.gitlab.com/aloxy/$CI_PROJECT_NAME/builder:$DOCKER_TAG . && docker push registry.gitlab.com/aloxy/$CI_PROJECT_NAME/builder:$DOCKER_TAG
build primary apps:
image: "registry.gitlab.com/aloxy/$CI_PROJECT_NAME/builder:$DOCKER_TAG"
tags:
- docker
stage: build stack
before_script:
- cd $DOCKER_BUILD_LOCATION
- git remote set-url origin $CI_REPOSITORY_URL
- git submodule sync --recursive
- git fetch --all
- git reset --hard origin/$CI_COMMIT_REF_NAME
script:
- mkdir build && cd build
- platform="B_L072Z_LRWAN1"
- cmake ../stack/ -DAPP_GATEWAY=y -DAPP_MODEM=y -DAPP_SENSOR_PUSH=y -DPLATFORM=$platform -DFRAMEWORK_DEBUG_ASSERT_REBOOT=y -DMODULE_D7AP_FS_DISABLE_PERMISSIONS=y -DAPP_MODEM_FORWARD_ALP_OVER_SERIAL=y
- make -j
- cd ..
- mv build /builds/aloxy/$CI_PROJECT_NAME/build
artifacts:
name: "$CI_COMMIT_REF_NAME"
when: always
paths:
- build/apps/gateway/*
- build/apps/modem/*
- build/apps/sensor_push/*
run unit tests:
image: "registry.gitlab.com/aloxy/$CI_PROJECT_NAME/builder:$DOCKER_TAG"
tags:
- docker
stage: build stack
before_script:
- cd $DOCKER_BUILD_LOCATION
- git remote set-url origin $CI_REPOSITORY_URL
- git submodule sync --recursive
- git fetch --all
- git reset --hard origin/$CI_COMMIT_REF_NAME
script:
- mkdir build && cd build
- platform="NATIVE"
- cmake ../stack/ -DPLATFORM=$platform -DCMAKE_TOOLCHAIN_FILE="../stack/cmake/toolchains/gcc.cmake" -DBUILD_UNIT_TESTS=y -DFRAMEWORK_CONSOLE_ENABLED=n -DTEST_AES=y -DTEST_FEC=y -DTEST_ALP=y -DTEST_FIFO=y -DTEST_SCHEDULER=y -DTEST_TIMER=y -DMODULE_D7AP=n -DFRAMEWORK_MODEM_INTERFACE_ENABLED=n -DFRAMEWORK_USE_POWER_TRACKING=n
- make -j
- ./tests/aes/test_aes &> results_aes.txt
- ./tests/alp/test_alp &> results_alp.txt
- ./tests/fec/test_fec &> results_fec.txt
- ./tests/fifo/test_fifo &> results_fifo.txt
- ./tests/scheduler/test_scheduler &> results_scheduler.txt
- ./tests/timer/test_timer &> results_timer.txt
- if ! grep -q 'AES all unit tests OK !' "results_aes.txt"; then exit 1; fi
- if ! grep -q 'Unit-tests for ALP completed' "results_alp.txt"; then exit 1; fi
- if ! grep -q 'Input was decoded successfully' "results_fec.txt"; then exit 1; fi
- if ! grep -q 'All FIFO tests passed!' "results_fifo.txt"; then exit 1; fi
- if ! grep -q 'All scheduler tests passed!' "results_scheduler.txt"; then exit 1; fi
- if ! grep -q 'All timer tests passed!' "results_timer.txt"; then exit 1; fi
- cd ..
- mv build /builds/aloxy/$CI_PROJECT_NAME/build
artifacts:
name: "$CI_COMMIT_REF_NAME"
when: always
paths:
- build/results_aes.txt
- build/results_alp.txt
- build/results_fec.txt
- build/results_fifo.txt
- build/results_scheduler.txt
build sample apps:
image: "registry.gitlab.com/aloxy/$CI_PROJECT_NAME/builder:$DOCKER_TAG"
tags:
- docker
stage: build stack
before_script:
- cd $DOCKER_BUILD_LOCATION
- git remote set-url origin $CI_REPOSITORY_URL
- git submodule sync --recursive
- git fetch --all
- git reset --hard origin/$CI_COMMIT_REF_NAME
- git clean -xfdf
- git submodule update --init --recursive -f
- git submodule foreach --recursive git clean -xfdf
script:
- mkdir build && cd build
- platform="B_L072Z_LRWAN1"
- cmake ../stack/ -DAPP_GATEWAY=y -DAPP_MODEM=y -DAPP_SENSOR_ACTION=y -DAPP_SENSOR_PULL=y -DAPP_SENSOR_PUSH=y -DAPP_SENSOR_PUSH=y -DAPP_SENSOR_PUSH_LED=y -DAPP_WATCHDOG_TEST=y -DPLATFORM=$platform -DFRAMEWORK_USE_ERROR_EVENT_FILE=y
- make -j
- rm -rf *
- cmake ../stack/ -DAPP_MODEMCLIENT=y -DMODULE_ALP_USE_EXTERNAL_MODEM=y -DPLATFORM=$platform
- make -j
- rm -rf *
- cmake ../stack/ -DAPP_LORAWAN_NODE=y -DPLATFORM=$platform -DMODULE_LORAWAN=y -DMODULE_ALP=n -DMODULE_LORAWAN_REGION=MODEM_REGION_EU868
- make -j
- rm -rf *
- cmake ../stack/ -DAPP_SENSOR_MULTIMODAL=y -DAPP_SENSOR_PUSH_LORAWAN=y -DPLATFORM=$platform -DMODULE_LORAWAN=y -DFRAMEWORK_MODEM_INTERFACE_ENABLED=n -DMODULE_LORAWAN_REGION=MODEM_REGION_EU868
- make -j
flash devkits:
tags:
- testsuite
stage: flash test boards
dependencies:
- build primary apps
script:
- if $(lsof -i -P -n | grep -q JLinkExe) ; then exit 1; fi
- if pgrep -f "python3 run.py" ; then exit 1; fi
- cd build/apps/modem
- JLinkExe -SelectEmuBySN 770821797 -CommandFile jlink-flash-full.script > flashOutput1.txt
- JLinkExe -SelectEmuBySN 772958091 -CommandFile jlink-flash-full.script > flashOutput2.txt
- cat flashOutput1.txt
- cat flashOutput2.txt
- if grep -q 'FAILED\|ERROR' "flashOutput1.txt"; then exit 1; fi
- if grep -q 'FAILED\|ERROR' "flashOutput2.txt"; then exit 1; fi
run testsuite:
image: python:3.8
tags:
- testsuite
stage: run tests
script:
- ip addr show
- if $(lsof -i -P -n | grep -q JLinkExe) ; then exit 1; fi
- if pgrep -f "python3 run.py" ; then exit 1; fi
- rm -rf Sub-IoT-testsuite
- git clone --recurse-submodules https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/aloxy/Sub-IoT-testsuite.git
- cd Sub-IoT-testsuite
- python3 -m pip install -r requirements.txt -r lib/pyd7a/requirements.txt
- python3 run.py --serial-test-device=/dev/ttyUSB0 --serial-dut=/dev/ttyUSB1 -m "not band433 and not known_issue" --junitxml report.xml -v
artifacts:
reports:
junit: Sub-IoT-testsuite/report.xml