Merge remote-tracking branch 'upstream/dev' into disappearing-message-redesign

# Conflicts:
#	.drone.jsonnet
pull/731/head
Morgan Pretty 3 months ago
commit a76c220709

@ -1,3 +1,6 @@
// This build configuration requires the following to be installed:
// Git, Xcode, XCode Command-line Tools, Cocoapods, Xcodebuild, Xcresultparser, pip
// Log a bunch of version information to make it easier for debugging // Log a bunch of version information to make it easier for debugging
local version_info = { local version_info = {
name: 'Version Information', name: 'Version Information',
@ -95,18 +98,6 @@ local update_cocoapods_cache(depends_on) = {
depends_on: depends_on, depends_on: depends_on,
}; };
// Run specified unit tests
local run_tests(testName, testBuildStepName) = {
name: 'Run ' + testName,
commands: [
'NSUnbufferedIO=YES set -o pipefail && xcodebuild test-without-building -workspace Session.xcworkspace -scheme Session -derivedDataPath ./build/derivedData -destination "platform=iOS Simulator,name=iPhone 14" -test-timeouts-enabled YES -maximum-test-execution-time-allowance 10 -only-testing ' + testName + ' -collect-test-diagnostics never 2>&1 | xcbeautify --is-ci',
],
depends_on: [
testBuildStepName
],
};
[ [
// Unit tests (PRs only) // Unit tests (PRs only)
{ {
@ -121,42 +112,73 @@ local run_tests(testName, testBuildStepName) = {
load_cocoapods_cache, load_cocoapods_cache,
install_cocoapods, install_cocoapods,
{ {
name: 'Reset Simulators', name: 'Pre-Boot Test Simulator',
commands: [ commands: [
'xcrun simctl shutdown all', 'mkdir -p build/artifacts',
'xcrun simctl erase all' 'echo "Test-iPhone14-${DRONE_COMMIT:0:9}-${DRONE_BUILD_EVENT}" > ./build/artifacts/device_name',
], 'xcrun simctl create "$(cat ./build/artifacts/device_name)" com.apple.CoreSimulator.SimDeviceType.iPhone-14',
depends_on: [ 'echo $(xcrun simctl list devices | grep -m 1 $(cat ./build/artifacts/device_name) | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})") > ./build/artifacts/sim_uuid',
'Install CocoaPods' 'xcrun simctl boot $(cat ./build/artifacts/sim_uuid)',
'echo "Pre-booting simulator complete: $(xcrun simctl list | sed "s/^[[:space:]]*//" | grep -o ".*$(cat ./build/artifacts/sim_uuid).*")"',
] ]
}, },
{ {
name: 'Build For Testing', name: 'Build and Run Tests',
commands: [ commands: [
'mkdir build', '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=$(cat ./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',
'xcodebuild build-for-testing -workspace Session.xcworkspace -scheme Session -derivedDataPath ./build/derivedData -parallelizeTargets -destination "platform=iOS Simulator,name=iPhone 14" | xcbeautify --is-ci',
], ],
depends_on: [ depends_on: [
'Pre-Boot Test Simulator',
'Install CocoaPods' 'Install CocoaPods'
], ],
}, },
run_tests('SessionTests', 'Build For Testing'),
run_tests('SessionMessagingKitTests', 'Build For Testing'),
run_tests('SessionUtilitiesKitTests', 'Build For Testing'),
{ {
name: 'Shutdown Simulators', name: 'Unit Test Summary',
commands: [ 'xcrun simctl shutdown all' ], commands: [
'xcresultparser --output-format cli --failed-tests-only ./build/artifacts/testResults.xcresult',
],
depends_on: ['Build and Run Tests'],
when: {
status: ['failure', 'success']
}
},
{
name: 'Delete Test Simulator',
commands: [
'xcrun simctl delete $(cat ./build/artifacts/sim_uuid)'
],
depends_on: [ depends_on: [
'Build For Testing', 'Build and Run Tests',
'Run SessionTests',
'Run SessionMessagingKitTests',
'Run SessionUtilitiesKitTests'
], ],
when: { when: {
status: ['failure', 'success'] status: ['failure', 'success']
} }
}, },
update_cocoapods_cache(['Build For Testing']) update_cocoapods_cache(['Build and Run Tests']),
{
name: 'Install Codecov CLI',
commands: [
'pip3 install codecov-cli',
'~/Library/Python/3.9/bin/codecovcli --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',
commands: [
'~/Library/Python/3.9/bin/codecovcli 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)
@ -209,5 +231,5 @@ local run_tests(testName, testBuildStepName) = {
] ]
}, },
], ],
} },
] ]

@ -0,0 +1,8 @@
codecov:
branch: master # set Default branch
# Paths to ignore for code coverage
ignore:
- "SessionMessagingKitTests"
- "SessionTests"
- "SessionUtilitiesKitTests"
Loading…
Cancel
Save