Skip to content

Commit

Permalink
Unify build workflows and argument specification
Browse files Browse the repository at this point in the history
- Merge the external-pr workflow into the maven workflow
- Create .mvn/maven.config and common build arguments to it
- Remove unused environment variable 'WORKSPACE' and inline
'JENKINS_URL' env-variable.
  • Loading branch information
HannesWell committed Apr 18, 2023
1 parent 9dc30d6 commit e3d7354
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 112 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/external-pr.yml

This file was deleted.

11 changes: 8 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'

jobs:
build:
if: github.event_name != 'pull_request' || github.event.pull_request.base.repo.clone_url != github.event.pull_request.head.repo.clone_url
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest' ] # 'windows-latest' too flaky
Expand All @@ -33,10 +37,11 @@ jobs:
- name: Build and test
uses: coactions/setup-xvfb@v1
with:
run: mvn clean verify --show-version -PuseJenkinsSnapshots -Dsurefire.rerunFailingTestsCount=3
run: mvn clean verify -PuseJenkinsSnapshots
working-directory: org.eclipse.xtext.full.releng

build-maven-artifacts:
if: github.event_name != 'pull_request' || github.event.pull_request.base.repo.clone_url != github.event.pull_request.head.repo.clone_url
runs-on: ubuntu-latest

steps:
Expand All @@ -57,5 +62,5 @@ jobs:
restore-keys: ${{ runner.os }}-maven

- name: Build Maven artifacts
run: mvn clean verify --show-version -PuseJenkinsSnapshots
working-directory: org.eclipse.xtext.maven.releng
run: mvn clean verify -PuseJenkinsSnapshots
working-directory: org.eclipse.xtext.maven.releng
3 changes: 3 additions & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--show-version
--update-snapshots
-Dsurefire.rerunFailingTestsCount=3
13 changes: 0 additions & 13 deletions full-build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
#!/usr/bin/env bash
if [ -z "$JENKINS_URL" ]; then
# if not set in environment use default
JENKINS_URL=https://ci.eclipse.org/xtext/
fi
if [ -z "$WORKSPACE" ]; then
# if not set in environment use default
WORKSPACE=$(pwd)
fi


MVN_ARGS=(\
--update-snapshots \
-DJENKINS_URL=$JENKINS_URL \
-DWORKSPACE=$WORKSPACE \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dit-archetype-tests-skip=true \
)
Expand Down Expand Up @@ -55,7 +43,6 @@ while [ "$1" != "" ]; do
done

MVN_ARGS+=(-PuseJenkinsSnapshots)
MVN_ARGS+=(-Dsurefire.rerunFailingTestsCount=3)

echo mvn -B -f org.eclipse.xtext.full.releng ${MVN_ARGS[@]} $@

Expand Down
12 changes: 0 additions & 12 deletions full-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
#!/usr/bin/env bash
if [ -z "$JENKINS_URL" ]; then
# if not set in environment use default
JENKINS_URL=https://ci.eclipse.org/xtext/
fi
if [ -z "$WORKSPACE" ]; then
# if not set in environment use default
WORKSPACE=$(pwd)
fi


MVN_ARGS=(\
--update-snapshots \
-DJENKINS_URL=$JENKINS_URL \
-DWORKSPACE=$WORKSPACE \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dit-archetype-tests-skip=true \
)
Expand Down
12 changes: 0 additions & 12 deletions maven-build.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
#!/usr/bin/env bash
if [ -z "$JENKINS_URL" ]; then
# if not set in environment use default
JENKINS_URL=https://ci.eclipse.org/xtext/
fi
if [ -z "$WORKSPACE" ]; then
# if not set in environment use default
WORKSPACE=$(pwd)
fi


MVN_ARGS=(\
--update-snapshots \
--fae \
-Dmaven.test.failure.ignore=true \
-Declipse.p2.mirrors=false \
-DJENKINS_URL=$JENKINS_URL \
-DWORKSPACE=$WORKSPACE \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dit-archetype-tests-skip=true \
)
Expand Down
7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
</scm>

<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
<tycho-version>3.0.4</tycho-version>

<maven.compiler.source>11</maven.compiler.source>
Expand All @@ -151,7 +151,6 @@
<xtend-maven-plugin-version>2.31.0.M0</xtend-maven-plugin-version>

<root-dir>${basedir}/..</root-dir>
<JENKINS_URL>https://ci.eclipse.org/xtext</JENKINS_URL>

