-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NXDRIVE-837: Possibility to launch tests against Nuxeo 8.10
- Loading branch information
Showing
2 changed files
with
330 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.nuxeo.ecm.distribution</groupId> | ||
<artifactId>nuxeo-distribution</artifactId> | ||
<version>8.10</version> | ||
<relativePath></relativePath> | ||
</parent> | ||
|
||
<groupId>org.nuxeo.ecm</groupId> | ||
<artifactId>nuxeo-drive-ftest</artifactId> | ||
<packaging>pom</packaging> | ||
<name>Nuxeo Drive Functional Tests on Nuxeo 8.10</name> | ||
<description> | ||
This POM uses tools-nuxeo-ftest to run Nuxeo Drive | ||
functional tests in multiple environments (OS, DB) | ||
</description> | ||
|
||
<properties> | ||
<!-- URL of the last archived artifacts of the nuxeo-drive marketplace | ||
package on Jenkins --> | ||
<nuxeo.drive.mp.url>http://qa.nuxeo.org/jenkins/job/master/job/addons_nuxeo-drive-master-marketplace/lastSuccessfulBuild/artifact/marketplace/target/ | ||
</nuxeo.drive.mp.url> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.nuxeo.ecm.distribution</groupId> | ||
<artifactId>nuxeo-server-tomcat</artifactId> | ||
<type>zip</type> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.nuxeo.build</groupId> | ||
<artifactId>ant-assembly-maven-plugin</artifactId> | ||
<configuration> | ||
<buildFile>${basedir}/itests.xml</buildFile> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>start-nuxeo</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
<configuration> | ||
<targets> | ||
<target>fetch-nuxeo-drive-mp</target> | ||
<target>prepare-environment</target> | ||
<target>start</target> | ||
</targets> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>run-tests</id> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<targets> | ||
<target>run-drive-tests</target> | ||
</targets> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>stop-nuxeo</id> | ||
<phase>post-integration-test</phase> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
<configuration> | ||
<target>stop</target> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>tomcat</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
</profile> | ||
</profiles> | ||
|
||
<repositories> | ||
<repository> | ||
<id>public</id> | ||
<url>http://maven.nuxeo.org/nexus/content/groups/public</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
<repository> | ||
<id>public-snapshot</id> | ||
<url>http://maven.nuxeo.org/nexus/content/groups/public-snapshot | ||
</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
#!groovy | ||
// Script to launch Nuxeo Drive tests on every supported platform. | ||
|
||
// Default values for required envars | ||
python_drive_version = '2.7.13' | ||
pyqt_version = '4.12' | ||
cxfreeze_version = '4.3.3' | ||
sip_version = '4.19' | ||
|
||
// Pipeline properties | ||
properties([ | ||
disableConcurrentBuilds(), | ||
pipelineTriggers([[$class: 'TimerTrigger', spec: '@midnight']]), | ||
[$class: 'SchedulerPreference', preferEvenload: true], | ||
[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], | ||
[$class: 'ParametersDefinitionProperty', parameterDefinitions: [ | ||
[$class: 'StringParameterDefinition', | ||
name: 'SPECIFIC_TEST', | ||
defaultValue: '', | ||
description: 'Specific test to launch. The syntax must be the same as <a href="http://doc.pytest.org/en/latest/example/markers.html#selecting-tests-based-on-their-node-id">pytest markers</a>'], | ||
[$class: 'StringParameterDefinition', | ||
name: 'PYTHON_DRIVE_VERSION', | ||
defaultValue: python_drive_version, | ||
description: '<b>Required</b> Python version to use'], | ||
[$class: 'StringParameterDefinition', | ||
name: 'PYQT_VERSION', | ||
defaultValue: pyqt_version, | ||
description: '<b>Required</b> PyQt version to use (GNU/Linux and macOS only)'], | ||
[$class: 'StringParameterDefinition', | ||
name: 'CXFREEZE_VERSION', | ||
defaultValue: cxfreeze_version, | ||
description: '<i>Optional</i> cx_Freeze version to use'], | ||
[$class: 'StringParameterDefinition', | ||
name: 'SIP_VERSION', | ||
defaultValue: sip_version, | ||
description: '<i>Optional</i> SIP version to use (GNU/Linux and macOS only)'], | ||
[$class: 'ChoiceParameterDefinition', | ||
name: 'RANDOM_BUG_MODE', | ||
choices: 'None\nRELAX\nSTRICT\nBYPASS', | ||
description: 'Random bug mode'], | ||
[$class: 'StringParameterDefinition', | ||
name: 'ENGINE', | ||
defaultValue: 'NXDRIVE', | ||
description: '<i>Optional</i> The engine to use (another possible value is <i>NXDRIVENEXT</i>)'], | ||
[$class: 'BooleanParameterDefinition', | ||
name: 'CLEAN_WORKSPACE', | ||
defaultValue: false, | ||
description: 'Clean the entire workspace before doing anything.'], | ||
[$class: 'BooleanParameterDefinition', | ||
name: 'ENABLE_PROFILER', | ||
defaultValue: false, | ||
description: 'Use yappi profiler.'] | ||
]] | ||
]) | ||
|
||
// Do not launch anything if we are on a Work In Progress branch | ||
if (env.BRANCH_NAME.startsWith('wip-')) { | ||
echo 'Skipped due to WIP branch.' | ||
return | ||
} | ||
|
||
// Jenkins slaves we will build on | ||
slaves = ['OSXSLAVE-DRIVE', 'SLAVE', 'WINSLAVE'] | ||
labels = [ | ||
'OSXSLAVE-DRIVE': 'macOS', | ||
'SLAVE': 'GNU/Linux', | ||
'WINSLAVE': 'Windows' | ||
] | ||
builders = [:] | ||
|
||
// GitHub stuff | ||
repos_url = 'https://github.com/nuxeo/nuxeo-drive' | ||
repos_git = 'https://github.com/nuxeo/nuxeo-drive.git' | ||
status_msg = [ | ||
'FAILURE': 'Failed to build on Nuxeo CI', | ||
'PENDING': 'Building on on Nuxeo CI', | ||
'SUCCESS': 'Successfully built on Nuxeo CI' | ||
] | ||
|
||
def github_status(status) { | ||
step([$class: 'GitHubCommitStatusSetter', | ||
reposSource: [$class: 'ManuallyEnteredRepositorySource', url: repos_url], | ||
contextSource: [$class: 'ManuallyEnteredCommitContextSource', context: 'ci/qa.nuxeo.com'], | ||
statusResultSource: [$class: 'ConditionalStatusResultSource', | ||
results: [[$class: 'AnyBuildResult', | ||
message: status_msg.get(status), state: status]]]]) | ||
} | ||
|
||
def checkout_custom() { | ||
checkout([$class: 'GitSCM', | ||
branches: [[name: env.BRANCH_NAME]], | ||
browser: [$class: 'GithubWeb', repoUrl: repos_url], | ||
doGenerateSubmoduleConfigurations: false, | ||
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'sources']], | ||
submoduleCfg: [], | ||
userRemoteConfigs: [[url: repos_git]]]) | ||
} | ||
|
||
for (def x in slaves) { | ||
// Need to bind the label variable before the closure - can't do 'for (slave in slaves)' | ||
def slave = x | ||
def osi = labels.get(slave) | ||
|
||
// Create a map to pass in to the 'parallel' step so we can fire all the builds at once | ||
builders[slave] = { | ||
node(slave) { | ||
withEnv(["WORKSPACE=${pwd()}"]) { | ||
if (params.CLEAN_WORKSPACE) { | ||
deleteDir() | ||
} | ||
|
||
// Required envars | ||
env.PYTHON_DRIVE_VERSION = params.PYTHON_DRIVE_VERSION ?: python_drive_version | ||
env.PYQT_VERSION = params.PYQT_VERSION ?: pyqt_version | ||
env.DRIVE_YAPPI = params.ENABLE_PROFILER ? env.WORKSPACE : '' | ||
|
||
try { | ||
stage(osi + ' Checkout') { | ||
try { | ||
dir('sources') { | ||
deleteDir() | ||
} | ||
github_status('PENDING') | ||
checkout_custom() | ||
} catch(e) { | ||
currentBuild.result = 'UNSTABLE' | ||
throw e | ||
} | ||
} | ||
|
||
stage(osi + ' Setup') { | ||
// Set up a complete isolated environment | ||
try { | ||
dir('sources') { | ||
if (osi == 'macOS') { | ||
sh 'tools/osx/deploy_jenkins_slave.sh' | ||
} else if (osi == 'GNU/Linux') { | ||
sh 'tools/linux/deploy_jenkins_slave.sh' | ||
} else { | ||
bat 'powershell ".\\tools\\windows\\deploy_jenkins_slave.ps1"' | ||
} | ||
} | ||
} catch(e) { | ||
currentBuild.result = 'UNSTABLE' | ||
throw e | ||
} | ||
} | ||
|
||
stage(osi + ' Tests') { | ||
// Launch the tests suite | ||
def jdk = tool name: 'java-8-oracle' | ||
env.JAVA_HOME = "${jdk}" | ||
def mvnHome = tool name: 'maven-3.3', type: 'hudson.tasks.Maven$MavenInstallation' | ||
def platform_opt = "-Dplatform=${slave.toLowerCase()}" | ||
|
||
dir('sources') { | ||
// Set up the report name folder | ||
env.REPORT_PATH = env.WORKSPACE + '/sources' | ||
env.TEST_REMOTE_SCAN_VOLUME = 100 | ||
|
||
try { | ||
if (osi == 'macOS') { | ||
// Adjust the PATH | ||
def env_vars = [ | ||
'PATH+LOCALBIN=/usr/local/bin', | ||
] | ||
withEnv(env_vars) { | ||
sh "${mvnHome}/bin/mvn -f ftest/pom-8.10.xml clean verify -Pqa,pgsql ${platform_opt}" | ||
} | ||
} else if (osi == 'GNU/Linux') { | ||
sh "${mvnHome}/bin/mvn -f ftest/pom-8.10.xml clean verify -Pqa,pgsql ${platform_opt}" | ||
} else { | ||
bat(/"${mvnHome}\bin\mvn" -f ftest\pom-8.10.xml clean verify -Pqa,pgsql ${platform_opt}/) | ||
} | ||
} catch(e) { | ||
currentBuild.result = 'FAILURE' | ||
throw e | ||
} | ||
} | ||
|
||
// echo 'Retrieve coverage statistics' | ||
// archive 'coverage/*' | ||
|
||
currentBuild.result = 'SUCCESS' | ||
} | ||
} finally { | ||
// We use catchError to not let notifiers and recorders change the current build status | ||
catchError { | ||
// Update GitHub status whatever the result | ||
github_status(currentBuild.result) | ||
|
||
archive 'sources/ftest/target*/tomcat/log/*.log, sources/*.zip, *yappi.txt' | ||
|
||
// Update revelant Jira issues only if we are working on the master branch | ||
if (env.BRANCH_NAME == 'master') { | ||
step([$class: 'JiraIssueUpdater', | ||
issueSelector: [$class: 'DefaultIssueSelector'], | ||
scm: scm, comment: osi]) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
timeout(240) { | ||
timestamps { | ||
parallel builders | ||
} | ||
} |