Skip to content

Commit ae9b7e9

Browse files
authored
build: move gradle plugin integration tests to composite build (ExpediaGroup#1654)
Moves Gradle plugin integration tests to a composite builds. Benefits: * faster build - integration tests are executed as composite build which can be built in parallel and utilize Gradle build cache to speed up process * easier env variable sharing - we no longer need to pass system properties to specify which version of library to use, `graphql-kotlin` libraries can be referenced without version as they are part of the build and we can rely on same version catalog as main build * easier to debug build problems - each integration test is now a valid Gradle project that can be easily loaded in IntelliJ (or build from cmd line)
1 parent 549ba89 commit ae9b7e9

File tree

111 files changed

+1082
-644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1082
-644
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
build-libraries:
1313
uses: ./.github/workflows/build-libraries.yml
1414

15+
plugin-integration:
16+
needs: build-libraries
17+
uses: ./.github/workflows/plugin-it.yml
18+
1519
build-examples:
1620
needs: build-libraries
1721
uses: ./.github/workflows/build-examples.yml

.github/workflows/plugin-it.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Gradle Plugin Integration Tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
android-test:
8+
timeout-minutes: 30
9+
runs-on: ubuntu-latest
10+
defaults:
11+
run:
12+
working-directory: integration/gradle-plugin-android-test
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Validate Gradle wrapper
17+
uses: gradle/wrapper-validation-action@v1
18+
- name: Set up Java 11
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: 11
22+
distribution: 'zulu'
23+
- name: Set up Gradle cache
24+
uses: gradle/gradle-build-action@v2
25+
- name: Android Test
26+
run: ./gradlew build
27+
28+
integration-tests:
29+
timeout-minutes: 30
30+
runs-on: ubuntu-latest
31+
defaults:
32+
run:
33+
working-directory: integration/gradle-plugin-integration-tests
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Validate Gradle wrapper
38+
uses: gradle/wrapper-validation-action@v1
39+
- name: Set up Java 11
40+
uses: actions/setup-java@v3
41+
with:
42+
java-version: 11
43+
distribution: 'zulu'
44+
- name: Set up Gradle cache
45+
uses: gradle/gradle-build-action@v2
46+
- name: Integration Tests
47+
run: ./gradlew build

.github/workflows/pr-check.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ jobs:
1313
build-libraries:
1414
uses: ./.github/workflows/build-libraries.yml
1515

16+
plugin-integration:
17+
needs: build-libraries
18+
uses: ./.github/workflows/plugin-it.yml
19+
1620
build-examples:
1721
needs: build-libraries
1822
uses: ./.github/workflows/build-examples.yml

examples/settings.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ dependencyResolutionManagement {
55

66
// examples specific libs
77
library("ktor-client-jvm-logging", "io.ktor", "ktor-client-logging-jvm").versionRef("ktor")
8-
library("ktor-server-core", "io.ktor", "ktor-server-core").versionRef("ktor")
9-
library("ktor-server-netty", "io.ktor", "ktor-server-netty").versionRef("ktor")
10-
library("logback", "ch.qos.logback", "logback-classic").version("1.2.1")
118
library("spring-boot-validation", "org.springframework.boot", "spring-boot-starter-validation").versionRef("spring-boot")
129
}
1310
}

