Skip to content

Commit

Permalink
Merge pull request #49 from jmatsu/test_multiple_gradle_and_jdk_versions
Browse files Browse the repository at this point in the history
Add testcases for combination of Gradle and JDK versions
  • Loading branch information
jmatsu authored Aug 30, 2021
2 parents 297131c + a949dd6 commit d2cffc0
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 87 deletions.
77 changes: 68 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
executors:
android:
docker:
- image: circleci/android@sha256:e8a82728a4d2a1b7085f3ada107b492b76aeeefaa7bf739b5addace0a73ba79d
- image: cimg/android:2021.08.1
working_directory: ~/top/example
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError" -Dorg.gradle.daemon=false'
Expand Down Expand Up @@ -41,6 +41,41 @@ commands:
- ~/.gradle
- .gradle
key: gradle-<< parameters.cache_version >>-{{ checksum "~/<< parameters.cache_name >>.lock" }}
switch_java:
parameters:
jdk-version:
type: string
steps:
- run:
name: Check the current configurations
command: |
java -version
update-java-alternatives --list || true
- run:
name: Get the ditribution name to use
command: |
readonly distribution="$(update-java-alternatives -l | grep "java-1.<< parameters.jdk-version >>" | cut -d " " -f1)"
if [ -z "${distribution}" ]; then
echo "Couldn't get the jdk distribution name. Please check if the command above works." 1>&2
exit 1
fi
echo "${distribution}"
echo "export JDK_DISTRIBUTION_NAME=${distribution}" >> $BASH_ENV
- run: sudo update-java-alternatives -s "${JDK_DISTRIBUTION_NAME}" || true
- run: java -version
switch_gradle:
parameters:
gradle-version:
type: string
steps:
- run:
name: Dirty hack # https://github.com/CircleCI-Public/cimg-android/blob/1b1a9bf01dd11e3fa549ad42da0f23128ccbcb8b/2021.08/Dockerfile#L25
command: echo "export PATH=/usr/local/gradle-${GRADLE_VERSION}/bin:$PATH" >> $BASH_ENV
- run:
name: Use the specified Gradle version
command: gradle wrapper --gradle-version << parameters.gradle-version >> --distribution-type bin

jobs:
install_plugin_jars:
Expand All @@ -49,30 +84,46 @@ jobs:
- setup_workspace
- restore_gradle_cache:
cache_name: plugin
- run: ./gradlew publishToMavenLocal
- run: ./gradlew publishToMavenLocal --stacktrace
- persist_to_workspace:
root: ~/.m2
paths:
- repository

schema_test:
parameters: &build_env_parameters
jdk-version:
type: string
description: JDK version. 8 or 11
gradle-version:
type: string
description: Gradle version. e.g. 6.0.2
executor: android
steps:
- setup_workspace
- restore_gradle_cache:
cache_name: example
- attach_workspace:
at: ~/.m2
- run: ./gradlew assembleYellowBlueRelease # it's okay if succeed
- switch_java:
jdk-version: << parameters.jdk-version >>
- switch_gradle:
gradle-version: << parameters.gradle-version >>
- restore_gradle_cache:
cache_name: example-<< parameters.gradle-version >>
- run: ./gradlew assembleYellowBlueRelease --stacktrace # it's okay if succeed

acceptance_test:
parameters: *build_env_parameters
executor: android
steps:
- setup_workspace
- restore_gradle_cache:
cache_name: example
- attach_workspace:
at: ~/.m2
- switch_java:
jdk-version: << parameters.jdk-version >>
- switch_gradle:
gradle-version: << parameters.gradle-version >>
- restore_gradle_cache:
cache_name: example-<< parameters.gradle-version >>
- run:
name: Validate
command: ~/top/.circleci/validation_test
Expand All @@ -96,7 +147,7 @@ jobs:
destination: assets
# TODO snapshot tests provided by espresso
- save_gradle_cache:
cache_name: example
cache_name: example-<< parameters.gradle-version >>

