Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: ci to build with JDK 11 (cont.) #1890

Merged
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
14 changes: 13 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,22 @@ jobs:
java: [8, 11, 17]
steps:
- uses: actions/checkout@v3
# For Java 8 tests, use JDK 11 to compile
- if: ${{matrix.java}} == '8'
uses: actions/setup-java@v3
with:
java-version: 11
distribution: zulu
- if: ${{matrix.java}} == '8'
run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{matrix.java}}
- if: ${{matrix.java}} == '8'
run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
shell: bash
- run: java -version
- run: .kokoro/dependencies.sh
lint:
Expand All @@ -108,7 +120,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 8
java-version: 11
- run: java -version
- run: .kokoro/build.sh
env:
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/integration-tests-against-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,27 @@ jobs:
- uses: stCarolas/setup-maven@v4
with:
maven-version: 3.8.1
- uses: actions/setup-java@v1
# Build with JDK 11 and run tests with JDK 8
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: zulu
- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
shell: bash
- run: java -version
- run: .kokoro/build.sh
- run: mvn -B -Dspanner.testenv.instance="" -Penable-integration-tests -DtrimStackTrace=false -Dclirr.skip=true -Denforcer.skip=true -fae verify
- name: Compiling main library
run: .kokoro/build.sh
- name: Running tests
run: |
mvn -B -Dspanner.testenv.instance="" -Penable-integration-tests \
-DtrimStackTrace=false -Dclirr.skip=true -Denforcer.skip=true \
-Dmaven.main.skip=true -fae verify
env:
JOB_TYPE: test
SPANNER_EMULATOR_HOST: localhost:9010
Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,39 @@ jobs:
- name: Run checkstyle
run: mvn -P lint --quiet --batch-mode checkstyle:check
working-directory: samples/snippets
compile-java8:
name: "compile (8)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
# Java 11 to generate class file targeting Java 8
java-version: 11
distribution: zulu
- name: Compile Spanner
run: mvn clean install
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
- name: Compile samples
run: mvn compile
working-directory: samples

compile:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11]
java: [11, 17]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/setup-java@v3
with:
java-version: ${{matrix.java}}
distribution: zulu
- name: Compile Spanner
run: mvn clean install
- name: Compile samples
run: mvn compile
working-directory: samples
working-directory: samples
8 changes: 2 additions & 6 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ cd ${scriptDir}/..
# include common functions
source ${scriptDir}/common.sh

function setJava() {
export JAVA_HOME=$1
export PATH=${JAVA_HOME}/bin:$PATH
}

# units-java8 uses both JDK 11 and JDK 8. GraalVM dependencies require JDK 11 to
# compile the classes touching GraalVM classes.
if [ ! -z "${JAVA11_HOME}" ]; then
Expand Down Expand Up @@ -57,7 +52,6 @@ fi
# are compatible with Java 8 when running tests.
if [ ! -z "${JAVA8_HOME}" ]; then
setJava "${JAVA8_HOME}"
mvn -version
fi

RETURN_CODE=0
Expand Down Expand Up @@ -87,6 +81,7 @@ integration)
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dmaven.main.skip=true \
-fae \
verify
RETURN_CODE=$?
Expand All @@ -100,6 +95,7 @@ slowtests)
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dmaven.main.skip=true \
-fae \
verify
RETURN_CODE=$?
Expand Down
7 changes: 6 additions & 1 deletion .kokoro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@ function retry_with_backoff {
## Helper functionss
function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; }
function msg() { println "$*" >&2; }
function println() { printf '%s\n' "$(now) $*"; }
function println() { printf '%s\n' "$(now) $*"; }

function setJava() {
export JAVA_HOME=$1
export PATH=${JAVA_HOME}/bin:$PATH
}
8 changes: 8 additions & 0 deletions .kokoro/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,21 @@ function determineMavenOpts() {

export MAVEN_OPTS=$(determineMavenOpts)

if [ ! -z "${JAVA11_HOME}" ]; then
setJava "${JAVA11_HOME}"
fi

# this should run maven enforcer
retry_with_backoff 3 10 \
mvn install -B -V -ntp \
-DskipTests=true \
-Dmaven.javadoc.skip=true \
-Dclirr.skip=true

if [ ! -z "${JAVA8_HOME}" ]; then
setJava "${JAVA8_HOME}"
fi

mvn -B dependency:analyze -DfailOnWarning=true

echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************"
Expand Down
2 changes: 2 additions & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
".github/blunderbuss.yml",
".github/workflows/samples.yaml",
".github/workflows/ci.yaml",
".kokoro/common.sh",
".kokoro/build.sh",
".kokoro/dependencies.sh",
]
)