Skip to content

Commit f7612fa

Browse files
authored
chore: run e2e tests before publishing SDK (#15)
1 parent 93f76fd commit f7612fa

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/release-sdk.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,19 @@ on:
1111
default: ''
1212

1313
jobs:
14+
run-examples:
15+
strategy:
16+
matrix:
17+
jdk: [ 8, 11, 17, 21 ]
18+
uses: ./.github/workflows/run-examples.yaml
19+
secrets: inherit
20+
with:
21+
branch: ${{ inputs.branch }}
22+
jdk: ${{ matrix.jdk }}
23+
1424
release-sdk:
1525
uses: ExpediaGroup/expediagroup-java-sdk/.github/workflows/selfserve-release-sdk.yaml@v20241013
26+
needs: [ run-examples ]
1627
secrets: inherit
1728
with:
1829
branch: ${{ inputs.branch }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Run Examples
2+
on:
3+
workflow_call:
4+
inputs:
5+
jdk:
6+
description: 'JDK version to use'
7+
required: true
8+
type: string
9+
distribution:
10+
description: 'JDK distribution to use'
11+
required: false
12+
type: string
13+
default: 'corretto'
14+
branch:
15+
description: 'Branch to build SDK and run examples from'
16+
required: true
17+
type: string
18+
19+
jobs:
20+
run-examples:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repo
24+
uses: actions/checkout@v4
25+
with:
26+
repository: 'ExpediaGroup/xap-java-sdk'
27+
ref: ${{ inputs.branch }}
28+
path: sdk-repo
29+
30+
- name: Parse SDK version
31+
id: parse-sdk-version
32+
working-directory: sdk-repo/code
33+
shell: python -u {0}
34+
run: |
35+
import os
36+
import xml.etree.ElementTree as ET
37+
38+
tree = ET.parse("pom.xml")
39+
root = tree.getroot()
40+
version = root.find("{*}version").text
41+
42+
with open(os.getenv("GITHUB_OUTPUT"), "a") as GITHUB_OUTPUT:
43+
print(f"version={version}", file=GITHUB_OUTPUT)
44+
45+
- name: Set up JDK
46+
uses: actions/setup-java@v4
47+
with:
48+
java-version: ${{ inputs.jdk }}
49+
distribution: ${{ inputs.distribution }}
50+
51+
- name: Install SDK
52+
working-directory: sdk-repo/code
53+
run: |
54+
mvn clean install
55+
56+
- name: Run Examples
57+
working-directory: sdk-repo/examples
58+
run: |
59+
mvn install exec:java \
60+
-Dcom.expediagroup.xapjavasdk.apikey="${{ secrets.API_KEY }}" \
61+
-Dcom.expediagroup.xapjavasdk.apisecret="${{ secrets.API_SECRET }}" \
62+
-Dcom.expediagroup.xapjavasdk.vrbokey="${{ secrets.VRBO_KEY }}" \
63+
-Dcom.expediagroup.xapjavasdk.vrbosecret="${{ secrets.VRBO_SECRET }}" \
64+
-Dxap-java-sdk.sdk.version="${{ steps.parse-sdk-version.outputs.version }}"

0 commit comments

Comments
 (0)