Updated to the latest CI config (few optimisations)

pull/950/head
Morgan Pretty 3 months ago
parent 4aa5eb1bbc
commit d324f36c53

@ -1,3 +1,13 @@
// Log a bunch of version information to make it easier for debugging
local version_info = {
name: 'Version Information',
commands: [
'git --version',
'pod --version',
'xcodebuild -version'
]
};
// Intentionally doing a depth of 2 as libSession-util has it's own submodules (and libLokinet likely will as well)
local clone_submodules = {
name: 'Clone Submodules',
@ -15,7 +25,10 @@ local install_cocoapods = {
name: 'Install CocoaPods',
commands: ['
LANG=en_US.UTF-8 pod install || rm -rf ./Pods && LANG=en_US.UTF-8 pod install
']
'],
depends_on: [
'Load CocoaPods Cache'
]
};
// Load from the cached CocoaPods directory (to speed up the build)
@ -40,11 +53,14 @@ local load_cocoapods_cache = {
fi
|||,
'rm -f /Users/drone/.cocoapods_cache.lock'
],
depends_on: [
'Clone Submodules'
]
};
// Override the cached CocoaPods directory (to speed up the next build)
local update_cocoapods_cache = {
local update_cocoapods_cache(depends_on) = {
name: 'Update CocoaPods Cache',
commands: [
|||
@ -66,7 +82,19 @@ local update_cocoapods_cache = {
fi
|||,
'rm -f /Users/drone/.cocoapods_cache.lock'
]
],
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 | ./Pods/xcbeautify/xcbeautify --is-ci',
],
depends_on: [
testBuildStepName
],
};
@ -79,17 +107,49 @@ local update_cocoapods_cache = {
platform: { os: 'darwin', arch: 'amd64' },
trigger: { event: { exclude: [ 'push' ] } },
steps: [
version_info,
clone_submodules,
load_cocoapods_cache,
install_cocoapods,
{
name: 'Run Unit Tests',
name: 'Reset Simulators',
commands: [
'xcrun simctl shutdown all',
'xcrun simctl erase all'
],
depends_on: [
'Install CocoaPods'
]
},
{
name: 'Build For Testing',
commands: [
'mkdir build',
'NSUnbufferedIO=YES set -o pipefail && xcodebuild test -workspace Session.xcworkspace -scheme Session -derivedDataPath ./build/derivedData -destination "platform=iOS Simulator,name=iPhone 14" -destination "platform=iOS Simulator,name=iPhone 14 Pro Max" -parallel-testing-enabled YES -test-timeouts-enabled YES -maximum-test-execution-time-allowance 2 -collect-test-diagnostics never 2>&1 | ./Pods/xcbeautify/xcbeautify --is-ci --report junit --report-path ./build/reports --junit-report-filename junit2.xml'
'xcodebuild build-for-testing -workspace Session.xcworkspace -scheme Session -derivedDataPath ./build/derivedData -parallelizeTargets -destination "platform=iOS Simulator,name=iPhone 14" | ./Pods/xcbeautify/xcbeautify --is-ci',
],
depends_on: [
'Install CocoaPods'
],
},
update_cocoapods_cache
run_tests('SessionTests', 'Build For Testing'),
run_tests('SessionMessagingKitTests', 'Build For Testing'),
run_tests('SessionSnodeKitTests', 'Build For Testing'),
run_tests('SessionUtilitiesKitTests', 'Build For Testing'),
{
name: 'Shutdown Simulators',
commands: [ 'xcrun simctl shutdown all' ],
depends_on: [
'Build For Testing',
'Run SessionTests',
'Run SessionMessagingKitTests',
'Run SessionSnodeKitTests',
'Run SessionUtilitiesKitTests'
],
when: {
status: ['failure', 'success']
}
},
update_cocoapods_cache(['Build For Testing'])
],
},
// Validate build artifact was created by the direct branch push (PRs only)
@ -116,6 +176,7 @@ local update_cocoapods_cache = {
platform: { os: 'darwin', arch: 'amd64' },
trigger: { event: { exclude: [ 'pull_request' ] } },
steps: [
version_info,
clone_submodules,
load_cocoapods_cache,
install_cocoapods,
@ -126,12 +187,15 @@ local update_cocoapods_cache = {
'xcodebuild archive -workspace Session.xcworkspace -scheme Session -derivedDataPath ./build/derivedData -configuration "App Store Release" -sdk iphonesimulator -archivePath ./build/Session_sim.xcarchive -destination "generic/platform=iOS Simulator" | ./Pods/xcbeautify/xcbeautify --is-ci'
],
},
update_cocoapods_cache,
update_cocoapods_cache(['Build']),
{
name: 'Upload artifacts',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
commands: [
'./Scripts/drone-static-upload.sh'
],
depends_on: [
'Build'
]
},
],

Loading…
Cancel
Save