Skip to content

Commit 331e21d

Browse files
authored
Add iOS fv build and network test template (#1194)
Test script have Simulator launch temporary disabled. Enable -DOLP_SDK_ENABLE_TESTING=ON on iOS Azure psv job. Remove obsolete travis script too. Minor names refactoring. Add separate yml for FV scheduled job. Add gitalab manual job. Relates-To: OLPEDGE-1773, OLPDGE-2543 Signed-off-by: Yaroslav Stefinko <[email protected]>
1 parent fc4736f commit 331e21d

File tree

7 files changed

+220
-14
lines changed

7 files changed

+220
-14
lines changed

.github/workflows/fv_pipelines.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: FV_Pipelines
2+
3+
on:
4+
schedule:
5+
# temporary run job only once a month.
6+
- cron: '* 5 1 * *'
7+
8+
env:
9+
LD_PRELOAD: /lib/x86_64-linux-gnu/libSegFault.so
10+
SEGFAULT_SIGNALS: all
11+
12+
jobs:
13+
fv-build-ios-network-test:
14+
name: FV / iOS clang / Network tests
15+
runs-on: macos-10.15
16+
env:
17+
BUILD_TYPE: RelWithDebInfo
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@v2
21+
- name: Build with tests
22+
run: ./scripts/ios/fv/gh-actions-build-with-tests-fv.sh
23+
shell: bash
24+
- name: Test FV Network
25+
run: ./scripts/ios/fv/gh-actions-functional-network-test.sh
26+
shell: bash
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ env:
1414
SEGFAULT_SIGNALS: all
1515

1616
jobs:
17-
linux-gcc-psv-build-test-codecov:
18-
name: Linux Build using gcc & tests & code coverage
17+
psv-linux-gcc-build-test-codecov:
18+
name: PSV / Linux gcc 7.5 / Tests / Code coverage
1919
runs-on: ubuntu-18.04
2020
steps:
2121
- name: Check out repository
@@ -33,8 +33,8 @@ jobs:
3333
run: ./scripts/linux/psv/test_psv.sh
3434
shell: bash
3535

36-
linux-gcc-psv-build-relwithdebinfo-no-cache:
37-
name: Linux Build using gcc & tests & code coverage
36+
psv-linux-gcc-build-no-cache:
37+
name: PSV / Linux gcc 7.5 / OLP_SDK_ENABLE_DEFAULT_CACHE=OFF
3838
runs-on: ubuntu-18.04
3939
env:
4040
BUILD_TYPE: RelWithDebInfo

.gitlab-ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,21 @@ test_android_emulator:
246246
- master
247247
- branches
248248

249+
# TO DO: OLPEDGE-2543
250+
# Currently job below just build HERE Data SDK for iOS and start iOS emulator. Application fails to work with mock-server.
251+
# Job is prepared for running on local MacMini hardware: tagged as `edge-macos`
252+
test_ios_emulator_fv_network:
253+
stage: test
254+
tags:
255+
- edge-macos
256+
script:
257+
- $CI_PROJECT_DIR/scripts/ios/fv/gh-actions-build-with-tests-fv.sh
258+
- $CI_PROJECT_DIR/scripts/ios/fv/gh-actions-functional-network-test.sh
259+
when: manual
260+
only:
261+
- master
262+
- branches
263+
249264
# Manual job to generate API/ABI Backward Compatibility Reports:
250265
# build current SDK and previous tagged SDK, then generate 4 html reports (for every lib)
251266
generate_api_compliance_job:

scripts/ios/azure_ios_build_psv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cmake ../ -GXcode \
2323
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/iOS.cmake \
2424
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
2525
-DPLATFORM=iphoneos \
26-
-DOLP_SDK_ENABLE_TESTING=NO \
26+
-DOLP_SDK_ENABLE_TESTING=ON \
2727
-DSIMULATOR=YES \
2828
-DOLP_SDK_BUILD_EXAMPLES=ON
2929

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22
#
3-
# Copyright (C) 2019 HERE Europe B.V.
3+
# Copyright (C) 2021 HERE Europe B.V.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -17,12 +17,22 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818
# License-Filename: LICENSE
1919

20+
mkdir -p build && cd build
2021

21-
mkdir -p build
22-
cd build
23-
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
24-
-OLP_SDK_BUILD_EXAMPLES=ON \
25-
-DBUILD_SHARED_LIBS=ON \
26-
..
27-
make -j
28-
cd ..
22+
xcode-select -p
23+
if [[ ${GITHUB_RUN_ID} != "" ]]; then
24+
# Run on GH Actions CI
25+
# Using Xcode_11 pre-installed on node. Otherwise, compilation may fail.
26+
sudo xcode-select -s /Applications/Xcode_11.2.1.app
27+
fi
28+
xcode-select -p
29+
30+
cmake ../ -GXcode \
31+
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/iOS.cmake \
32+
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
33+
-DPLATFORM=iphoneos \
34+
-DOLP_SDK_ENABLE_TESTING=ON \
35+
-DSIMULATOR=YES \
36+
-DOLP_SDK_BUILD_EXAMPLES=OFF
37+
38+
xcodebuild
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
#!/bin/bash -ex
2+
#
3+
# Copyright (C) 2021 HERE Europe B.V.
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+
# SPDX-License-Identifier: Apache-2.0
18+
# License-Filename: LICENSE
19+
20+
###
21+
### Script starts Mock server, install certificate, add it to trusted and
22+
### run FV functional test against it inside iOS Simulator (more info in OLPEDGE-1773)
23+
### NOTE: Simulator fails during application launch, so step is disabled until OLPEDGE-2543 is DONE.
24+
###
25+
### # TODO in OLPEDGE-2543 :
26+
## 1. Find out how to save xml report after Simulator test done.
27+
## 2. Fix `xcrun simctl launch` cmd below: errors from app like -999 etc.
28+
## 3. Functional test should be able to use this variable : IP_ADDR for connecting to Mock Server. It's possible solution for error -999 when connecting to Server.
29+
## 4. Need to find out how to parse `xcrun simctl spawn booted log stream` and catch finish of test-run. Otherwise it goes to infinite loop.
30+
##
31+
## export IP_ADDR=$(ipconfig getifaddr en0)
32+
## curl -s http://${IP_ADDR}:1080
33+
##
34+
##
35+
## For linux fv network tests please refer to : ./scripts/linux/fv/gitlab-olp-cpp-sdk-functional-network-test.sh
36+
37+
38+
# For core dump backtrace
39+
ulimit -c unlimited
40+
41+
# Set workspace location
42+
if [[ ${CI_PROJECT_DIR} == "" ]]; then
43+
export CI_PROJECT_DIR=$(pwd)
44+
fi
45+
46+
if [[ ${GITHUB_RUN_ID} == "" ]]; then
47+
# Local run
48+
export GITHUB_RUN_ID=$(date '+%s')
49+
pushd tests/utils/mock-server
50+
echo ">>> Installing mock server SSL certificate into OS... >>>"
51+
# Import and Make trusted
52+
security import mock-server-cert.pem || true
53+
security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain mock-server-cert.pem || true
54+
# Validate cert: if trusted - succeeded , if not trusted - fails
55+
security verify-cert -c mock-server-cert.pem
56+
echo ">>> Starting Mock Server... >>>"
57+
npm install
58+
node server.js & export SERVER_PID=$!
59+
popd
60+
else
61+
# CI run
62+
pushd tests/utils/mock-server
63+
echo ">>> Installing mock server SSL certificate into OS... >>>"
64+
# Import and Make trusted
65+
sudo security import mock-server-cert.pem
66+
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain mock-server-cert.pem
67+
# Validate cert: if trusted - succeeded , if not trusted - fails
68+
sudo security verify-cert -c mock-server-cert.pem
69+
echo ">>> Starting Mock Server... >>>"
70+
npm install
71+
node server.js & export SERVER_PID=$!
72+
popd
73+
fi
74+
75+
76+
# Node can start server in 1 second, but not faster.
77+
# Add waiter for server to be started. No other way to solve that.
78+
# Curl returns code 1 - means server still down. Curl returns 0 when server is up
79+
RC=1
80+
while [[ ${RC} -ne 0 ]];
81+
do
82+
set +e
83+
curl -s http://localhost:1080
84+
RC=$?
85+
sleep 0.2
86+
set -e
87+
done
88+
89+
# Functional test should be able to use this variable : IP_ADDR for connecting to Mock Server.
90+
# Looks like localhost is not reachable for Simulator.
91+
export IP_ADDR=$(ipconfig getifaddr en0)
92+
curl -s http://${IP_ADDR}:1080
93+
94+
echo ">>> Start network tests ... >>>"
95+
# List available devices, runtimes on MacOS node
96+
xcrun simctl list
97+
xcrun simctl list devices
98+
xcrun simctl list runtimes
99+
100+
export CurrentDeviceUDID=$(xcrun simctl list devices | grep "iPhone 11 (" | grep -v "unavailable" | grep -v "com.apple.CoreSimulator.SimDeviceType" | cut -d'(' -f2 | cut -d')' -f1 | head -1)
101+
102+
# Create new Simulator device
103+
104+
xcrun simctl list devices | grep "iPhone 11"
105+
xcrun simctl boot "iPhone 11" || true
106+
xcrun simctl list devices | grep "iPhone 11"
107+
xcrun simctl create ${GITHUB_RUN_ID}_iphone11 "com.apple.CoreSimulator.SimDeviceType.iPhone-11"
108+
xcrun simctl list devices | grep "iPhone 11"
109+
echo "Simulator created"
110+
111+
#/Applications/Xcode_11.2.1.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID ${CurrentDeviceUDID} & export SIMULATOR_PID=$! || /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID ${CurrentDeviceUDID} & export SIMULATOR_PID=$!
112+
#echo "Simulator started device"
113+
#
114+
#xcrun simctl logverbose enable
115+
#xcrun simctl install ${CurrentDeviceUDID} ./build/tests/functional/network/ios/olp-cpp-sdk-functional-network-tests-tester/Debug-iphonesimulator/olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester.app
116+
#echo "App installed"
117+
#xcrun simctl launch ${CurrentDeviceUDID} com.here.olp.olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester
118+
# Need to find out how to parse `xcrun simctl spawn booted log stream` and catch finish of test-run. Otherwise it goes to infinite loop.
119+
# xcrun simctl spawn booted log stream | grep "olp-ios-olp-cpp-sdk-functional-network-tests-lib-tester:" | tee app.log
120+
#result=$?
121+
#echo "App launched"
122+
#xcrun simctl shutdown ${CurrentDeviceUDID}
123+
#echo "Simulator shutdown done"
124+
125+
#echo ">>> Finished network tests >>>"
126+
127+
# Terminate the mock server
128+
#kill -TERM $SERVER_PID || true
129+
#kill -TERM $SIMULATOR_PID || true
130+
131+
#wait
132+
133+
#exit ${result}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDqDCCApCgAwIBAgIEPhwe6TANBgkqhkiG9w0BAQsFADBiMRswGQYDVQQDDBJ3
3+
d3cubW9ja3NlcnZlci5jb20xEzARBgNVBAoMCk1vY2tTZXJ2ZXIxDzANBgNVBAcM
4+
BkxvbmRvbjEQMA4GA1UECAwHRW5nbGFuZDELMAkGA1UEBhMCVUswIBcNMTYwNjIw
5+
MTYzNDE0WhgPMjExNzA1MjcxNjM0MTRaMGIxGzAZBgNVBAMMEnd3dy5tb2Nrc2Vy
6+
dmVyLmNvbTETMBEGA1UECgwKTW9ja1NlcnZlcjEPMA0GA1UEBwwGTG9uZG9uMRAw
7+
DgYDVQQIDAdFbmdsYW5kMQswCQYDVQQGEwJVSzCCASIwDQYJKoZIhvcNAQEBBQAD
8+
ggEPADCCAQoCggEBAPGORrdkwTY1H1dvQPYaA+RpD+pSbsvHTtUSU6H7NQS2qu1p
9+
sE6TEG2fE+Vb0QIXkeH+jjKzcfzHGCpIU/0qQCu4RVycrIW4CCdXjl+T3L4C0I3R
10+
mIMciTig5qcAvY9P5bQAdWDkU36YGrCjGaX3QlndGxD9M974JdpVK4cqFyc6N4gA
11+
Onys3uS8MMmSHTjTFAgR/WFeJ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