Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ci #7

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright (c) Open Enclave SDK contributors.
// Licensed under the MIT License.

OECI_LIB_VERSION = env.OECI_LIB_VERSION ?: "master"
oe = library("OpenEnclaveCommon@${OECI_LIB_VERSION}").jenkins.common.Openenclave.new()

GLOBAL_TIMEOUT_MINUTES = 240
CTEST_TIMEOUT_SECONDS = 480
GLOBAL_ERROR = null

AGENTS_LABELS = [
"acc-ubuntu-16.04": env.UBUNTU_1604_CUSTOM_LABEL ?: "ACC-1604",
"acc-ubuntu-18.04": env.UBUNTU_1804_CUSTOM_LABEL ?: "ACC-1804",
"acc-rhel-8": env.RHEL_8_CUSTOM_LABEL ?: "ACC-RHEL-8",
"acc-win2016": env.WINDOWS_2016_CUSTOM_LABEL ?: "SGX-Windows-2016",
"acc-win2019": env.WINDOWS_2019_CUSTOM_LABEL ?: "SGX-Windows-2019"
]

properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '90',
artifactNumToKeepStr: '180',
daysToKeepStr: '90',
numToKeepStr: '180')),
[$class: 'JobRestrictionProperty']])


def LinuxBuild(String label, String compiler) {
stage("${label} ${compiler} oeedger8r-cpp") {
node(label) {
timeout(GLOBAL_TIMEOUT_MINUTES) {
cleanWs()
checkout scm
def task = """
cmake ${WORKSPACE}
make -j 4
ctest --output-on-failure --timeout ${CTEST_TIMEOUT_SECONDS}
"""

oe.Run(compiler, task)
}
}
}
}

def WindowsBuild(String label) {
stage("${label} oeedger8r-cpp") {
node(label) {
timeout(GLOBAL_TIMEOUT_MINUTES) {
cleanWs()
checkout scm
bat """
vcvars64.bat x64 && \
cmake.exe ${WORKSPACE} -G Ninja && \
ninja -v -j 4 && \
ctest.exe -V --output-on-failure --timeout ${CTEST_TIMEOUT_SECONDS}
"""
}
}
}
}


try {
stage("PR Testing") {
def testing_stages = [
"ACC1604 clang-7": { LinuxBuild(AGENTS_LABELS["acc-ubuntu-16.04"], 'clang-7',) },
"ACC1804 clang-7": { LinuxBuild(AGENTS_LABELS["acc-ubuntu-18.04"], 'clang-7') },
"RHEL 8 gcc 8": { LinuxBuild(AGENTS_LABELS["acc-rhel-8"], 'gcc') },
"Win 2016 MVC": { WindowsBuild(AGENTS_LABELS["acc-win2016"]) },
"Win 2019 MVC": { WindowsBuild(AGENTS_LABELS["acc-win2019"]) }
]

parallel testing_stages
}

} catch(Exception e) {
println "Caught global pipeline exception :" + e
GLOBAL_ERROR = e
throw e
} finally {
currentBuild.result = (GLOBAL_ERROR != null) ? 'FAILURE' : "SUCCESS"
}