Skip to content

Commit

Permalink
Support update site promotion via a Jenkins pipeline
Browse files Browse the repository at this point in the history
Improve the bundle names as they appear in the update sites.
Upgrade to latest Tycho release.
Provide a functional Oomph setup, including a configuration use it in
the CONTRIBUTING.md.
Ensure that the nightly target works.
  • Loading branch information
merks committed Oct 14, 2023
1 parent 2925100 commit bc8dee7
Show file tree
Hide file tree
Showing 58 changed files with 935 additions and 217 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ src-gen/
xtend-gen/
xtext-gen/
target/
/xpect/updates
xpect-local-maven-repository
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,15 @@
</buildSpec>
<natures>
</natures>
<filteredResources>
<filter>
<id>1697202706223</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-projectRelativePath-matches-false-true-org.eclipse.(xpect|xtext).*/.*</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
32 changes: 20 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
Contributions are welcome.
# Contributing to Eclipse Xpect

## Eclipse Contributor Agreement
Before your contribution can be accepted by the project team contributors must
electronically sign the Eclipse Contributor Agreement (ECA).
Thanks for your interest in this project.

* http://www.eclipse.org/legal/ECA.php
## Creating an Eclipse Development Environment

Commits that are provided by non-committers must have a Signed-off-by field in
the footer indicating that the author is aware of the terms by which the
contribution has been provided to the project. The non-committer must
additionally have an Eclipse Foundation account and must have a signed Eclipse
Contributor Agreement (ECA) on file.
For more information, please see the Eclipse Committer Handbook:
https://www.eclipse.org/projects/handbook/#resources-commit
You can set up a pre-configured IDE for the development of Xpect using the following link:

[![Create Eclipse Development Environment for Xpect](https://download.eclipse.org/oomph/www/setups/svg/Xpect.svg)](https://www.eclipse.org/setups/installer/?url=https://raw.githubusercontent.com/merks/Xpect/master/org.eclipse.xpect.releng/XpectConfiguration.setup&show=true "Click to open Eclipse-Installer Auto Launch or drag onto your running installer's title area")



## General Processes and Workflows

The [eclipse-platform](https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md) provides detailed contribution information that is generally applicable also for Xpect.


## Contact

Contact the project developers via issues (preferred) or via "xpect-dev" mailing list.

* https://github.com/eclipse/Xpect/issues
* https://dev.eclipse.org/mailman/listinfo/xpect-dev
248 changes: 142 additions & 106 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,117 +1,153 @@
/*******************************************************************************
* Copyright (c) 2012-2017 TypeFox GmbH and itemis AG.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Moritz Eysholdt - Initial contribution and API
*******************************************************************************/

timestamps() {
properties([
pipelineTriggers([cron('H 2 * * *')])
])
node('centos-8') {
def javaHome = tool 'temurin-jdk11-latest'
def java17Home = tool 'temurin-jdk17-latest'
env.JAVA_HOME = "${javaHome}"
def mvnHome = tool 'apache-maven-3.8.6'
def mvnParams = '--batch-mode --update-snapshots -fae -Dmaven.repo.local=xpect-local-maven-repository -DtestOnly=false'
try {
timeout(time: 1, unit: 'HOURS') {
stage('prepare workspace') {
step([$class: 'WsCleanup'])
// we need to live with detached head, or we need to adjust settings:
// https://issues.jenkins-ci.org/browse/JENKINS-42860
checkout scm
}
stage('log configuration') {
echo("===== checking tools versions =====")
sh """\
git config --get remote.origin.url
git reset --hard
pwd
ls -la
${mvnHome}/bin/mvn -v
${javaHome}/bin/java -version
"""
echo("===================================")
}
wrap([$class: 'Xvnc', useXauthority: true]) {
stage('compile with Eclipse 2023-03 and Xtext 2.31.0') {
sh "${mvnHome}/bin/mvn -P!tests -Declipsesign=true -Dtarget-platform=eclipse_2023_03-xtext_2_31_0 ${mvnParams} clean install"
archiveArtifacts artifacts: 'org.eclipse.xpect.releng/p2-repository/target/repository/**/*.*,org.eclipse.xpect.releng/p2-repository/target/org.eclipse.xpect.repository-*.zip'
}
}
pipeline {
agent {
label 'centos-latest'
}

wrap([$class: 'Xvnc', useXauthority: true]) {
stage('test with Eclipse 2023-09 and Xtext nighly') {
try{
sh "JAVA_HOME=${java17Home} ${mvnHome}/bin/mvn -P!xtext-examples -Dtycho-version=2.7.5 -Dtarget-platform=eclipse_2023_09-xtext_nightly ${mvnParams} clean integration-test"
}finally {
junit '**/TEST-*.xml'
}
}
}
triggers {
cron('H 23 * * *')
}

if(env.BRANCH_NAME?.toLowerCase() == 'master' ||
env.BRANCH_NAME?.toLowerCase()?.startsWith('release_')) {
stage('deploy') {
withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) {
sh '''
rm -r xpect-local-maven-repository
gpg --batch --import "${KEYRING}"
for fpr in $(gpg --list-keys --with-colons | awk -F: '/fpr:/ {print $10}' | sort -u);
do
echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key $fpr trust;
done
'''
sh "${mvnHome}/bin/mvn -P!tests -P!xtext-examples -P maven-publish -Dtarget-platform=eclipse_2023_03-xtext_2_31_0 ${mvnParams} clean deploy"
}
}
}
options {
buildDiscarder(logRotator(numToKeepStr: '30'))
disableConcurrentBuilds()
skipDefaultCheckout false
}

tools {
maven 'apache-maven-latest'
jdk 'temurin-jdk17-latest'
}

environment {
PUBLISH_LOCATION = 'updates'
BUILD_TIMESTAMP = sh(returnStdout: true, script: 'date +%Y%m%d%H%M').trim()
}

parameters {
choice(
name: 'BUILD_TYPE',
choices: ['nightly', 'milestone', 'release'],
description: '''
Choose the type of build.
Note that a release build will not promote the build, but rather will promote the most recent milestone build.
'''
)

choice(
name: 'TARGET_PLATFORM',
choices: [ 'eclipse_2023_03-xtext_2_31_0', 'eclipse_2023_09-xtext_nightly' ],
description: '''
Choose the named target platform against which to compile and test.
This is relevant only for nightly and milestone builds.
'''
)

booleanParam(
name: 'ECLIPSE_SIGN',
defaultValue: true,
description: '''
Choose whether or not the bundles will be signed.
This is relevant only for nightly and milestone builds.
'''
)

booleanParam(
name: 'PROMOTE',
defaultValue: true,
description: 'Whether to promote the build to the download server.'
)
}

stages {
stage('Display Parameters') {
steps {
script {
env.BUILD_TYPE = params.BUILD_TYPE
env.TARGET_PLATFORM = params.TARGET_PLATFORM

if (env.BRANCH_NAME == 'master') {
// Only sign the master branch.
env.ECLIPSE_SIGN = params.ECLIPSE_SIGN
} else {
env.ECLIPSE_SIGN = false
}

// Only promote signed builds.
env.PROMOTE = params.PROMOTE && (env.ECLIPSE_SIGN == 'true')
}
} catch(e) {
currentBuild.result = 'FAILED'
throw e
} finally {
postAlways()
echo """
BUILD_TIMESTAMP=${env.BUILD_TIMESTAMP}
BUILD_TYPE=${env.BUILD_TYPE}
TARGET_PLATFORM=${env.TARGET_PLATFORM}
ECLIPSE_SIGN=${env.ECLIPSE_SIGN}
PROMOTE=${env.PROMOTE}
BRANCH_NAME=${env.BRANCH_NAME}
"""
}
}

stage('Build') {
steps {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
wrap([$class: 'Xvnc', useXauthority: true]) {
dir('.') {
sh '''
if [[ $PROMOTE != true ]]; then
promotion_argument='-P!promote'
fi
mvn \
--fail-at-end \
--no-transfer-progress \
--update-snapshots \
$promotion_argument \
-Dmaven.repo.local=xpect-local-maven-repository \
-Dmaven.artifact.threads=16 \
-Dbuild.id=${BUILD_TIMESTAMP} \
-Dgit.commit=$GIT_COMMIT \
-Declipsesign=${ECLIPSE_SIGN} \
-Dbuild.type=$BUILD_TYPE \
-Dtycho-version=4.0.3 \
-Dtarget-platform=${TARGET_PLATFORM} \
-Dgit.url=https://github.com/merks/Xpect \
-Dorg.eclipse.justj.p2.manager.build.url=$JOB_URL \
-Dorg.eclipse.justj.p2.manager.relative=$PUBLISH_LOCATION \
-Dorg.eclipse.justj.p2.manager.remote=genie.oomph@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/oomph/archive/xpect \
clean \
verify
'''
}
}
}
}
}
}
}

post {
failure {
mail to: 'ed.merks@gmail.com',
subject: "[EMF CI] Build Failure ${currentBuild.fullDisplayName}",
mimeType: 'text/html',
body: "Project: ${env.JOB_NAME}<br/>Build Number: ${env.BUILD_NUMBER}<br/>Build URL: ${env.BUILD_URL}<br/>Console: ${env.BUILD_URL}/console"
archiveArtifacts allowEmptyArchive: true, artifacts: '**'
}

def postAlways() {
def curResult = currentBuild.currentResult
def lastResult = 'NEW'
if (currentBuild.previousBuild != null) {
lastResult = currentBuild.previousBuild.result
fixed {
mail to: 'ed.merks@gmail.com',
subject: "[EMF CI] Back to normal ${currentBuild.fullDisplayName}",
mimeType: 'text/html',
body: "Project: ${env.JOB_NAME}<br/>Build Number: ${env.BUILD_NUMBER}<br/>Build URL: ${env.BUILD_URL}<br/>Console: ${env.BUILD_URL}/console"
}

if (curResult != 'SUCCESS' || lastResult != 'SUCCESS') {
def color = ''
switch (curResult) {
case 'SUCCESS':
color = '#00FF00'
break
case 'UNSTABLE':
color = '#FFFF00'
break
case 'FAILURE':
color = '#FF0000'
break
default: // e.g. ABORTED
color = '#666666'
}
success {
archiveArtifacts artifacts: 'org.eclipse.xpect.releng/p2-repository/target/repository/**/*.*,org.eclipse.xpect.releng/p2-repository/target/org.eclipse.xpect.repository-*.zip'
}

always {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
}

matrixSendMessage https: true,
hostname: 'matrix.eclipse.org',
accessTokenCredentialsId: "matrix-token",
roomId: '!aFWRHMCLJDZBzuNIRD:matrix.eclipse.org',
body: "${lastResult} => ${curResult} ${env.BUILD_URL} | ${env.JOB_NAME}#${env.BUILD_NUMBER}",
formattedBody: "<div><font color='${color}'>${lastResult} => ${curResult}</font> | <a href='${env.BUILD_URL}' target='_blank'>${env.JOB_NAME}#${env.BUILD_NUMBER}</a></div>"
cleanup {
deleteDir()
}
}
}
}
28 changes: 9 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
<!--
Copyright (c) 2012-2017 TypeFox GmbH and itemis AG.
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
# Eclipse Xpect

Contributors:
Moritz Eysholdt - Initial contribution and API
-->

# Xpect

A unit- and integration-testing framework that stores test data in any kind of text files and is based on JUnit.
Xpect&trade; is a unit- and integration-testing framework that stores test data in any kind of text files and is based on JUnit.
The core focus of Xpect is on testing Xtext languages and supporting the process of designing Xtext languages.

## Documentation

## Installation further Information

Go to http://www.xpect-tests.org (and look for an Eclipse update-site).
Visit [xpect-tests.org](http://www.xpect-tests.org) for details.

#### Nightly builds

Use Jenkins https://ci.eclipse.org/xpect/job/Xpect/job/master/lastSuccessfulBuild/artifact/org.eclipse.xpect.releng/p2-repository/target/repository/


# Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for details.

## Compile and Build Xpect by Yourself

Prerequisite: Java 11 or newer; Eclipse (2023-03 or newer recommended); Xtext 2.31.0.
Expand All @@ -32,6 +25,3 @@ Prerequisite: Java 11 or newer; Eclipse (2023-03 or newer recommended); Xtext 2.
3. Set target platform to /org.eclipse.xpect.releng/target-platforms/eclipse_2023_03-xtext_2_31_0/org.eclipse.xpect.target.eclipse_2023_03-xtext_2_31_0.target (Preferences -> Plug-in Development -> Target Platform)
4. Run /org.eclipse.xpect/src/org/eclipse/xpect/GenerateXpect.mwe2, /org.xtext.example.arithmetics/src/org/eclipse/xpect/example/arithmetics/GenerateXpect.mwe2, /org.xtext.example.domainmodel/src/org/xtext/example/domainmodel/GenerateDomainmodel.mwe2. Now your projects should be without errors markers. Sometimes, even after these steps, several projects still have error markers. However, this is a refresh problem in Eclipse. Simply clean build the projects with error markers will solve the issues.
5. Run `mvn -P '!tests' -Dtarget-platform=eclipse_2023_03-xtext_2_31_0 --batch-mode --update-snapshots -fae -Dmaven.repo.local=xpect-local-maven-repository -DtestOnly=false clean install` to build artefacts and create a p2 repository (formerly known as update site).



5 changes: 3 additions & 2 deletions org.eclipse.xpect.doc/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Doc
Bundle-SymbolicName: org.eclipse.xpect.doc
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.xpect.doc
Bundle-Localization: plugin
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.xtext;bundle-version="2.4.0",
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.xpect.doc/plugin.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

pluginName = org.eclipse.xpect.doc
providerName = Eclipse Xpect Project
pluginName = Xpect Documentation
providerName = Eclipse Xpect
5 changes: 3 additions & 2 deletions org.eclipse.xpect.examples/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Examples
Bundle-SymbolicName: org.eclipse.xpect.examples
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.xpect.examples
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.xtend.lib,
Expand Down

0 comments on commit bc8dee7

Please sign in to comment.