Skip to content

Commit

Permalink
Merge branch 'OmarAlJarrah/add-contract-tests-generator' into OmarAlJ…
Browse files Browse the repository at this point in the history
…arrah/add-contract-tests-executors
  • Loading branch information
OmarAlJarrah authored Aug 13, 2024
2 parents 0170ee3 + abe25ad commit e36b7c5
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 75 deletions.
1 change: 0 additions & 1 deletion .github/workflows/generator-download-specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ jobs:
with:
name: raw-specs
path: raw-specs.yaml
overwrite: true
8 changes: 5 additions & 3 deletions .github/workflows/generator-test-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ jobs:
url: ${{ inputs.specs_url }}
transform-specs:
needs: [ download-specs ]
uses: ./.github/workflows/generator-transform-specs.yaml
uses: ./.github/workflows/selfserve-transform-specs.yaml
with:
configurations: -th -te ${{ inputs.endpoint_prefix }} --operationIdsToTags
specs_key: 'raw-specs'
transformations: -th -te ${{ inputs.endpoint_prefix }} --operationIdsToTags
generate-sdk:
needs: [ transform-specs ]
uses: ./.github/workflows/generator-generate.yaml
uses: ./.github/workflows/selfserve-generate.yaml
with:
name: ${{ inputs.namespace }}
version: ${{ inputs.version }}
templates: 'sdk-repo/generator/openapi/src/main/resources/templates/expediagroup-sdk'
sdk-metadata:
runs-on: ubuntu-latest
needs: [ generate-sdk ]
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/pr-check-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ on: push

jobs:
run-rapid-tests:
strategy:
matrix:
jdk: [8, 11, 17, 21]
fail-fast: true
max-parallel: 1
uses: ./.github/workflows/run-tests.yaml
with:
source: 'specs'
specs_url: 'https://ewe-assets.s3.amazonaws.com/developer-tools/api/rapid/v3/specs.yaml'
sdk_version: 1.0.${{ github.run_id }}
sdk_namespace: 'rapid'
jdk: ${{ matrix.jdk }}
endpoint_prefix: '/v3'
secrets: inherit
12 changes: 5 additions & 7 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ on:
required: true
type: string
default: 'rapid'
jdk:
description: 'JDK version to use'
required: true
type: string
default: '21'
endpoint_prefix:
description: 'Endpoint to prepend specs paths with'
required: true
Expand All @@ -84,6 +79,7 @@ jobs:
if 'sdk' in '${{ inputs.source }}' and not('${{ inputs.sdk_version }}'):
print('::error::Invalid SDK version: ${{ inputs.sdk_version }}')
exit(1)
generate-test-sdk:
if: inputs.source == 'specs'
needs: [ inputs-validation ]
Expand All @@ -95,13 +91,15 @@ jobs:
specs_url: ${{ inputs.specs_url }}
secrets: inherit
run-rapid-examples:
strategy:
matrix:
jdk: [8, 11, 17, 21]
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && inputs.sdk_namespace == 'rapid'
needs: [ generate-test-sdk ]
uses: "ExpediaGroup/rapid-java-sdk/.github/workflows/run-examples.yaml@main"
with:
sdk_version: ${{ needs.generate-test-sdk.outputs.version }}
jdk: ${{ inputs.jdk }}
sdk_generation_workflow_run_id: ${{ github.run_id }}
jdk: ${{ matrix.jdk }}
secrets:
KEY: ${{ secrets.RAPID_KEY }}
SECRET: ${{ secrets.RAPID_SECRET }}
13 changes: 12 additions & 1 deletion .github/workflows/selfserve-generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ on:
type: string
specs_key:
description: 'Key to the transformed and ready to use specs artifact and name (without extension, e.g. specs, the file is expected to have the extension .yaml)'
default: 'specs'
default: 'transformedSpecs'
type: string
sdk_key:
description: 'Key to the generated SDK artifact'
default: 'sdk'
type: string
jar_key:
description: 'Key to the generated JAR artifact'
default: 'jar'
type: string

