Skip to content

build: move gradle plugin integration tests to composite build #1654

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

Merged
merged 1 commit into from
Jan 23, 2023
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
4 changes: 4 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
build-libraries:
uses: ./.github/workflows/build-libraries.yml

plugin-integration:
needs: build-libraries
uses: ./.github/workflows/plugin-it.yml

build-examples:
needs: build-libraries
uses: ./.github/workflows/build-examples.yml
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/plugin-it.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Gradle Plugin Integration Tests

on:
workflow_call:

jobs:
android-test:
timeout-minutes: 30
runs-on: ubuntu-latest
defaults:
run:
working-directory: integration/gradle-plugin-android-test

steps:
- uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up Java 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2
- name: Android Test
run: ./gradlew build

integration-tests:
timeout-minutes: 30
runs-on: ubuntu-latest
defaults:
run:
working-directory: integration/gradle-plugin-integration-tests

steps:
- uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up Java 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2
- name: Integration Tests
run: ./gradlew build
4 changes: 4 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
build-libraries:
uses: ./.github/workflows/build-libraries.yml

plugin-integration:
needs: build-libraries
uses: ./.github/workflows/plugin-it.yml

build-examples:
needs: build-libraries
uses: ./.github/workflows/build-examples.yml
Expand Down
3 changes: 0 additions & 3 deletions examples/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ dependencyResolutionManagement {

// examples specific libs
library("ktor-client-jvm-logging", "io.ktor", "ktor-client-logging-jvm").versionRef("ktor")
library("ktor-server-core", "io.ktor", "ktor-server-core").versionRef("ktor")
library("ktor-server-netty", "io.ktor", "ktor-server-netty").versionRef("ktor")
library("logback", "ch.qos.logback", "logback-classic").version("1.2.1")
library("spring-boot-validation", "org.springframework.boot", "spring-boot-starter-validation").versionRef("spring-boot")
}
}
Expand Down
10 changes: 10 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spring-boot = "2.7.7"
compile-testing = "0.1.0"
icu = "71.1"
junit = "5.8.2"
logback = "1.2.1"
mockk = "1.12.5"
mustache = "0.9.10"
rxjava = "3.1.5"
Expand Down Expand Up @@ -81,6 +82,7 @@ spring-webflux = { group = "org.springframework", name = "spring-webflux", versi
# test dependencies
compile-testing = { group = "dev.zacsweers.kctfork", name = "core", version.ref = "compile-testing" }
icu = { group = "com.ibm.icu", name = "icu4j", version.ref = "icu" }
logback = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" }
junit-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" }
junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" }
junit-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit" }
Expand All @@ -90,6 +92,10 @@ kotlinx-benchmark = { group = "org.jetbrains.kotlinx", name = "kotlinx-benchmark
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
ktor-client-logging = { group = "io.ktor", name = "ktor-client-logging", version.ref = "ktor" }
ktor-client-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor" }
ktor-server-core = { group = "io.ktor", name = "ktor-server-core", version.ref = "ktor" }
ktor-server-cio = { group = "io.ktor", name = "ktor-server-cio", version.ref = "ktor" }
ktor-server-netty = { group = "io.ktor", name = "ktor-server-netty", version.ref = "ktor" }
ktor-server-test-host = { group = "io.ktor", name = "ktor-server-test-host", version.ref = "ktor" }
mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
mustache = { group = "com.github.spullara.mustache.java", name = "compiler", version.ref = "mustache" }
reactor-core = { group = "io.projectreactor", name = "reactor-core", version.ref = "reactor-core" }
Expand Down Expand Up @@ -128,3 +134,7 @@ maven-plugin-development = { id = "de.benediktritter.maven-plugin-development",
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish-plugin" }
plugin-publish = { id = "com.gradle.plugin-publish", version.ref = "plugin-publish" }
spring-boot = { id = "org.springframework.boot", version.ref = "spring-boot" }

# test projects
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
android-application = { id = "com.android.application", version.ref = "android-plugin" }
11 changes: 0 additions & 11 deletions integration/federation-compatibility/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import com.expediagroup.graphql.plugin.gradle.graphql
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
repositories {
mavenCentral()
mavenLocal {
content {
includeGroup("com.expediagroup")
}
}
}
}

@Suppress("DSL_SCOPE_VIOLATION") // TODO: remove once KTIJ-19369 / Gradle#22797 is fixed
plugins {
id("com.expediagroup.graphql")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

android {
compileSdkVersion(30)
compileSdk = 30
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -16,11 +16,11 @@ android {
}
}

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

graphql {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.expediagroup.graphql

import com.expediagroup.android.generated.ExampleQuery
import com.expediagroup.android.generated.inputs.SimpleArgumentInput
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertDoesNotThrow

class AndroidTests {

@Test
fun `verifies graphql client was generated`() {
assertDoesNotThrow {
ExampleQuery(variables = ExampleQuery.Variables(simpleCriteria = SimpleArgumentInput()))
}
}
}
29 changes: 29 additions & 0 deletions integration/gradle-plugin-android-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
buildscript {
repositories {
mavenCentral()
google()
mavenLocal {
content {
includeGroup("com.expediagroup")
}
}
}

dependencies {
classpath(libs.kotlin.serialization)
classpath(libs.kotlin.gradle.plugin)
classpath(libs.android.plugin)
}
}

allprojects {
repositories {
mavenCentral()
google()
mavenLocal {
content {
includeGroup("com.expediagroup")
}
}
}
}
1 change: 1 addition & 0 deletions integration/gradle-plugin-android-test/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading