forked from phoedos/pmd
[ci] Add travis build on windows
* New parallel build for windows * New before_install.sh script that prepares java, maven, ruby
This commit is contained in:
15
.travis.yml
15
.travis.yml
@ -37,16 +37,15 @@ matrix:
|
||||
- name: "macosx - mvn verify"
|
||||
os: osx
|
||||
env: BUILD=deploy
|
||||
- name: "windows - mvn verify"
|
||||
os: windows
|
||||
env: BUILD=deploy
|
||||
language: shell
|
||||
|
||||
before_install:
|
||||
- bash .travis/setup-secrets.sh
|
||||
- bash .travis/configure-maven.sh
|
||||
- rvm install 2.4.1
|
||||
- rvm use 2.4.1
|
||||
install:
|
||||
- . .travis/install-openjdk.sh
|
||||
- gem install bundler
|
||||
- bundle install --with=release_notes_preprocessing --path=vendor/bundle
|
||||
- bash .travis/before_install.sh
|
||||
- source ${HOME}/java.env
|
||||
install: true
|
||||
before_script: true
|
||||
script: source .travis/build-$BUILD.sh
|
||||
after_success: true
|
||||
|
22
.travis/before_install.sh
Normal file
22
.travis/before_install.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
source .travis/logger.sh
|
||||
source .travis/common-functions.sh
|
||||
|
||||
travis_debug
|
||||
|
||||
bash .travis/setup-secrets.sh
|
||||
bash .travis/configure-maven.sh
|
||||
bash .travis/install-openjdk.sh
|
||||
|
||||
|
||||
if travis_isLinux; then
|
||||
rvm install 2.4.1
|
||||
rvm use 2.4.1
|
||||
gem install bundler
|
||||
bundle install --with=release_notes_preprocessing --path=vendor/bundle
|
||||
else
|
||||
log_info "Not setting up ruby for ${TRAVIS_OS_NAME}."
|
||||
exit 0
|
||||
fi
|
@ -55,6 +55,11 @@ if travis_isOSX; then
|
||||
log_info "The build is running on OSX"
|
||||
./mvnw verify $MVN_BUILD_FLAGS
|
||||
|
||||
elif travis_isWindows; then
|
||||
|
||||
log_info "The build is running on Windows"
|
||||
./mvnw verify $MVN_BUILD_FLAGS
|
||||
|
||||
elif travis_isPullRequest; then
|
||||
|
||||
log_info "This is a pull-request build"
|
||||
|
@ -2,15 +2,17 @@
|
||||
set -e
|
||||
|
||||
|
||||
echo "TRAVIS_REPO_SLUG: ${TRAVIS_REPO_SLUG}"
|
||||
echo "TRAVIS_PULL_REQUEST_SLUG: ${TRAVIS_PULL_REQUEST_SLUG}"
|
||||
echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}"
|
||||
echo "TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST}"
|
||||
echo "TRAVIS_SECURE_ENV_VARS: ${TRAVIS_SECURE_ENV_VARS}"
|
||||
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
|
||||
echo "TRAVIS_TAG: ${TRAVIS_TAG}"
|
||||
echo "TRAVIS_ALLOW_FAILURE: ${TRAVIS_ALLOW_FAILURE}"
|
||||
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
|
||||
function travis_debug() {
|
||||
echo "TRAVIS_REPO_SLUG: ${TRAVIS_REPO_SLUG}"
|
||||
echo "TRAVIS_PULL_REQUEST_SLUG: ${TRAVIS_PULL_REQUEST_SLUG}"
|
||||
echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}"
|
||||
echo "TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST}"
|
||||
echo "TRAVIS_SECURE_ENV_VARS: ${TRAVIS_SECURE_ENV_VARS}"
|
||||
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
|
||||
echo "TRAVIS_TAG: ${TRAVIS_TAG}"
|
||||
echo "TRAVIS_ALLOW_FAILURE: ${TRAVIS_ALLOW_FAILURE}"
|
||||
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
|
||||
}
|
||||
|
||||
function travis_isPullRequest() {
|
||||
if [ "${TRAVIS_REPO_SLUG}" != "pmd/pmd" ] || [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
||||
@ -36,6 +38,23 @@ function travis_isOSX() {
|
||||
fi
|
||||
}
|
||||
|
||||
function travis_isLinux() {
|
||||
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function travis_isWindows() {
|
||||
if [[ $TRAVIS_OS_NAME == 'windows' ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function has_docs_change() {
|
||||
if [[ $(git diff --name-only ${TRAVIS_COMMIT_RANGE}) = *"docs/"* ]]; then
|
||||
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): changes found"
|
||||
|
@ -1,13 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
#
|
||||
# AdoptOpenJDK Builds from:
|
||||
# https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/tag/jdk-11.0.4%2B11
|
||||
#
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
DOWNLOAD_URL=https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_mac_hotspot_11.0.4_11.tar.gz
|
||||
source .travis/logger.sh
|
||||
source .travis/common-functions.sh
|
||||
|
||||
VERSION_TAG="11.0.4+11"
|
||||
|
||||
log_info "Installing OpenJDK ${VERSION_TAG} for ${TRAVIS_OS_NAME}"
|
||||
|
||||
if travis_isOSX; then
|
||||
DOWNLOAD_URL=https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-${VERSION_TAG/+/%2B}/OpenJDK11U-jdk_x64_mac_hotspot_${VERSION_TAG/+/_}.tar.gz
|
||||
COMPONENTS_TO_STRIP=3 # e.g. jdk-11.0.3+7/Contents/Home/bin/java
|
||||
elif travis_isWindows; then
|
||||
DOWNLOAD_URL=https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-${VERSION_TAG/+/%2B}/OpenJDK11U-jdk_x64_windows_hotspot_${VERSION_TAG/+/_}.zip
|
||||
else
|
||||
DOWNLOAD_URL=https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_linux_hotspot_11.0.4_11.tar.gz
|
||||
DOWNLOAD_URL=https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-${VERSION_TAG/+/%2B}/OpenJDK11U-jdk_x64_linux_hotspot_${VERSION_TAG/+/_}.tar.gz
|
||||
COMPONENTS_TO_STRIP=1 # e.g. openjdk-11.0.3+7/bin/java
|
||||
fi
|
||||
|
||||
@ -18,10 +30,24 @@ TARGET_DIR=${HOME}/openjdk11
|
||||
|
||||
mkdir -p ${LOCAL_DIR}
|
||||
mkdir -p ${TARGET_DIR}
|
||||
wget --quiet --directory-prefix ${LOCAL_DIR} --timestamping --continue ${DOWNLOAD_URL}
|
||||
tar --extract --file ${LOCAL_DIR}/${OPENJDK_ARCHIVE} -C ${TARGET_DIR} --strip-components=${COMPONENTS_TO_STRIP}
|
||||
log_info "Downloading from ${DOWNLOAD_URL} to ${LOCAL_DIR}"
|
||||
wget --directory-prefix ${LOCAL_DIR} --timestamping --continue ${DOWNLOAD_URL}
|
||||
|
||||
export JAVA_HOME=${TARGET_DIR}
|
||||
export PATH=${JAVA_HOME}/bin:$PATH
|
||||
log_info "Extracting to ${TARGET_DIR}"
|
||||
if travis_isWindows; then
|
||||
7z x ${LOCAL_DIR}/${OPENJDK_ARCHIVE} -o${TARGET_DIR}
|
||||
mv ${TARGET_DIR}/*/* ${TARGET_DIR}/
|
||||
else
|
||||
tar --extract --file ${LOCAL_DIR}/${OPENJDK_ARCHIVE} -C ${TARGET_DIR} --strip-components=${COMPONENTS_TO_STRIP}
|
||||
fi
|
||||
|
||||
cat > ${HOME}/java.env <<EOF
|
||||
export JAVA_HOME="${TARGET_DIR}"
|
||||
export PATH="${TARGET_DIR}/bin:${PATH}"
|
||||
EOF
|
||||
|
||||
log_info "OpenJDK can be used via ${HOME}/java.env"
|
||||
cat ${HOME}/java.env
|
||||
source ${HOME}/java.env
|
||||
|
||||
java -version
|
||||
|
Reference in New Issue
Block a user