Index: build/jenkins/differential.Jenkinsfile =================================================================== --- /dev/null +++ build/jenkins/differential.Jenkinsfile @@ -0,0 +1,117 @@ +pipeline { + agent { label 'LinuxPhabricatorSlave' } + options { + skipDefaultCheckout() + } + + parameters { + string(name: 'DIFF_ID', defaultValue: '', description: 'ID of the Phabricator Differential.') + string(name: 'PHID', defaultValue: '', description: 'Phabricator ID') + } + + stages { + stage("Checkout") { + options { + retry(3) + } + steps { + script { + try { + svn "https://svn.wildfiregames.com/public/ps/trunk" + } catch(e) { + sh "svn cleanup" + sleep 300 + throw e + } + } + sh "svn cleanup" + } + } + + stage("Patch") { + steps { + script { + try { + sh "arc patch --diff ${params.DIFF_ID} --force" + } catch (e) { + sh "svn st --no-ignore | cut -c 9- | xargs rm -rf" + sh "svn revert -R ." + sh "arc patch --diff ${params.DIFF_ID} --force" + } + } + } + } + + stage("Lint") { + steps { + script { + try { + sh "svn st | grep '^[AM]' | cut -c 9- | xargs ~/coala-env/bin/coala -d build/coala --ci --flush-cache --limit-files > coala-report" + } catch (e) { + sh ''' + echo "Linter detected issues:" >> phabricator-comment + cat coala-report >> phabricator-comment + echo "\n" >> phabricator-comment + ''' + } + } + echo (message: readFile (file: "coala-report")) + } + } + + stage("Pre-Build") { + steps { + sh "build/workspaces/update-workspaces.sh -j2 --jenkins-tests" + } + } + + stage("Build") { + steps { + sh "cd build/workspaces/gcc/ && make -j2 config=debug" + sh "cd build/workspaces/gcc/ && make -j2 config=release" + } + } + + stage("Test") { + steps { + sh "binaries/system/test_dbg > cxxtest_debug.xml" + sh "binaries/system/test > cxxtest_release.xml" + } + post { + unsuccessful { + echo (message: readFile (file: "cxxtest_debug.xml")) + echo (message: readFile (file: "cxxtest_release.xml")) + } + always { + catchError { + sh "sed -i 's/date/timestamp/g' cxxtest_debug.xml" + sh "sed -i 's/date/timestamp/g' cxxtest_release.xml" + } + junit "cxxtest_*.xml" + } + } + } + } + + post { + always { + script { + if (fileExists("phabricator-comment")) { + step([$class: 'PhabricatorNotifier', commentOnSuccess: true, commentWithConsoleLinkOnFailure: true, customComment: true, commentFile: "phabricator-comment"]) + } else { + step([$class: 'PhabricatorNotifier', commentOnSuccess: true, commentWithConsoleLinkOnFailure: true]) + } + } + + sh "rm -f phabricator-comment" + sh "svn revert -R ." + sh "svn st binaries/data | cut -c 9- | xargs rm -rf" + sh ''' + if [ "$(svn status source/)" ]; then + svn status source/ | cut -c 9- | xargs rm -rf + build/workspaces/clean-workspaces.sh --preserve-libs + fi + ''' + } + } +} Index: build/jenkins/svn.Jenkinsfile =================================================================== --- /dev/null +++ build/jenkins/svn.Jenkinsfile @@ -0,0 +1,87 @@ +pipeline { + agent { label 'LinuxPhabricatorSlave' } + options { + skipDefaultCheckout() + } + + parameters { + string(name: 'SVN_REV', defaultValue: '', description: 'For instance 21000') + string(name: 'PHID', defaultValue: '', description: 'Phabricator ID') + booleanParam(name: 'data-only', defaultValue: false, description: 'If only data is touched, do not build stuff') + } + + stages { + stage("Checkout") { + options { + retry(3) + } + steps { + sh "svn cleanup 2>/dev/null || true" + script { + try { + svn "https://svn.wildfiregames.com/public/ps/trunk@${params.SVN_REV}" + } catch(e) { + sleep 300 + throw e + } + } + } + } + + stage("Pre-Build") { + when { + environment name: 'data-only', value: 'false' + } + steps { + sh "svn st --no-ignore | cut -c 9- | xargs rm -rf" + sh "svn revert -R ." + sh "build/workspaces/update-workspaces.sh -j2 --jenkins-tests" + } + } + + stage("Build") { + when { + environment name: 'data-only', value: 'false' + } + steps { + sh "cd build/workspaces/gcc/ && make -j2 config=debug" + sh "cd build/workspaces/gcc/ && make -j2 config=release" + } + } + + stage("Test") { + when { + environment name: 'data-only', value: 'false' + } + steps { + sh "binaries/system/test_dbg > cxxtest_debug.xml" + sh "binaries/system/test > cxxtest_release.xml" + } + post { + failure { + echo (message: readFile (file: "cxxtest_debug.xml")) + echo (message: readFile (file: "cxxtest_release.xml")) + } + always { + catchError { + sh "sed -i 's/date/timestamp/g' cxxtest_debug.xml" + sh "sed -i 's/date/timestamp/g' cxxtest_release.xml" + } + junit "cxxtest_*.xml" + } + } + } + + stage("Checks") { + steps { + sh "cd source/tools/entity/ && perl checkrefs.pl --check-map-xml --validate-templates" + } + } + } + + post { + always { + step([$class: 'PhabricatorNotifier']) + } + } +}