forked from pmd/pmd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
533 additions
and
258 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
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,3 @@ | ||
#!/bin/bash | ||
set -ev | ||
mvn verify -B -V |
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,38 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec) | ||
echo "Building PMD ${VERSION} on branch ${TRAVIS_BRANCH}" | ||
|
||
if [[ "$VERSION" != *-SNAPSHOT && "$TRAVIS_TAG" != "" ]]; then | ||
mvn deploy -Possrh,pmd-release -B -V | ||
else | ||
mvn deploy -Possrh -B -V | ||
fi | ||
|
||
bash .travis/build-site.sh | ||
|
||
# create pmd-doc archive | ||
( | ||
cd target | ||
mv staging pmd-doc-${VERSION} | ||
zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/ | ||
) | ||
|
||
# Uploading pmd distribution to sourceforge | ||
if [ "$TRAVIS_TAG" = "" ]; then | ||
rsync -avh pmd-dist/target/pmd-*-${VERSION}.zip target/pmd-doc-${VERSION}.zip ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/ | ||
rsync -avh src/site/markdown/overview/changelog.md ${PMD_SF_USER}@web.sourceforge.net:/home/frs/project/pmd/pmd/${VERSION}/ReadMe.md | ||
fi | ||
|
||
if [[ "$VERSION" == *-SNAPSHOT && "$TRAVIS_BRANCH" == "master" ]]; then | ||
# Uploading snapshot site... | ||
rsync -ah --stats --delete target/pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/ | ||
fi | ||
|
||
|
||
if [[ "$VERSION" == *-SNAPSHOT && "$TRAVIS_BRANCH" == "master" ]]; then | ||
# only do a clean build for sonar, if we are executing a snapshot build, otherwise we can't reuse the build from above for the release | ||
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarqube.com -Dsonar.login=${SONAR_TOKEN} -B -V | ||
fi | ||
|
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,48 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
# Do not log the output, to avoid the travis log length limit of 4MB | ||
# Solution from http://stackoverflow.com/questions/26082444/how-to-work-around-travis-cis-4mb-output-limit/26082445#26082445 | ||
|
||
|
||
|
||
export PING_SLEEP=30s | ||
export BUILD_OUTPUT=/tmp/build-site.out | ||
export PING_PID_FILE=/tmp/build-site-ping.pid | ||
|
||
touch $BUILD_OUTPUT | ||
|
||
dump_output() { | ||
echo Tailing the last 500 lines of output: | ||
tail -500 $BUILD_OUTPUT | ||
} | ||
kill_ping() { | ||
if [ -e $PING_PID_FILE ]; then | ||
PING_LOOP_PID=$(cat $PING_PID_FILE) | ||
kill $PING_LOOP_PID | ||
rm $PING_PID_FILE | ||
fi | ||
} | ||
error_handler() { | ||
kill_ping | ||
echo ERROR: An error was encountered with the build. | ||
dump_output | ||
exit 1 | ||
} | ||
# If an error occurs, run our error handler to output a tail of the build | ||
trap 'error_handler' ERR | ||
|
||
# Set up a repeating loop to send some output to Travis. | ||
bash -c "while true; do echo \$(date) - building ...; sleep $PING_SLEEP; done" & | ||
PING_LOOP_PID=$! | ||
echo "$PING_LOOP_PID" > $PING_PID_FILE | ||
|
||
# Run the build, redirect output into the file | ||
mvn site site:stage -Psite -B -V >> $BUILD_OUTPUT 2>&1 | ||
|
||
# The build finished without returning an error so dump a tail of the output | ||
dump_output | ||
|
||
# nicely terminate the ping output loop | ||
kill_ping | ||
|
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 @@ | ||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yHVLHYDsKui8tYg/sFvkDqcs97pEZz0BzK9HtBF4O+/It1drRYRdUAFfjoImfprpKSxkJCTglHixGRp24eNaZ6woWVJ4/bmiMkEqEZAjr1NZ3qw7zIruMJMSkCV+YTtmL4cYcZlvMRPzzOZOnFbV05oi79oy41MUFHYjolK9QxMFNsVNN5iyzFxM3HqSFozz+ylKbFBtDk6ZHZQNRL/Xl2V9DJ69fVzjG4OZfcWNGmmKHHARmsnJyUOMeeKpLjDOe1M6ZdI8HkXWac8yCr9JTETNZZwemZAcS/RKoKCDqfIUOzkZfIPmyaznfVetTGsMi7yQrJhAyjznuNGF4+3lfgTcmRF8wz5FCeUkdYTmy2wNSFi5HiLPfC5OgRtjKzC6yb8rbRjDx6XQ2ph15PKOaXwzk49TaMc0xJvoiGDMZaTU0iTm3Y1/QUtfLvo3/jGMbtUdV3soWpuBAV2JUI4aB5xdLX9iNmcrVzoUe3y9DWuuTX46eoCvpUNXv/DXKhQw1D7xd7J67db5qUck/Akiqi0JR+e0SoBJvZFtYwVNLGC2bIJ/s8SR8X5Zp+1+ypf3WYjIylxQTkO1r4NfI0Cd9qXg7nmUrHAU7Z6xtJmUK8ZWzSST4wul8WkRJURtODLxt5firtlKhyZ93t9Mjuk6mATIPxr/b3x20T+IH463kw== ssh key for pmd. used for travis accessing sourceforge and github. |
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,15 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
# remember the current directory | ||
SOURCE_HOME=$PWD | ||
|
||
cd $HOME | ||
wget -q http://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz | ||
tar zxf apache-maven-3.3.9-bin.tar.gz | ||
chmod +x apache-maven-3.3.9/bin/mvn | ||
|
||
echo "MAVEN_OPTS='-Xms1g -Xmx1g'" > .mavenrc | ||
mkdir -p .m2 | ||
cp $SOURCE_HOME/.travis/travis-toolchains.xml .m2/toolchains.xml | ||
cp $SOURCE_HOME/.travis/travis-settings.xml .m2/settings.xml |
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,54 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
RELEASE_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec) | ||
|
||
# Deploy to ossrh has already been done with the usual build. See build-push.sh | ||
|
||
# The site has been built before, the files have already been uploaded to sourceforge. | ||
# Since this is a release, making the binary the new default file... | ||
curl -H "Accept: application/json" -X PUT -d "default=windows&default=mac&default=linux&default=bsd&default=solaris&default=others" \ | ||
-d "api_key=${PMD_SF_APIKEY}" https://sourceforge.net/projects/pmd/files/pmd/${RELEASE_VERSION}/pmd-bin-${RELEASE_VERSION}.zip | ||
|
||
|
||
# Assumes, the release has already been created by travis github releases provider | ||
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" https://api.github.com/repos/pmd/pmd/releases/tags/pmd_releases/${RELEASE_VERSION}|jq ".id") | ||
RELEASE_NAME="PMD ${RELEASE_VERSION} ($(date -u +%d-%B-%Y))" | ||
RELEASE_BODY=$(cat src/site/markdown/overview/changelog.md) | ||
RELEASE_BODY="${RELEASE_BODY//$'\\'/\\\\}" | ||
RELEASE_BODY="${RELEASE_BODY//$'\r'/}" | ||
RELEASE_BODY="${RELEASE_BODY//$'\n'/\\r\\n}" | ||
RELEASE_BODY="${RELEASE_BODY//$'"'/\\$'"'}" | ||
cat > release-edit-request.json <<EOF | ||
{ | ||
"name": "$RELEASE_NAME", | ||
"body": "$RELEASE_BODY" | ||
} | ||
EOF | ||
echo "Updating release at https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}..." | ||
RESPONSE=$(curl -i -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" -H "Content-Type: application/json" --data-binary "@release-edit-request.json" -X PATCH https://api.github.com/repos/pmd/pmd/releases/${RELEASE_ID}) | ||
if [[ "$RESPONSE" != *"HTTP/1.1 200"* ]]; then | ||
echo "$RESPONSE" | ||
else | ||
echo "Update OK" | ||
fi | ||
|
||
|
||
|
||
echo "Adding the site to pmd.github.io..." | ||
# clone pmd.github.io. Note: This uses the ssh key setup earlier | ||
git clone --depth 1 [email protected]:pmd/pmd.github.io.git | ||
rsync -a target/pmd-doc-${RELEASE_VERSION}/ pmd.github.io/pmd-${RELEASE_VERSION}/ | ||
( | ||
cd pmd.github.io | ||
git config user.email "[email protected]" | ||
git config user.name "Andreas Dangel (PMD Releases)" | ||
git add pmd-${RELEASE_VERSION} | ||
git commit -m "Added pmd-${RELEASE_VERSION}" | ||
git rm -qr latest | ||
cp -a pmd-${RELEASE_VERSION} latest | ||
git add latest | ||
git commit -m "Copying pmd-${RELEASE_VERSION} to latest" | ||
git push origin | ||
) | ||
|
Binary file not shown.
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
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,34 @@ | ||
<?xml version="1.0" encoding="UTF8"?> | ||
<toolchains> | ||
<!-- place this file in ${user.home}/.m2/toolchains.xml --> | ||
|
||
<!-- see: https://github.com/travis-ci/travis-cookbooks/blob/master/cookbooks/travis_java/templates/ubuntu/jdk_switcher.sh.erb --> | ||
|
||
<toolchain> | ||
<type>jdk</type> | ||
<provides> | ||
<version>1.6</version> | ||
</provides> | ||
<configuration> | ||
<jdkHome>/usr/lib/jvm/java-6-openjdk-amd64</jdkHome> | ||
</configuration> | ||
</toolchain> | ||
<toolchain> | ||
<type>jdk</type> | ||
<provides> | ||
<version>1.7</version> | ||
</provides> | ||
<configuration> | ||
<jdkHome>/usr/lib/jvm/java-7-openjdk-amd64</jdkHome> | ||
</configuration> | ||
</toolchain> | ||
<toolchain> | ||
<type>jdk</type> | ||
<provides> | ||
<version>1.8</version> | ||
</provides> | ||
<configuration> | ||
<jdkHome>/usr/lib/jvm/java-8-oracle</jdkHome> | ||
</configuration> | ||
</toolchain> | ||
</toolchains> |
Oops, something went wrong.