Skip to content

Commit

Permalink
Merge pull request #135 from realm/jed/ci-improvements
Browse files Browse the repository at this point in the history
Reduce number of threads used on Windows and Android
  • Loading branch information
jedelbo authored Apr 18, 2018
2 parents e871ff2 + 87707b3 commit aaa730b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 36 deletions.
56 changes: 22 additions & 34 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ jobWrapper {
}
}

targetBranch = env.CHANGE_TARGET ? env.CHANGE_TARGET : "none"
isPullRequest = !!env.CHANGE_TARGET
targetBranch = isPullRequest ? env.CHANGE_TARGET : "none"
println "Building branch: ${env.BRANCH_NAME}"
println "Target branch: ${targetBranch}"

releaseTesting = targetBranch.contains('release')

echo "Pull request: ${env.CHANGE_TARGET ? 'yes' : 'no'}"
echo "Pull request: ${isPullRequest ? 'yes' : 'no'}"
echo "Release Run: ${releaseTesting ? 'yes' : 'no'}"
echo "Publishing Run: ${gitTag ? 'yes' : 'no'}"

Expand All @@ -56,50 +57,37 @@ jobWrapper {
}
}

if (env.CHANGE_TARGET) {
if (isPullRequest) {
stage('Fastcheck') {
parallel(
checkLinuxDebug : doBuildInDocker('Debug'),
checkLinuxDebug : doBuildInDocker('Debug', '4'),
checkMacOsRelease : doBuildMacOs('Release', true),
checkWin32Debug : doBuildWindows('Debug', false, 'Win32'),
checkWin64Release : doBuildWindows('Release', false, 'x64'),
androidArmeabiRelease : doAndroidBuildInDocker('armeabi-v7a', 'Release', true),
iosDebug : doBuildAppleDevice('ios', 'MinSizeDebug'),
androidArm64Debug : doAndroidBuildInDocker('arm64-v8a', 'Debug', false),
threadSanitizer : doBuildInDocker('Debug', 'thread'),
addressSanitizer : doBuildInDocker('Debug', 'address'),
threadSanitizer : doBuildInDocker('Debug', '1000', 'thread'),
addressSanitizer : doBuildInDocker('Debug', '1000', 'address'),
)
}
}

if (env.CHANGE_TARGET && releaseTesting) {
if (isPullRequest && releaseTesting) {
stage('ExtendedCheck') {
parallelExecutors = [checkLinuxRelease : doBuildInDocker('Release'),
checkMacOsDebug : doBuildMacOs('Debug', true),
buildUwpWin32Debug : doBuildWindows('Debug', true, 'Win32'),
buildUwpx64Debug : doBuildWindows('Debug', true, 'x64'),
buildUwpArmDebug : doBuildWindows('Debug', true, 'ARM'),
coverage : doBuildCoverage(),
performance : buildPerformance()
]

androidAbis = ['x86', 'mips', 'x86_64']

for (def i = 0; i < androidAbis.size(); i++) {
def abi = androidAbis[i]
parallelExecutors["android-${abi}-Debug"] = doAndroidBuildInDocker(abi, 'Debug', false)
}

appleSdks = ['ios', 'tvos', 'watchos']

for (def i = 0; i < appleSdks.size(); i++) {
def sdk = appleSdks[i]
parallelExecutors["${sdk}-Debug"] = doBuildAppleDevice(sdk, 'MinSizeDebug')
}
parallel parallelExecutors
parallel(
checkLinuxRelease : doBuildInDocker('Release'),
checkMacOsDebug : doBuildMacOs('Debug', true),
buildUwpWin32Debug : doBuildWindows('Debug', true, 'Win32'),
buildUwpx64Debug : doBuildWindows('Debug', true, 'x64'),
buildUwpArmDebug : doBuildWindows('Debug', true, 'ARM'),
androidArmeabiRelease : doAndroidBuildInDocker('armeabi-v7a', 'Release', true),
coverage : doBuildCoverage(),
performance : buildPerformance()
)
}
}

if (gitTag) {
if (gitTag && !isPullRequest) {
stage('BuildPackages') {
parallelExecutors = [
buildMacOsDebug : doBuildMacOs('Debug', false),
Expand Down Expand Up @@ -200,7 +188,7 @@ def buildDockerEnv(name) {
return docker.image(name)
}

def doBuildInDocker(String buildType, String sanitizeMode='') {
def doBuildInDocker(String buildType, String maxBpNodeSize = '1000', String sanitizeMode='') {
return {
node('docker') {
getArchive()
Expand All @@ -222,7 +210,7 @@ def doBuildInDocker(String buildType, String sanitizeMode='') {
sh """
mkdir build-dir
cd build-dir
cmake -D CMAKE_BUILD_TYPE=${buildType} ${sanitizeFlags} -G Ninja ..
cmake -D CMAKE_BUILD_TYPE=${buildType} -D REALM_MAX_BPNODE_SIZE=${maxBpNodeSize} ${sanitizeFlags} -G Ninja ..
"""
runAndCollectWarnings(script: "cd build-dir && ninja")
sh """
Expand Down
13 changes: 11 additions & 2 deletions test/test_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,17 @@ TEST(Transactions_Threaded)
tk = table->get_key();
wt->commit();
}
#if defined(_WIN32) || REALM_ANDROID
const int num_threads = 2;
#else
const int num_threads = 20;
#endif
const int num_iterations = 100;
std::thread writers[num_threads];
std::thread verifiers[num_threads];
for (int i = 0; i < num_threads; ++i) {
verifiers[i] = std::thread([&] { verifier_thread(test_context, num_threads * 100, &db, tk); });
writers[i] = std::thread([&] { writer_thread(test_context, 100, &db, tk); });
verifiers[i] = std::thread([&] { verifier_thread(test_context, num_threads * num_iterations, &db, tk); });
writers[i] = std::thread([&] { writer_thread(test_context, num_iterations, &db, tk); });
}
for (int i = 0; i < num_threads; ++i) {
writers[i].join();
Expand All @@ -267,7 +272,11 @@ TEST(Transactions_ThreadedAdvanceRead)
tk = table->get_key();
wt->commit();
}
#if defined(_WIN32) || REALM_ANDROID
const int num_threads = 2;
#else
const int num_threads = 20;
#endif
const int num_iterations = 100;
std::thread writers[num_threads];
std::thread verifiers[num_threads];
Expand Down

0 comments on commit aaa730b

Please sign in to comment.