[build] Enable iOS unit test runner in CI

This commit is contained in:
Juha Alanen
2020-02-07 12:44:21 +02:00
parent 632c5f9d4c
commit af7428254b

View File

@@ -20,6 +20,7 @@ workflows:
- android-render-test-runner
- android-unit-test-runner
- ios-render-test-runner
- ios-unit-test-runner
- baselines:
requires:
- android-arm64-v8a-release
@@ -398,6 +399,74 @@ jobs:
fi
fi
- save
ios-unit-test-runner:
executor: macos-11_0_0
steps:
- checkout
- prepare
- prepare-macos
- run:
name: Prepare codesign keychain
command: |
cd test/ios
fastlane run create_keychain name:fastlane_keychain password:$FASTLANE_PASSWORD timeout:false unlock:true
fastlane match
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $FASTLANE_PASSWORD fastlane_keychain
/usr/bin/env xcrun security find-identity -v -p codesigning
- run:
name: Build IOS UnitTestsApp
command: |
cd test/ios
ccache --zero-stats --max-size=2G
cmake ../.. -B Build -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DMBGL_IOS_UNIT_TEST=1 -DCMAKE_OSX_ARCHITECTURES=arm64e
cmake --build Build --config Release
ccache --show-stats
- run:
name: Codesign UnitTestsApp for running on a physical device
command: |
cd test/ios
./codesigning/generate-entitlements.swift
cd Build
../codesigning/codesign_all.sh
codesign -dv --verbose=4 Release-iphoneos/UnitTestsApp.app
- run:
name: Login to IOS Google Cloud Platform
command: |
if [[ -n "${GCLOUD_SERVICE_ACCOUNT_JSON_IOS}" ]]; then
echo "${GCLOUD_SERVICE_ACCOUNT_JSON_IOS}" > iosAccount.json
gcloud auth activate-service-account --key-file iosAccount.json --project ios-mapbox-gl-native
rm iosAccount.json
fi
- run:
name: Run UnitTestsApp on Firebase
no_output_timeout: 20m
command: |
if [[ -n "${GCLOUD_SERVICE_ACCOUNT_JSON_IOS}" ]]; then
# arrange files in a way Firebase expects it, and package them in a zip file
cd test/ios/Build
cp ../UnitTestsApp_iphoneos13.2-arm64e-release.xctestrun .
zip testapp.zip -r Release-iphoneos/UnitTestsApp.app --quiet
zip testapp.zip UnitTestsApp_iphoneos13.2-arm64e-release.xctestrun
gcloud firebase test ios models list
gcloud firebase test ios run \
--test testapp.zip \
--device model=iphonexs,version=12.0,locale=en,orientation=portrait --xcode-version=11.1 --timeout 20m \
--verbosity=debug --no-record-video --results-dir ios-unit-test-app-${CIRCLE_BUILD_NUM}
fi
- run:
name: Retrieve Test Result from gcloud
when: always
command: |
if [[ -n "${GCLOUD_SERVICE_ACCOUNT_JSON_IOS}" ]]; then
testResult=$(gsutil ls -d gs://test-lab-hn7kwqcz3108z-hjm4qtbqqkymk/ios-unit-test-app-${CIRCLE_BUILD_NUM}/iphonexs-12.0-en-portrait/TestLogs/)
mkdir -p unit-test-app
gsutil -m cp -r $testResult unit-test-app
cd unit-test-app/TestLogs
xcparse attachments *.xcresult && ls
cd ../.. && mkdir -p /tmp/tests/unit-test
if ls unit-test-app/TestLogs/*.xml 1> /dev/null 2>&1; then cp unit-test-app/TestLogs/*.xml /tmp/tests/unit-test/results.xml; fi
fi
- save
android-benchmark-runner:
executor: ubuntu-disco
steps: