Skip to content

introduce graphql-over-http spec compliance tests #1715

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 7 commits into from
Mar 13, 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 @@ -24,6 +24,10 @@ jobs:
needs: build-libraries
uses: ./.github/workflows/federation-integration.yml

http-spec-compliance:
needs: build-libraries
uses: ./.github/workflows/http-spec-compliance.yml

release-notes:
timeout-minutes: 10
runs-on: ubuntu-latest
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/http-spec-compliance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: GraphQL over HTTP spec server compliance

on:
workflow_call:
pull_request:
branches:
- master
paths:
- 'servers/**'
- 'integration/graphql-http-spec/**'

jobs:
http-spec-compliance:
timeout-minutes: 20
runs-on: ubuntu-latest
defaults:
run:
working-directory: integration/graphql-http-spec
strategy:
matrix:
server: ['spring-server', 'ktor-server']

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Setup NPM cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('website/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- name: Install node dependencies
run: npm install

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'

- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2

- name: Start server
id: start_server
run: |
set -x
echo "building server"
./gradlew :${server}:build

echo "starting server"
./gradlew :${server}:run &
echo "SERVER_PID=$(echo $!)" >> $GITHUB_OUTPUT
env:
server: ${{ matrix.server }}

- name: Verify HTTP spec compliance
run: |
echo "verify server is up"
npm run healthcheck

echo "verify compliance"
npm run test

- name: Stop server
if: ${{ always() }}
run: |
echo "shutting down server"
kill -9 ${{ steps.start_server.outputs.SERVER_PID }}
8 changes: 8 additions & 0 deletions integration/graphql-http-spec/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
build/
node_modules/

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
1 change: 1 addition & 0 deletions integration/graphql-http-spec/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry = "https://registry.npmjs.org"
1 change: 1 addition & 0 deletions integration/graphql-http-spec/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
17
20 changes: 20 additions & 0 deletions integration/graphql-http-spec/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import java.util.Properties

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

val properties = Properties()
properties.load(File(rootDir.parentFile.parent, "gradle.properties").inputStream())
for ((key, value) in properties) {
if (!project.ext.has(key.toString())) {
project.ext[key.toString()] = value
}
}
}
13 changes: 13 additions & 0 deletions integration/graphql-http-spec/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
implementation(libs.kotlin.gradle.api)
implementation(libs.kotlin.gradle.plugin)
}
7 changes: 7 additions & 0 deletions integration/graphql-http-spec/buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../../../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm")
}

tasks {
kotlin {
jvmToolchain(17)
}
val kotlinJvmVersion: String by project
withType<KotlinCompile> {
kotlinOptions {
// intellij gets confused without it
jvmTarget = kotlinJvmVersion
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
}
6 changes: 6 additions & 0 deletions integration/graphql-http-spec/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
group = com.expediagroup.http.spec

org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
org.gradle.caching=true
org.gradle.parallel=true

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading