Skip to content

fix central

fix central #50

Workflow file for this run

name: Build and Test
on:
pull_request:
branches: [main]
jobs:
test:
runs-on: ${{ matrix.os }} # compiles and test on Ubuntu
strategy:
matrix:
os: [ubuntu-latest]
java: ["17"]
fail-fast: false
steps:
- name: Checkout PR branch
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
# Checkout global JBT settings.xml
- name: Checkout JBoss Tools Build CI
uses: actions/checkout@v2
with:
repository: jbosstools/jbosstools-build-ci
path: build-ci
# Java JDK used for maven build
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64
# Try to find and apply jbosstools cache
- name: Cache local Maven repository for JBoss Tools components
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: jbosstools-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
jbosstools-${{ runner.os }}-maven-
# Build and compile using Maven
- name: Build/Compile and run unit tests
uses: GabrielBB/xvfb-action@86d97bde4a65fe9b290c0b3fb92c2c4ed0e5302d #v1
with:
run: >
mvn clean verify -U -fae --settings build-ci/maven-settings.xml -DskipITests=true
-Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true -ntp
# verify target platforms
- name: Verify target Platforms
run: |
export P2DIFFSKIP=true
export TARGET_PLATFORM_VERSION_MAX=""
export WORKSPACE=$(pwd)
TPVERSION=""
DESTURL=""
CHECK404=""
check404 ()
{
echo "in function 404"
COMP="$1"
TPVERSION="$2"
DESTURL=https://download.jboss.org/jbosstools/targetplatforms/${COMP}/${TPVERSION}/REPO/
local CHECK404=$(curl -s -k -I ${DESTURL} | egrep '404')
if [[ "${CHECK404}" ]]; then
echo "WARNING [404]: No target platform found for version = ${TPVERSION} at ${DESTURL}"
else
echo ${DESTURL}
fi
}
for t in jbtcentraltarget; do
echo "iter $t"
if [[ ${P2DIFFSKIP} == "false" ]]; then
# check if target platform site exists against which to run p2diff
if [[ ${TARGET_PLATFORM_VERSION_MAX} ]]; then
CHECK404=$(check404 $t ${TARGET_PLATFORM_VERSION_MAX})
DESTURL=${CHECK404}
fi
if [[ ! ${CHECK404} ]] || [[ ${CHECK404} == *"[404]"* ]]; then # fall back to local pom as TP version
echo "second if"
CHECK404=$(check404 $t "$(cat ./$t/pom.xml | grep version | head -2 | tail -1 | sed -e "s#.\+<version>\(.\+\)</version>.*#\1#")")
DESTURL=${CHECK404}
fi
if [[ ${CHECK404} == *"[404]"* ]]; then # fall back to parent pom value of latest published TP MAX
CHECK404=$(check404 $t "$(curl -s -k https://raw.githubusercontent.com/jbosstools/jbosstools-build/main/parent/pom.xml | \
egrep "<TARGET_PLATFORM_VERSION_MAX>" | sed -e "s#.\+<TARGET_PLATFORM_VERSION_MAX>\(.\+\)</TARGET_PLATFORM_VERSION_MAX>.*#\1#")")
DESTURL=${CHECK404}
fi
if [[ ${CHECK404} == *"[404]"* ]]; then # fall back to parent pom value of latest published TP MIN
CHECK404=$(check404 $t "$(curl -s -k https://raw.githubusercontent.com/jbosstools/jbosstools-build/main/parent/pom.xml | \
egrep "<TARGET_PLATFORM_VERSION_MIN>" | sed -e "s#.\+<TARGET_PLATFORM_VERSION_MIN>\(.\+\)</TARGET_PLATFORM_VERSION_MIN>.*#\1#")")
DESTURL=${CHECK404}
fi
if [[ ${CHECK404} == *"[404]"* ]]; then # can't do p2diff
DESTURL=""
fi
fi
echo "DESTURL = ${DESTURL}"
if [[ ${DESTURL} != "" ]]; then
MVNFLAGS="-Dp2diff.skip=${P2DIFFSKIP} -DtargetRepositoryUrl=${DESTURL}"
else
MVNFLAGS="-Dp2diff.skip=true"
fi
MVN="mvn -U -e -fae -B -Dmaven.repo.local=${WORKSPACE}/.repository/ --no-transfer-progress"
${MVN} --settings build-ci/maven-settings.xml verify -Pmultiple2repo -f ${WORKSPACE}/$t/multiple/pom.xml ${MVNFLAGS}
done