gradle/libs.versions.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ spring-boot = "2.7.7"
2828
compile-testing = "0.1.0"
2929
icu = "71.1"
3030
junit = "5.8.2"
31+
logback = "1.2.1"
3132
mockk = "1.12.5"
3233
mustache = "0.9.10"
3334
rxjava = "3.1.5"
@@ -81,6 +82,7 @@ spring-webflux = { group = "org.springframework", name = "spring-webflux", versi
8182
# test dependencies
8283
compile-testing = { group = "dev.zacsweers.kctfork", name = "core", version.ref = "compile-testing" }
8384
icu = { group = "com.ibm.icu", name = "icu4j", version.ref = "icu" }
85+
logback = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" }
8486
junit-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" }
8587
junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" }
8688
junit-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit" }
@@ -90,6 +92,10 @@ kotlinx-benchmark = { group = "org.jetbrains.kotlinx", name = "kotlinx-benchmark
9092
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
9193
ktor-client-logging = { group = "io.ktor", name = "ktor-client-logging", version.ref = "ktor" }
9294
ktor-client-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor" }
95+
ktor-server-core = { group = "io.ktor", name = "ktor-server-core", version.ref = "ktor" }
96+
ktor-server-cio = { group = "io.ktor", name = "ktor-server-cio", version.ref = "ktor" }
97+
ktor-server-netty = { group = "io.ktor", name = "ktor-server-netty", version.ref = "ktor" }
98+
ktor-server-test-host = { group = "io.ktor", name = "ktor-server-test-host", version.ref = "ktor" }
9399
mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
94100
mustache = { group = "com.github.spullara.mustache.java", name = "compiler", version.ref = "mustache" }
95101
reactor-core = { group = "io.projectreactor", name = "reactor-core", version.ref = "reactor-core" }
@@ -128,3 +134,7 @@ maven-plugin-development = { id = "de.benediktritter.maven-plugin-development",
128134
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish-plugin" }
129135
plugin-publish = { id = "com.gradle.plugin-publish", version.ref = "plugin-publish" }
130136
spring-boot = { id = "org.springframework.boot", version.ref = "spring-boot" }
137+
138+
# test projects
139+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
140+
android-application = { id = "com.android.application", version.ref = "android-plugin" }

integration/federation-compatibility/build.gradle.kts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
import com.expediagroup.graphql.plugin.gradle.graphql
22
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33

4-
buildscript {
5-
repositories {
6-
mavenCentral()
7-
mavenLocal {
8-
content {
9-
includeGroup("com.expediagroup")
10-
}
11-
}
12-
}
13-
}
14-
154
@Suppress("DSL_SCOPE_VIOLATION") // TODO: remove once KTIJ-19369 / Gradle#22797 is fixed
165
plugins {
176
id("com.expediagroup.graphql")
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
android {
9-
compileSdkVersion(30)
9+
compileSdk = 30
1010
compileOptions {
1111
sourceCompatibility = JavaVersion.VERSION_1_8
1212
targetCompatibility = JavaVersion.VERSION_1_8
@@ -16,11 +16,11 @@ android {
1616
}
1717
}
1818

19-
val graphQLKotlinVersion = System.getenv("GRAPHQL_KOTLIN_VERSION") ?: "7.0.0-SNAPSHOT"
20-
val kotlinVersion = System.getenv("KOTLIN_VERSION") ?: "1.7.21"
2119
dependencies {
22-
implementation("com.expediagroup:graphql-kotlin-ktor-client:$graphQLKotlinVersion")
23-
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
20+
implementation("com.expediagroup:graphql-kotlin-ktor-client")
21+
implementation(libs.kotlin.stdlib)
22+
testImplementation(libs.junit.api)
23+
testImplementation(libs.junit.engine)
2424
}
2525

2626
graphql {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.expediagroup.graphql
2+
3+
import com.expediagroup.android.generated.ExampleQuery
4+
import com.expediagroup.android.generated.inputs.SimpleArgumentInput
5+
import org.junit.jupiter.api.Test
6+
import org.junit.jupiter.api.assertDoesNotThrow
7+
8+
class AndroidTests {
9+
10+
@Test
11+
fun `verifies graphql client was generated`() {
12+
assertDoesNotThrow {
13+
ExampleQuery(variables = ExampleQuery.Variables(simpleCriteria = SimpleArgumentInput()))
14+
}
15+
}
16+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
google()
5+
mavenLocal {
6+
content {
7+
includeGroup("com.expediagroup")
8+
}
9+
}
10+
}
11+
12+
dependencies {
13+
classpath(libs.kotlin.serialization)
14+
classpath(libs.kotlin.gradle.plugin)
15+
classpath(libs.android.plugin)
16+
}
17+
}
18+
19+
allprojects {
20+
repositories {
21+
mavenCentral()
22+
google()
23+
mavenLocal {
24+
content {
25+
includeGroup("com.expediagroup")
26+
}
27+
}
28+
}
29+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)