|
|
@ -27,9 +27,9 @@ local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https:/
|
|
|
|
// 'LANG' env var so we need to work around the with https://github.com/CocoaPods/CocoaPods/issues/6333
|
|
|
|
// 'LANG' env var so we need to work around the with https://github.com/CocoaPods/CocoaPods/issues/6333
|
|
|
|
local install_cocoapods = {
|
|
|
|
local install_cocoapods = {
|
|
|
|
name: 'Install CocoaPods',
|
|
|
|
name: 'Install CocoaPods',
|
|
|
|
commands: ['
|
|
|
|
commands: [
|
|
|
|
LANG=en_US.UTF-8 pod install || rm -rf ./Pods && LANG=en_US.UTF-8 pod install
|
|
|
|
'LANG=en_US.UTF-8 pod install || (rm -rf ./Pods && LANG=en_US.UTF-8 pod install)'
|
|
|
|
'],
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
depends_on: [
|
|
|
|
'Load CocoaPods Cache'
|
|
|
|
'Load CocoaPods Cache'
|
|
|
|
]
|
|
|
|
]
|
|
|
@ -89,17 +89,26 @@ local update_cocoapods_cache(depends_on) = {
|
|
|
|
depends_on: depends_on,
|
|
|
|
depends_on: depends_on,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Unit tests
|
|
|
|
[
|
|
|
|
//
|
|
|
|
// Unit tests (PRs only)
|
|
|
|
// The following 4 steps need to be run in order to run the unit tests
|
|
|
|
{
|
|
|
|
local clean_up_old_test_simulators = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
|
|
|
|
type: 'exec',
|
|
|
|
|
|
|
|
name: 'Unit Tests',
|
|
|
|
|
|
|
|
platform: { os: 'darwin', arch: 'arm64' },
|
|
|
|
|
|
|
|
trigger: { event: { exclude: [ 'push' ] } },
|
|
|
|
|
|
|
|
steps: [
|
|
|
|
|
|
|
|
version_info,
|
|
|
|
|
|
|
|
clone_submodules,
|
|
|
|
|
|
|
|
load_cocoapods_cache,
|
|
|
|
|
|
|
|
install_cocoapods,
|
|
|
|
|
|
|
|
{
|
|
|
|
name: 'Clean Up Old Test Simulators',
|
|
|
|
name: 'Clean Up Old Test Simulators',
|
|
|
|
commands: [
|
|
|
|
commands: [
|
|
|
|
'./Scripts/clean-up-old-test-simulators.sh'
|
|
|
|
'./Scripts/clean-up-old-test-simulators.sh'
|
|
|
|
]
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
local pre_boot_test_sim = {
|
|
|
|
|
|
|
|
name: 'Pre-Boot Test Simulator',
|
|
|
|
name: 'Pre-Boot Test Simulator',
|
|
|
|
commands: [
|
|
|
|
commands: [
|
|
|
|
'mkdir -p build/artifacts',
|
|
|
|
'mkdir -p build/artifacts',
|
|
|
@ -109,9 +118,8 @@ local pre_boot_test_sim = {
|
|
|
|
'xcrun simctl boot $(<./build/artifacts/sim_uuid)',
|
|
|
|
'xcrun simctl boot $(<./build/artifacts/sim_uuid)',
|
|
|
|
'echo "[32mPre-booting simulator complete: $(xcrun simctl list | sed "s/^[[:space:]]*//" | grep -o ".*$(<./build/artifacts/sim_uuid).*")[0m"',
|
|
|
|
'echo "[32mPre-booting simulator complete: $(xcrun simctl list | sed "s/^[[:space:]]*//" | grep -o ".*$(<./build/artifacts/sim_uuid).*")[0m"',
|
|
|
|
]
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
local build_and_run_tests = {
|
|
|
|
|
|
|
|
name: 'Build and Run Tests',
|
|
|
|
name: 'Build and Run Tests',
|
|
|
|
commands: [
|
|
|
|
commands: [
|
|
|
|
'NSUnbufferedIO=YES set -o pipefail && xcodebuild test -workspace Session.xcworkspace -scheme Session -derivedDataPath ./build/derivedData -resultBundlePath ./build/artifacts/testResults.xcresult -parallelizeTargets -destination "platform=iOS Simulator,id=$(<./build/artifacts/sim_uuid)" -parallel-testing-enabled NO -test-timeouts-enabled YES -maximum-test-execution-time-allowance 10 -collect-test-diagnostics never 2>&1 | xcbeautify --is-ci',
|
|
|
|
'NSUnbufferedIO=YES set -o pipefail && xcodebuild test -workspace Session.xcworkspace -scheme Session -derivedDataPath ./build/derivedData -resultBundlePath ./build/artifacts/testResults.xcresult -parallelizeTargets -destination "platform=iOS Simulator,id=$(<./build/artifacts/sim_uuid)" -parallel-testing-enabled NO -test-timeouts-enabled YES -maximum-test-execution-time-allowance 10 -collect-test-diagnostics never 2>&1 | xcbeautify --is-ci',
|
|
|
@ -120,9 +128,8 @@ local build_and_run_tests = {
|
|
|
|
'Pre-Boot Test Simulator',
|
|
|
|
'Pre-Boot Test Simulator',
|
|
|
|
'Install CocoaPods'
|
|
|
|
'Install CocoaPods'
|
|
|
|
],
|
|
|
|
],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
local unit_test_summary = {
|
|
|
|
|
|
|
|
name: 'Unit Test Summary',
|
|
|
|
name: 'Unit Test Summary',
|
|
|
|
commands: [
|
|
|
|
commands: [
|
|
|
|
|||
|
|
|
|
|||
|
|
|
@ -137,26 +144,40 @@ local unit_test_summary = {
|
|
|
|
when: {
|
|
|
|
when: {
|
|
|
|
status: ['failure', 'success']
|
|
|
|
status: ['failure', 'success']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
update_cocoapods_cache(['Build and Run Tests']),
|
|
|
|
[
|
|
|
|
|
|
|
|
// Unit tests (PRs only)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'Install Codecov CLI',
|
|
|
|
type: 'exec',
|
|
|
|
commands: [
|
|
|
|
name: 'Unit Tests',
|
|
|
|
'mkdir -p build/artifacts',
|
|
|
|
platform: { os: 'darwin', arch: 'arm64' },
|
|
|
|
'pip3 install codecov-cli',
|
|
|
|
trigger: { event: { exclude: [ 'push' ] } },
|
|
|
|
'find $HOME/Library/Python -name codecovcli -print -quit > ./build/artifacts/codecov_path',
|
|
|
|
steps: [
|
|
|
|
|||
|
|
|
|
version_info,
|
|
|
|
if [[ ! -s ./build/artifacts/codecov_path ]]; then
|
|
|
|
clone_submodules,
|
|
|
|
which codecovcli > ./build/artifacts/codecov_path
|
|
|
|
load_cocoapods_cache,
|
|
|
|
fi
|
|
|
|
install_cocoapods,
|
|
|
|
|||,
|
|
|
|
clean_up_old_test_simulators,
|
|
|
|
'$(<./build/artifacts/codecov_path) --version'
|
|
|
|
pre_boot_test_sim,
|
|
|
|
],
|
|
|
|
build_and_run_tests,
|
|
|
|
},
|
|
|
|
unit_test_summary,
|
|
|
|
{
|
|
|
|
update_cocoapods_cache(['Build and Run Tests'])
|
|
|
|
name: 'Convert xcresult to xml',
|
|
|
|
|
|
|
|
commands: [
|
|
|
|
|
|
|
|
'xcresultparser --output-format cobertura ./build/artifacts/testResults.xcresult > ./build/artifacts/coverage.xml',
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
depends_on: ['Build and Run Tests']
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// No token needed for public repos
|
|
|
|
|
|
|
|
name: 'Upload coverage to Codecov',
|
|
|
|
|
|
|
|
commands: [
|
|
|
|
|
|
|
|
'$(<./build/artifacts/codecov_path) upload-process --fail-on-error -f ./build/artifacts/coverage.xml',
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
depends_on: [
|
|
|
|
|
|
|
|
'Convert xcresult to xml',
|
|
|
|
|
|
|
|
'Install Codecov CLI'
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// Validate build artifact was created by the direct branch push (PRs only)
|
|
|
|
// Validate build artifact was created by the direct branch push (PRs only)
|
|
|
@ -210,55 +231,4 @@ local unit_test_summary = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// Unit tests and code coverage (non-PRs only)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
kind: 'pipeline',
|
|
|
|
|
|
|
|
type: 'exec',
|
|
|
|
|
|
|
|
name: 'Unit Tests and Code Coverage',
|
|
|
|
|
|
|
|
platform: { os: 'darwin', arch: 'arm64' },
|
|
|
|
|
|
|
|
trigger: { event: { exclude: [ 'pull_request' ] } },
|
|
|
|
|
|
|
|
steps: [
|
|
|
|
|
|
|
|
version_info,
|
|
|
|
|
|
|
|
clone_submodules,
|
|
|
|
|
|
|
|
load_cocoapods_cache,
|
|
|
|
|
|
|
|
install_cocoapods,
|
|
|
|
|
|
|
|
clean_up_old_test_simulators,
|
|
|
|
|
|
|
|
pre_boot_test_sim,
|
|
|
|
|
|
|
|
build_and_run_tests,
|
|
|
|
|
|
|
|
unit_test_summary,
|
|
|
|
|
|
|
|
update_cocoapods_cache(['Build and Run Tests']),
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name: 'Install Codecov CLI',
|
|
|
|
|
|
|
|
commands: [
|
|
|
|
|
|
|
|
'mkdir -p build/artifacts',
|
|
|
|
|
|
|
|
'pip3 install codecov-cli',
|
|
|
|
|
|
|
|
'find $HOME/Library/Python -name codecovcli -print -quit > ./build/artifacts/codecov_path',
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
if [[ ! -s ./build/artifacts/codecov_path ]]; then
|
|
|
|
|
|
|
|
which codecovcli > ./build/artifacts/codecov_path
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|||,
|
|
|
|
|
|
|
|
'$(<./build/artifacts/codecov_path) --version'
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name: 'Convert xcresult to xml',
|
|
|
|
|
|
|
|
commands: [
|
|
|
|
|
|
|
|
'xcresultparser --output-format cobertura ./build/artifacts/testResults.xcresult > ./build/artifacts/coverage.xml',
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
depends_on: ['Build and Run Tests']
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name: 'Upload coverage to Codecov',
|
|
|
|
|
|
|
|
environment: { CODECOV_TOKEN: { from_secret: 'CODECOV_TOKEN' } },
|
|
|
|
|
|
|
|
commands: [
|
|
|
|
|
|
|
|
'$(<./build/artifacts/codecov_path) upload-process --fail-on-error -f ./build/artifacts/coverage.xml',
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
depends_on: [
|
|
|
|
|
|
|
|
'Convert xcresult to xml',
|
|
|
|
|
|
|
|
'Install Codecov CLI'
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
]
|
|
|
|
]
|
|
|
|