Test Java clients with Petstore server in Github workflow (#22003)

* test java clients with petstore in github workflow

* update

* clean up
This commit is contained in:
William Cheng 2025-09-21 00:00:52 +08:00 committed by GitHub
parent 3a63c2f7d2
commit f1a273de16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 81 additions and 13 deletions

View File

@ -17,6 +17,10 @@ on:
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
- samples/client/others/java/jersey2-oneOf-duplicates/**
- samples/client/others/java/jersey2-oneOf-Mixed/**
- samples/client/petstore/java/jersey3-oneOf/**
- samples/client/others/java/okhttp-gson-streaming/**
- samples/client/others/java/resteasy/**
- samples/client/others/java/apache-httpclient/**
- samples/client/others/java/resttemplate-list-schema-validation/**
- samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/**
pull_request:
@ -35,6 +39,10 @@ on:
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
- samples/client/others/java/jersey2-oneOf-duplicates/**
- samples/client/others/java/jersey2-oneOf-Mixed/**
- samples/client/petstore/java/jersey3-oneOf/**
- samples/client/others/java/okhttp-gson-streaming/**
- samples/client/others/java/resteasy/**
- samples/client/others/java/apache-httpclient/**
- samples/client/others/java/resttemplate-list-schema-validation/**
- samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/**
jobs:
@ -97,6 +105,10 @@ jobs:
- samples/client/others/java/jersey2-oneOf-Mixed/
- samples/client/others/java/resttemplate-list-schema-validation/
- samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/
- samples/client/petstore/java/jersey3-oneOf/
- samples/client/others/java/okhttp-gson-streaming/
- samples/client/petstore/java/resteasy/
- samples/client/petstore/java/apache-httpclient/
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5

View File

@ -0,0 +1,65 @@
# run java client tests with petstore server
name: Samples Java Petsore Client JDK11
on:
push:
paths:
- samples/client/petstore/java/jersey2-java8/**
- samples/openapi3/client/petstore/java/jersey2-java8/**
- samples/client/petstore/java/jersey3/**
- samples/client/petstore/java/okhttp-gson/**
- samples/client/petstore/java/okhttp-gson-3.1/**
- samples/client/petstore/java/okhttp-gson-dynamicOperations/**
- samples/client/petstore/java-micronaut-client/**
pull_request:
paths:
- samples/client/petstore/java/jersey2-java8/**
- samples/openapi3/client/petstore/java/jersey2-java8/**
- samples/client/petstore/java/jersey3/**
- samples/client/petstore/java/okhttp-gson/**
- samples/client/petstore/java/okhttp-gson-3.1/**
- samples/client/petstore/java/okhttp-gson-dynamicOperations/**
- samples/client/petstore/java-micronaut-client/**
jobs:
build:
name: Build Java Client JDK11
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- samples/client/petstore/java/jersey2-java8
- samples/openapi3/client/petstore/java/jersey2-java8
- samples/client/petstore/java/jersey3
- samples/client/petstore/java/okhttp-gson
- samples/client/petstore/java/okhttp-gson-3.1
- samples/client/petstore/java/okhttp-gson-dynamicOperations
- samples/client/petstore/java-micronaut-client
services:
petstore-api:
image: swaggerapi/petstore
ports:
- 80:8080
env:
SWAGGER_HOST: http://petstore.swagger.io
SWAGGER_BASE_PATH: /v2
steps:
- uses: actions/checkout@v5
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 11
- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: maven-repository
with:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Build with Maven
working-directory: ${{ matrix.sample }}
run: mvn clean package --no-transfer-progress

View File

@ -121,17 +121,5 @@ else
(cd samples/client/petstore/scala-sttp-circe && mvn integration-test)
(cd samples/client/petstore/scala-sttp4 && mvn integration-test)
(cd samples/client/petstore/clojure && mvn integration-test)
(cd samples/client/petstore/java/jersey2-java8 && mvn integration-test)
(cd samples/openapi3/client/petstore/java/jersey2-java8 && mvn integration-test)
(cd samples/client/petstore/java/jersey3 && mvn integration-test)
(cd samples/client/petstore/java/jersey3-oneOf && mvn integration-test)
(cd samples/client/others/java/okhttp-gson-streaming && mvn integration-test)
(cd samples/client/petstore/java/okhttp-gson && mvn integration-test)
(cd samples/client/petstore/java/okhttp-gson-3.1 && mvn integration-test)
(cd samples/client/petstore/java/okhttp-gson-dynamicOperations && mvn integration-test)
(cd samples/client/petstore/java/resteasy && mvn integration-test)
(cd samples/client/petstore/java-micronaut-client && mvn integration-test)
(cd samples/client/petstore/java/apache-httpclient && mvn integration-test)
(cd samples/client/petstore/java/resttemplate-jakarta && mvn integration-test)
fi

View File

@ -1,4 +1,7 @@
# OpenAPI Generator Ignore
# These are "live" test files which should not be overwritten
src/test/java/org/openapitools/client/JSONTest.java
src/test/java/org/openapitools/client/JSONComposedSchemaTest.java
src/test/java/org/openapitools/client/JSONComposedSchemaTest.java