forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
270 lines (239 loc) · 12.6 KB
/
.travis.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
language: cpp
before_install:
# As we run the test suite within the same host, and the test suite checks IP addresses of mDNS advertisements (e.g. IS-04-03)
# and the 'remote' address of requests received by the test suite mocks (e.g. IS-09-02), things are much simpler with a single
# interface configured with an IP address. Although 'docker0' is down, it has an address, so flush that, leaving only 'eth0'.
- sudo ip addr flush dev docker0
# Get IP address and short form Git Hash
- |
export HOST_IP_ADDRESS="$(hostname -I | cut -f1 -d' ')"
echo $HOST_IP_ADDRESS
GITHUB_COMMIT=$(echo "$TRAVIS_COMMIT" | cut -c1-7)
echo $GITHUB_COMMIT
# Allow Travis folds
- |
export -f travis_nanoseconds
export -f travis_fold
export -f travis_time_start
export -f travis_time_finish
_install_cmake: &install_cmake
# Install minimum required CMake
|
cd $TRAVIS_BUILD_DIR/..
wget "https://github.com/Kitware/CMake/releases/download/v3.9.0/cmake-3.9.0-Linux-x86_64.sh"
sudo mkdir /opt/cmake
sudo sh cmake-3.9.0-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
_install_cpprestsdk: &install_cpprestsdk
# Retrieve and build C++ REST SDK
|
cd $TRAVIS_BUILD_DIR/..
git clone --recurse-submodules --branch v2.10.16 https://github.com/Microsoft/cpprestsdk
cd cpprestsdk/Release
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE:STRING="Release" -DWERROR:BOOL="0" -DBUILD_SAMPLES:BOOL="0" -DBUILD_TESTS:BOOL="0"
make -j 2 && sudo make install
_install_mdns: &install_mdns
# Install mDNSResponder
|
cd $TRAVIS_BUILD_DIR/..
wget https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.200.35.tar.gz
tar -xzf mDNSResponder-878.200.35.tar.gz
patch -d mDNSResponder-878.200.35/ -p1 < $TRAVIS_BUILD_DIR/Development/third_party/mDNSResponder/unicast.patch
patch -d mDNSResponder-878.200.35/ -p1 < $TRAVIS_BUILD_DIR/Development/third_party/mDNSResponder/permit-over-long-service-types.patch
patch -d mDNSResponder-878.200.35/ -p1 < $TRAVIS_BUILD_DIR/Development/third_party/mDNSResponder/poll-rather-than-select.patch
cd mDNSResponder-878.200.35/mDNSPosix
make os=linux && sudo make os=linux install
jobs:
include:
- os: linux
dist: trusty
name: Ubuntu 14.04 / GCC 4.8.4
compiler: gcc
addons:
apt:
packages:
- libboost-chrono-dev
- libboost-date-time-dev
- libboost-regex-dev
- libboost-system-dev
- libboost-thread-dev
- libboost-random-dev
- libboost-filesystem-dev
- openssl
- libssl-dev
install:
# Install minimum required CMake
- *install_cmake
# Retrieve and build C++ REST SDK
- *install_cpprestsdk
# Install mDNSResponder
- *install_mdns
- os: linux
dist: bionic
name: Ubuntu 18.04 / GCC 7.4.0
compiler: gcc
addons:
apt:
packages:
- python3-pip
- python3-setuptools
install:
# Install Conan
- python3 -m pip install conan
# Install mDNSResponder
- *install_mdns
script:
# Build nmos-cpp
- travis_fold start "cmake"
- |
cd $TRAVIS_BUILD_DIR/Development
mkdir -p build
cd build
- |
if [[ ${TRAVIS_DIST} == "trusty" ]]; then
cmake .. -DCMAKE_BUILD_TYPE:STRING="Release" -DUSE_CONAN:BOOL="0" -DWEBSOCKETPP_INCLUDE_DIR:PATH="$TRAVIS_BUILD_DIR/../cpprestsdk/Release/libs/websocketpp"
else
# Use Conan by default
cmake .. -DCMAKE_BUILD_TYPE:STRING="Release"
fi
- travis_fold end "cmake"
- travis_fold start "make.nmos-cpp"
- make -j 2
- travis_fold end "make.nmos-cpp"
- travis_fold start "make.test"
- make test
- travis_fold end "make.test"
after_script:
- cd $TRAVIS_BUILD_DIR/..
# Install AMWA test suite. Tests are run in after_script so as not to fail the build stage.
- git clone https://github.com/AMWA-TV/nmos-testing.git && cd nmos-testing
# Install minimum required Python for the testing tool
- |
if [[ ${TRAVIS_DIST} == "trusty" ]]; then
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt-get --allow-unauthenticated update -q
sudo apt-get --allow-unauthenticated install python3.6 python3.6-gdbm
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 3
fi
# Install pip and dependencies
- |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo -H python3 get-pip.py
sudo -H python3 -m pip install -r requirements.txt
sudo -H python3 -m pip install -r utilities/run-test-suites/gsheetsImport/requirements.txt
# Install SDPoker
- npm install -g AMWA-TV/sdpoker
# Create output directories
- mkdir results && mkdir badges
# Run Node tests
- |
$TRAVIS_BUILD_DIR/Development/build/nmos-cpp-node "{\"http_port\":1080,\"domain\":\"local.\",\"logging_level\":-40}" > nodeoutput 2>&1 &
NODE_PID=$!
# IS-04-01
- |
case $(python3 nmos-test.py suite IS-04-01 --selection all --host "$HOST_IP_ADDRESS" --port 1080 --version v1.3 --output "results/$GITHUB_COMMIT-IS-04-01.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-04-01\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-04-01.json
# IS-04-03
- |
case $(python3 nmos-test.py suite IS-04-03 --selection all --host "$HOST_IP_ADDRESS" --port 1080 --version v1.3 --output "results/$GITHUB_COMMIT-IS-04-03.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-04-03\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-04-03.json
# IS-05-01
- |
case $(python3 nmos-test.py suite IS-05-01 --selection all --host "$HOST_IP_ADDRESS" --port 1080 --version v1.1 --output "results/$GITHUB_COMMIT-IS-05-01.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-05-01\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-05-01.json
# IS-05-02
- |
case $(python3 nmos-test.py suite IS-05-02 --selection all --host "$HOST_IP_ADDRESS" "$HOST_IP_ADDRESS" --port 1080 1080 --version v1.3 v1.1 --output "results/$GITHUB_COMMIT-IS-05-02.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-05-02\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-05-02.json
# IS-07-01
- |
case $(python3 nmos-test.py suite IS-07-01 --selection all --host "$HOST_IP_ADDRESS" --port 1080 --version v1.0 --output "results/$GITHUB_COMMIT-IS-07-01.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-07-01\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-07-01.json
# IS-07-02
- |
case $(python3 nmos-test.py suite IS-07-02 --selection all --host "$HOST_IP_ADDRESS" "$HOST_IP_ADDRESS" "$HOST_IP_ADDRESS" --port 1080 1080 1080 --version v1.3 v1.1 v1.0 --output "results/$GITHUB_COMMIT-IS-07-02.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-07-02\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-07-02.json
# IS-09-02
- |
case $(python3 nmos-test.py suite IS-09-02 --selection all --host "$HOST_IP_ADDRESS" null --port 0 0 --version null v1.0 --output "results/$GITHUB_COMMIT-IS-09-02.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-09-02\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-09-02.json
# Run Registry tests (leave Node running)
- |
$TRAVIS_BUILD_DIR/Development/build/nmos-cpp-registry "{\"pri\":0,\"http_port\":8080,\"domain\":\"local.\",\"logging_level\":-40}" > registryoutput 2>&1 &
REGISTRY_PID=$!
# short delay to give the Registry a chance to start up and the Node a chance to register before running the Registry test suite
sleep 2
# add a persistent Query WebSocket API subscription before running the Registry test suite
curl "http://localhost:8080/x-nmos/query/v1.3/subscriptions" -H "Content-Type: application/json" -d "{\"max_update_rate_ms\": 100, \"resource_path\": \"/nodes\", \"params\": {\"label\": \"host1\"}, \"persist\": true, \"secure\": false}"
# IS-04-02
- |
case $(python3 nmos-test.py suite IS-04-02 --selection all --host "$HOST_IP_ADDRESS" "$HOST_IP_ADDRESS" --port 8080 8080 --version v1.3 v1.3 --output "results/$GITHUB_COMMIT-IS-04-02.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-04-02\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-04-02.json
# IS-09-01
- |
case $(python3 nmos-test.py suite IS-09-01 --selection all --host "$HOST_IP_ADDRESS" --port 8080 --version v1.0 --output "results/$GITHUB_COMMIT-IS-09-01.json" >/dev/null 2>&1; echo $?) in
[0-1]) testmessage="Pass" && testcolour="brightgreen";;
*) testmessage="Fail" && testcolour="red";;
esac
printf "{\"schemaVersion\":1,\"label\":\"IS-09-01\",\"message\":\"$testmessage\",\"color\":\"$testcolour\"}" > badges/IS-09-01.json
# Stop Node and Registry
- kill $NODE_PID
- kill $REGISTRY_PID
# Get Google Drive CLI and decrypt credentials
- cd $TRAVIS_BUILD_DIR/..
- openssl aes-256-cbc -K $encrypted_credentials_K -iv $encrypted_credentials_iv -in nmos-cpp/.gdrive-credentials.json.enc -out credentials.json -d
- mkdir ~/.gdrive && mv credentials.json ~/.gdrive
# Upload output files
- |
wget https://github.com/gdrive-org/gdrive/releases/download/2.1.0/gdrive-linux-x64
mv ./gdrive-linux-x64 ./gdrive
chmod +x ./gdrive
- export JOB_FOLDER="$(./gdrive mkdir --service-account credentials.json --parent 1XgPUnYddfVfC0f8B1diI-x-7PFpVfgWN $TRAVIS_JOB_NUMBER | cut -f2 -d' ')"
- for f in nmos-testing/results/*; do ./gdrive upload --service-account credentials.json --parent $JOB_FOLDER $f; done
- ./gdrive upload --service-account credentials.json --parent $JOB_FOLDER nmos-testing/nodeoutput
- ./gdrive upload --service-account credentials.json --parent $JOB_FOLDER nmos-testing/registryoutput
- tail -n +1 nmos-testing/results/*
- tail -n +1 nmos-testing/badges/*
- cat nmos-testing/nodeoutput
- cat nmos-testing/registryoutput
- |
if [[ ${TRAVIS_DIST} == "bionic" && ${TRAVIS_BRANCH} == "master" && ${TRAVIS_PULL_REQUEST} == "false" ]]; then
./gdrive update --service-account credentials.json 1VrCPcYeTs5uoBgECxbfuWbbhJZpbHcPy nmos-testing/badges/IS-04-01.json
./gdrive update --service-account credentials.json 14vgZF4CSx2oayEAbeNFGiHmPW95HKMXt nmos-testing/badges/IS-04-02.json
./gdrive update --service-account credentials.json 16616xSByskr3PbeqhnCcNTjfJcDdzUav nmos-testing/badges/IS-04-03.json
./gdrive update --service-account credentials.json 1tW25Xim9LymIvPXnxM5taGmlLVsXa71p nmos-testing/badges/IS-05-01.json
./gdrive update --service-account credentials.json 1MkQNv8v2r0ydB1mQ55k-pktlzE8LZ3g9 nmos-testing/badges/IS-05-02.json
./gdrive update --service-account credentials.json 1XQuAN13xAQ81G_Eokj6AAYv5kMInPXkZ nmos-testing/badges/IS-07-01.json
./gdrive update --service-account credentials.json 16t7XCmsQaOw5eEqq6yuuy1U9I3J-9zN9 nmos-testing/badges/IS-07-02.json
./gdrive update --service-account credentials.json 16t7ncRp3SbHHoftQY-RBi2NFC283fOTn nmos-testing/badges/IS-09-01.json
./gdrive update --service-account credentials.json 1f4FHD6vI1LotF7Sm8U6tmNp58seW9397 nmos-testing/badges/IS-09-02.json
export SHEET=https://docs.google.com/spreadsheets/d/1UgZoI0lGCMDn9-zssccf2Azil3WN6jogroMT8Wh6H64
for f in nmos-testing/results/$GITHUB_COMMIT-*; do python3 nmos-testing/utilities/run-test-suites/gsheetsImport/resultsImporter.py --credentials ~/.gdrive/credentials.json --sheet "$SHEET" --json $f --insert; done
fi
- echo "Done"