workflows:
version: 2
Expand All @@ -106,6 +157,14 @@ workflows:
- acceptance_test:
requires:
- install_plugin_jars
matrix:
parameters:
jdk-version: ['8', '11']
gradle-version: ['6.7.1', '7.0.2']
- schema_test:
requires:
- install_plugin_jars
- install_plugin_jars
matrix:
parameters:
jdk-version: ['8', '11']
gradle-version: ['6.7.1', '7.0.2']
6 changes: 3 additions & 3 deletions .github/workflows/on_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '8.0.x'
java-version: '8'
java-package: jdk
- uses: actions/cache@v1
with:
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '8.0.x'
java-version: '8'
java-package: jdk
- uses: actions/cache@v1
with:
Expand All @@ -76,7 +76,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '8.0.x'
java-version: '8'
java-package: jdk
- uses: actions/cache@v1
with:
Expand Down
71 changes: 53 additions & 18 deletions example/app/license-list/artifact-definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,22 @@ yellowBlueRelease:
licenses:
- apache-2.0
- key: databinding-common
displayName: Data Binding Base Library
url: https://developer.android.com/studio
displayName: androidx.databinding.databinding-common
url: http://tools.android.com/
copyrightHolders:
- The Android Open Source Project
licenses:
- apache-2.0
- key: databinding-compiler
displayName: Data Binding Annotation Processor
url: https://developer.android.com/studio
displayName: androidx.databinding.databinding-compiler
url: http://tools.android.com/
copyrightHolders:
- The Android Open Source Project
licenses:
- apache-2.0
- key: databinding-compiler-common
displayName: Data Binding Compiler Common
url: https://developer.android.com/studio
displayName: androidx.databinding.databinding-compiler-common
url: http://tools.android.com/
copyrightHolders:
- The Android Open Source Project
licenses:
Expand Down Expand Up @@ -265,16 +265,16 @@ yellowBlueRelease:
- apache-2.0
com.android.databinding:
- key: baseLibrary
displayName: Data Binding Base Library
url: https://developer.android.com/studio
displayName: com.android.databinding.baseLibrary
url: http://tools.android.com/
copyrightHolders:
- The Android Open Source Project
licenses:
- apache-2.0
com.android.tools:
- key: annotations
displayName: Android Tools Annotations library
url: https://developer.android.com/studio
displayName: com.android.tools.annotations
url: http://tools.android.com/
copyrightHolders:
- The Android Open Source Project
licenses:
Expand Down Expand Up @@ -382,6 +382,18 @@ yellowBlueRelease:
url: null
copyrightHolders: []
licenses: []
com.sun.istack:
- key: istack-commons-runtime
displayName: istack common utility code runtime
url: null
copyrightHolders: []
licenses: []
com.sun.xml.fastinfoset:
- key: FastInfoset
displayName: fastinfoset
url: null
copyrightHolders: []
licenses: []
com.xwray:
- key: groupie
displayName: Groupie
Expand Down Expand Up @@ -440,6 +452,18 @@ yellowBlueRelease:
- Jumpei Matsuda
licenses:
- mit
jakarta.activation:
- key: jakarta.activation-api
displayName: JavaBeans Activation Framework API jar
url: null
copyrightHolders: []
licenses: []
jakarta.xml.bind:
- key: jakarta.xml.bind-api
displayName: jakarta.xml.bind-api
url: null
copyrightHolders: []
licenses: []
javax.activation:
- key: activation
displayName: JavaBeans Activation Framework (JAF)
Expand Down Expand Up @@ -481,6 +505,17 @@ yellowBlueRelease:
url: null
copyrightHolders: []
licenses: []
org.glassfish.jaxb:
- key: jaxb-runtime
displayName: JAXB Runtime
url: null
copyrightHolders: []
licenses: []
- key: txw2
displayName: TXW2 Runtime
url: null
copyrightHolders: []
licenses: []
org.jetbrains:
- key: annotations
displayName: IntelliJ IDEA Annotations
Expand All @@ -498,28 +533,28 @@ yellowBlueRelease:
licenses:
- apache-2.0
- key: kotlin-stdlib
displayName: org.jetbrains.kotlin:kotlin-stdlib
displayName: Kotlin Stdlib
url: https://kotlinlang.org/
copyrightHolders:
- Kotlin Team
licenses:
- apache-2.0
- key: kotlin-stdlib-common
displayName: org.jetbrains.kotlin:kotlin-stdlib-common
displayName: Kotlin Stdlib Common
url: https://kotlinlang.org/
copyrightHolders:
- Kotlin Team
licenses:
- apache-2.0
- key: kotlin-stdlib-jdk7
displayName: org.jetbrains.kotlin:kotlin-stdlib-jdk7
displayName: Kotlin Stdlib Jdk7
url: https://kotlinlang.org/
copyrightHolders:
- Kotlin Team
licenses:
- apache-2.0
- key: kotlin-stdlib-jdk8
displayName: org.jetbrains.kotlin:kotlin-stdlib-jdk8
displayName: Kotlin Stdlib Jdk8
url: https://kotlinlang.org/
copyrightHolders:
- Kotlin Team
Expand All @@ -528,12 +563,12 @@ yellowBlueRelease:
org.jvnet.staxex:
- key: stax-ex
displayName: Extended StAX API
url: http://stax-ex.java.net/
url: https://github.com/eclipse-ee4j/jaxb-stax-ex
copyrightHolders:
- Jitendra Kotamraju
- Martin Grebac
- Roman Grigoriadi
- Zheng Jun Li
licenses:
- Dual license consisting of the CDDL v1.1 and GPL v2@55
- Eclipse Distribution License - v 1.0@48
test:
junit:
- key: junit
Expand Down
6 changes: 3 additions & 3 deletions example/app/license-list/license-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
- key: Common Development and Distribution License (CDDL) v1.0@51
name: Common Development and Distribution License (CDDL) v1.0
url: https://glassfish.dev.java.net/public/CDDLv1.0.html
- key: Dual license consisting of the CDDL v1.1 and GPL v2@55
name: Dual license consisting of the CDDL v1.1 and GPL v2
url: https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
- key: Eclipse Distribution License - v 1.0@48
name: Eclipse Distribution License - v 1.0
url: http://www.eclipse.org/org/documents/edl-v10.php
- key: Mozilla Public License 1.1 (MPL 1.1)@39
name: Mozilla Public License 1.1 (MPL 1.1)
url: http://www.mozilla.org/MPL/MPL-1.1.html
Expand Down
4 changes: 2 additions & 2 deletions example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ buildscript {
}
}
dependencies {
classpath("com.android.tools.build:gradle:3.6.1")
classpath(kotlin("gradle-plugin", version = "1.3.50")) // same to the version that kotlin-dsl uses
classpath("com.android.tools.build:gradle:4.2.2")
classpath(kotlin("gradle-plugin", version = "1.4.32")) // same to the version that kotlin-dsl uses
classpath("io.github.jmatsu:license-list-gradle:${rootProject.file("../VERSION").readText().trim()}")
classpath("com.cookpad.android.licensetools:license-tools-plugin:1.7.0")
}
Expand Down
Loading

0 comments on commit d2cffc0

Please sign in to comment.