Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

chore: Add maven clirr check #1848

Merged
merged 5 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ on:
pull_request:
name: ci
jobs:
clirr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll be supporting Java 8 for a while, do we want to use Java 8 here?

Copy link
Contributor Author

@lqiu96 lqiu96 Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I've added both Java 8 and 11. The mvn install fails with the <release>8</release> flag in the maven-compiler-plugin on Java 8 (so compilation with still be with Java 11).

- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- run: .kokoro/maven-build.sh
env:
JOB_TYPE: clirr
maven-units:
name: "maven unit tests"
runs-on: ubuntu-latest
Expand Down
25 changes: 18 additions & 7 deletions .kokoro/maven-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,13 @@ fi
echo "Compiling using Java:"
java -version
echo
mvn -V -B -ntp clean install
mvn -V -B -ntp clean install -DskipTests -Dclirr.skip=true -Denforcer.skip=true

# We ensure the generated class files are compatible with Java 8
if [ ! -z "${JAVA8_HOME}" ]; then
setJava "${JAVA8_HOME}"
fi

echo "Running tests using Java:"
java -version

if [ "${GITHUB_JOB}" == "units-java8" ]; then
java -version 2>&1 | grep -q 'openjdk version "1.8.'
MATCH=$? # 0 if the output has the match
Expand All @@ -56,6 +53,20 @@ if [ "${GITHUB_JOB}" == "units-java8" ]; then
fi
fi

echo
# run tests in Java 8 with the source compiled in Java 11
mvn -V -B -ntp surefire:test
RETURN_CODE=0

case "${JOB_TYPE}" in
test)
# run tests in Java 8 with the source compiled in Java 11
mvn -V -B -ntp surefire:test -Dclirr.skip=true -Denforcer.skip=true
RETURN_CODE=$?
;;
clirr)
mvn -B -ntp -Denforcer.skip=true clirr:check
RETURN_CODE=$?
;;
*) ;;
esac

echo "exiting with ${RETURN_CODE}"
exit ${RETURN_CODE}