Skip to content

Commit 942027f

Browse files
authored
Merge branch 'main' into mdwairi/add-sdk-exemplar
2 parents 38eff74 + ee80292 commit 942027f

38 files changed

Lines changed: 154 additions & 218 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build and Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v4
14+
15+
- name: Setup JDK 11
16+
uses: actions/setup-java@v3
17+
with:
18+
distribution: 'temurin'
19+
java-version: '11'
20+
21+
- name: Build and Test
22+
run: ./gradlew clean build
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Manual Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
module:
7+
description: 'Select the module to release'
8+
required: true
9+
type: choice
10+
options:
11+
- expediagroup-sdk-core
12+
- expediagroup-sdk-graphql
13+
- expediagroup-sdk-rest
14+
- expediagroup-sdk-transport-okhttp
15+
- expediagroup-sdk-openapi-plugin
16+
17+
permissions:
18+
contents: write
19+
20+
jobs:
21+
get-version-and-publish:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout Repository
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Setup JDK 11
30+
uses: actions/setup-java@v3
31+
with:
32+
distribution: 'temurin'
33+
java-version: '11'
34+
35+
- name: Build and Test
36+
run: ./gradlew clean build
37+
38+
- name: Publish ${{ inputs.module }}
39+
env:
40+
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
41+
GPG_SECRET: ${{ secrets.GPG_PRIVATE_KEY }}
42+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
43+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
44+
run: |
45+
echo "Publishing ${{ inputs.module }}
46+
./gradlew :${{ inputs.module }}:publishToSonatype closeAndReleaseSonatypeStagingRepository
47+
48+
- name: Publish Summary
49+
run: |
50+
echo "✅ Successfully published ${{ inputs.module }} to Maven Central" >> $GITHUB_STEP_SUMMARY

.github/workflows/publish.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/release-please.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.release-please-manifest.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

expediagroup-sdk-core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dependencies {
2929
testImplementation 'org.junit.jupiter:junit-jupiter-api'
3030
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
3131
testImplementation 'org.junit.jupiter:junit-jupiter-params'
32+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
3233

3334
testImplementation 'io.mockk:mockk:1.14.5'
3435
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
ARTIFACT_NAME=expediagroup-sdk-core
22
DESCRIPTION=Core library supporting various EG SDKs
33

4-
# x-release-please-start-version
5-
VERSION=1.0.0
6-
# x-release-please-end
4+
VERSION=0.0.10-alpha

expediagroup-sdk-graphql/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies {
2727
testImplementation platform('org.junit:junit-bom:5.13.3')
2828
testImplementation 'org.junit.jupiter:junit-jupiter-api'
2929
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
30+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
3031
testImplementation 'org.junit.jupiter:junit-jupiter-params'
3132
testImplementation 'io.mockk:mockk:1.14.5'
3233
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
@@ -76,7 +77,7 @@ kover {
7677
bound {
7778
aggregationForGroup = AggregationType.COVERED_PERCENTAGE
7879
coverageUnits = CoverageUnit.BRANCH
79-
minValue = 92
80+
minValue = 83
8081
}
8182
}
8283
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
ARTIFACT_NAME=expediagroup-sdk-graphql
22
DESCRIPTION=Extension package for GraphQL APIs support
33

4-
# x-release-please-start-version
5-
VERSION=1.0.0
6-
# x-release-please-end
4+
VERSION=0.0.8-alpha

expediagroup-sdk-graphql/src/main/kotlin/com/expediagroup/sdk/graphql/ApolloOperationExtension.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ import com.apollographql.apollo.api.ApolloResponse
2020
import com.apollographql.apollo.api.Error
2121
import com.apollographql.apollo.api.Operation
2222
import com.apollographql.apollo.api.composeJsonRequest
23+
import com.apollographql.apollo.api.http.HttpHeader
2324
import com.apollographql.apollo.api.json.buildJsonString
2425
import com.apollographql.apollo.api.json.jsonReader
2526
import com.apollographql.apollo.api.parseResponse
27+
import com.apollographql.apollo.exception.ApolloHttpException
2628
import com.expediagroup.sdk.core.http.CommonMediaTypes
2729
import com.expediagroup.sdk.core.http.Method
2830
import com.expediagroup.sdk.core.http.Request
@@ -52,6 +54,18 @@ fun <D : Operation.Data> Operation<D>.toSDKRequest(url: String): Request {
5254
}
5355

5456
fun <D : Operation.Data> Response.toApolloResponse(operation: Operation<D>): ApolloResponse<D> {
57+
if (status.code != 200) {
58+
return ApolloResponse.Builder(operation, request.id)
59+
.exception(
60+
ApolloHttpException(
61+
statusCode = status.code,
62+
headers = headers.entries().map { HttpHeader(it.key, it.value.toString()) },
63+
message = "Received non 200 response from the GraphQL server",
64+
body = this.body?.source()?.buffer
65+
)
66+
).build()
67+
}
68+
5569
val apolloResponse =
5670
this.body?.let {
5771
val jsonReader = it.source().buffer.jsonReader()

0 commit comments

Comments
 (0)