<target-platform-classifier>xtext-latest</target-platform-classifier>

Expand Down Expand Up @@ -280,7 +279,7 @@
<repositories>
<repository>
<id>lsp4j-from-jenkins</id>
<url>${JENKINS_URL}/job/lsp4j/lastStableBuild/artifact/build/maven-repository</url>
<url>https://ci.eclipse.org/xtext/job/lsp4j/lastStableBuild/artifact/build/maven-repository</url>
</repository>
<!-- Disable sonatype snapshots -->
<repository>
Expand Down Expand Up @@ -582,7 +581,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<!-- MJAVADOC-620 – Maven Javadoc Plugin fails to resolve the dependencies
<!-- MJAVADOC-620 – Maven Javadoc Plugin fails to resolve the dependencies
when used with Java 11 -->
<version>3.5.0</version>
<configuration>
Expand Down
13 changes: 6 additions & 7 deletions releng/jenkins/sign-and-deploy/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ pipeline {
./gradlew -info \
--warning-mode all \
--refresh-dependencies \
-PJENKINS_URL=$JENKINS_URL \
-Posspub.userMavenSettings=/home/jenkins/.m2/settings.xml \
-Posspub.mavenSecurityFile=/home/jenkins/.m2/settings-security.xml \
-Posspub.version=$XTEXT_VERSION \
Expand All @@ -117,7 +116,7 @@ pipeline {
} // END dir
}
}

stage('Deploy to Eclipse project storage') {
steps {
dir('publishing') {
Expand All @@ -134,18 +133,18 @@ pipeline {
S) ZIP_NAME=tmf-xtext-Update-$XTEXT_VERSION.zip ;;
R) ZIP_NAME=tmf-xtext-Update-$VERSION.zip ;;
esac
#
# STEP 2: Zip the repository
#
cd build-result/p2.repository
zip -r $WORKSPACE/publishing/build-result/downloads/$ZIP_NAME .
md5sum --binary $WORKSPACE/publishing/build-result/downloads/$ZIP_NAME > $WORKSPACE/publishing/build-result/downloads/$ZIP_NAME.md5
cd $WORKSPACE/publishing
'''
} // END dir

sshagent(['projects-storage.eclipse.org-bot-ssh']) {
dir('publishing') {
sh '''
Expand All @@ -163,15 +162,15 @@ pipeline {
S) ZIP_NAME=tmf-xtext-Update-$XTEXT_VERSION.zip ;;
R) ZIP_NAME=tmf-xtext-Update-$VERSION.zip ;;
esac
#
# STEP 3: Upload zip und .md5
#
TARGET_DROP_PATH=$DOWNLOAD_AREA/$VERSION/$BUILD_ID
# ensure target directory exists
ssh [email protected] "mkdir -p $TARGET_DROP_PATH"
scp $WORKSPACE/publishing/build-result/downloads/$ZIP_NAME $WORKSPACE/publishing/build-result/downloads/$ZIP_NAME.md5 [email protected]:$TARGET_DROP_PATH
#
# STEP 4: Unpack zip to p2 repository location
#
Expand Down
7 changes: 0 additions & 7 deletions tycho-sign.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
if [ -z "$JENKINS_URL" ]; then
# if not set in environment use default
JENKINS_URL=https://ci.eclipse.org/xtext/
fi

# THIS SIGNS, SKIPPING TESTS

mvn \
Expand All @@ -11,8 +6,6 @@ mvn \
-P useJenkinsSnapshots \
-P eclipse-sign \
--batch-mode \
--update-snapshots \
-Dmaven.repo.local=.m2/repository \
-DJENKINS_URL=$JENKINS_URL \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
$@
6 changes: 0 additions & 6 deletions tycho-test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/usr/bin/env bash
if [ -z "$JENKINS_URL" ]; then
# if not set in environment use default
JENKINS_URL=https://ci.eclipse.org/xtext/
fi

# Use TARGET_PLATFORM from environment and 'r202203' as default.
# Overridable by 'tp' command-line arg
Expand All @@ -11,9 +7,7 @@ if [ -z "$TARGET_PLATFORM" ]; then
fi

MVN_ARGS=(\
--update-snapshots \
--fae \
-DJENKINS_URL=$JENKINS_URL \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
)

Expand Down

0 comments on commit e3d7354

Please sign in to comment.