Skip to content

Commit 42cf170

Browse files
authored
introduce graphql-over-http spec compliance tests (#1715)
### 📝 Description Verifies [`graphql-over-http` spec](https://github.com/graphql/graphql-over-http) compliance for GraphQL Kotlin Ktor and Spring servers. ### 🔗 Related Issues Related: #1602 Related: #1573
1 parent 3db286d commit 42cf170

File tree

33 files changed

+7258
-23
lines changed

33 files changed

+7258
-23
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
needs: build-libraries
2525
uses: ./.github/workflows/federation-integration.yml
2626

27+
http-spec-compliance:
28+
needs: build-libraries
29+
uses: ./.github/workflows/http-spec-compliance.yml
30+
2731
release-notes:
2832
timeout-minutes: 10
2933
runs-on: ubuntu-latest
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: GraphQL over HTTP spec server compliance
2+
3+
on:
4+
workflow_call:
5+
pull_request:
6+
branches:
7+
- master
8+
paths:
9+
- 'servers/**'
10+
- 'integration/graphql-http-spec/**'
11+
12+
jobs:
13+
http-spec-compliance:
14+
timeout-minutes: 20
15+
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
working-directory: integration/graphql-http-spec
19+
strategy:
20+
matrix:
21+
server: ['spring-server', 'ktor-server']
22+
23+
steps:
24+
- name: Checkout Repository
25+
uses: actions/checkout@v3
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 16
31+
32+
- name: Setup NPM cache
33+
uses: actions/cache@v3
34+
with:
35+
path: ~/.npm
36+
key: ${{ runner.os }}-node-${{ hashFiles('website/package-lock.json') }}
37+
restore-keys: ${{ runner.os }}-node-
38+
39+
- name: Install node dependencies
40+
run: npm install
41+
42+
- name: Validate Gradle wrapper
43+
uses: gradle/wrapper-validation-action@v1
44+
45+
- name: Set up Java 17
46+
uses: actions/setup-java@v3
47+
with:
48+
java-version: 17
49+
distribution: 'zulu'
50+
51+
- name: Set up Gradle cache
52+
uses: gradle/gradle-build-action@v2
53+
54+
- name: Start server
55+
id: start_server
56+
run: |
57+
set -x
58+
echo "building server"
59+
./gradlew :${server}:build
60+
61+
echo "starting server"
62+
./gradlew :${server}:run &
63+
echo "SERVER_PID=$(echo $!)" >> $GITHUB_OUTPUT
64+
env:
65+
server: ${{ matrix.server }}
66+
67+
- name: Verify HTTP spec compliance
68+
run: |
69+
echo "verify server is up"
70+
npm run healthcheck
71+
72+
echo "verify compliance"
73+
npm run test
74+
75+
- name: Stop server
76+
if: ${{ always() }}
77+
run: |
78+
echo "shutting down server"
79+
kill -9 ${{ steps.start_server.outputs.SERVER_PID }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
build/
2+
node_modules/
3+
4+
# Ignore Gradle project-specific cache directory
5+
.gradle
6+
7+
# Ignore Gradle build output directory
8+
build

integration/graphql-http-spec/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry = "https://registry.npmjs.org"

integration/graphql-http-spec/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
17
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.util.Properties
2+
3+
allprojects {
4+
repositories {
5+
mavenCentral()
6+
mavenLocal {
7+
content {
8+
includeGroup("com.expediagroup")
9+
}
10+
}
11+
}
12+
13+
val properties = Properties()
14+
properties.load(File(rootDir.parentFile.parent, "gradle.properties").inputStream())
15+
for ((key, value) in properties) {
16+
if (!project.ext.has(key.toString())) {
17+
project.ext[key.toString()] = value
18+
}
19+
}
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
gradlePluginPortal()
8+
}
9+
10+
dependencies {
11+
implementation(libs.kotlin.gradle.api)
12+
implementation(libs.kotlin.gradle.plugin)
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dependencyResolutionManagement {
2+
versionCatalogs {
3+
create("libs") {
4+
from(files("../../../gradle/libs.versions.toml"))
5+
}
6+
}
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
plugins {
4+
kotlin("jvm")
5+
}
6+
7+
tasks {
8+
kotlin {
9+
jvmToolchain(17)
10+
}
11+
val kotlinJvmVersion: String by project
12+
withType<KotlinCompile> {
13+
kotlinOptions {
14+
// intellij gets confused without it
15+
jvmTarget = kotlinJvmVersion
16+
freeCompilerArgs = listOf("-Xjsr305=strict")
17+
}
18+
}
19+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
group = com.expediagroup.http.spec
2+
3+
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
4+
org.gradle.caching=true
5+
org.gradle.parallel=true
6+
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
4+
networkTimeout=10000
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)