jobs:
generate:
Expand Down Expand Up @@ -61,4 +65,11 @@ jobs:
path: |
sdk-repo/generator/openapi/target/sdk
!sdk-repo/generator/openapi/target/sdk/target
- name: Persist JAR Artifact # TODO: Remove when product config is proposed
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.jar_key }}
path: |
sdk-repo/generator/openapi/target/sdk/target/*.jar
sdk-repo/generator/openapi/target/sdk/target/maven-archiver/pom.properties
overwrite: true
57 changes: 57 additions & 0 deletions .github/workflows/selfserve-publish-sources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Generate and Publish Sources

on:
workflow_call:
inputs:
version:
description: 'SDK Version - A semantic SDK version, e.g., 1.0.0 or 1.0.0-SNAPSHOT'
required: true
type: string
path:
description: 'Path to publish the source code to. This should be a path of a directory where the source code will be published to'
required: true
type: string
sdk_key:
description: 'Key to the generated SDK artifact'
default: 'sdk'
type: string
specs_key:
description: 'Key to the transformed and ready to publish specs artifact and name (without extension, e.g. specs, the file is expected to have the extension .yaml)'
default: 'transformedSpecs'
type: string

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.sdk_key }}
path: sdk-repo/generator/${{ inputs.sdk_key }}

- uses: actions/download-artifact@v4
with:
name: ${{ inputs.specs_key }}
path: .

- name: Add generated source code to the path
run: |
rm -rf ${{ inputs.path }}
mkdir -p ${{ inputs.path }}
cp -r ./sdk-repo/generator/sdk/src ${{ inputs.path }}/src
cp ./sdk-repo/generator/sdk/pom.xml ${{ inputs.path }}/src
cp ./sdk-repo/generator/sdk/README.md ${{ inputs.path }}/src
cp ./${{ inputs.specs_key }}.yaml ${{ inputs.path }}/${{ inputs.specs_key }}.yaml
- name: Create PR
uses: peter-evans/create-pull-request@v6
with:
branch: "publish-v${{ inputs.version }}"
commit-message: "chore: Publish v${{ inputs.version }}"
title: "chore: Publish v${{ inputs.version }}"
body: |
This PR publishes the source code for v${{ inputs.version }}, generated by the SDK generator.
add-paths: |
${{ inputs.path }}/*
4 changes: 2 additions & 2 deletions .github/workflows/selfserve-transform-specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ on:
type: string
required: true
transformed_specs_key:
description: 'Key to the transformed specs artifact and name (without extension, e.g. tspecs, the file is expected to have the extension .yaml)'
description: 'Key to the transformed specs artifact and name (without extension, e.g. transformedSpecs, the file is expected to have the extension .yaml)'
type: string
default: 'tspecs'
default: 'transformedSpecs'

jobs:
transform-specs:
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<kotlin.version>2.0.0</kotlin.version>
<kotlin.version>2.0.10</kotlin.version>
<ktor.version>2.3.12</ktor.version>

<ktlint-plugin.version>3.2.0</ktlint-plugin.version>
Expand Down
2 changes: 1 addition & 1 deletion generator/openapi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<repoName>test-sdk</repoName>

<!-- Versions -->
<kotlin.version>2.0.0</kotlin.version>
<kotlin.version>2.0.10</kotlin.version>
<openapi-generator.version>6.6.0</openapi-generator.version>

<!-- Plugin Versions -->
Expand Down
83 changes: 35 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "13.0.0",
"@semantic-release/exec": "6.0.3",
"@semantic-release/github": "10.1.3",
"@semantic-release/github": "10.1.4",
"@semantic-release/release-notes-generator": "14.0.1",
"conventional-changelog-conventionalcommits": "8.0.0",
"semantic-release": "24.0.0",
"commitlint": "19.3.0",
"commitlint": "19.4.0",
"@commitlint/config-conventional": "19.2.2"
}
}
Loading

0 comments on commit e36b7c5

Please sign in to comment.