Move ensure up-to-date script to drone.io (#9339)

* move ensure up-to-date to drone.io

* fix tests

* Revert "fix tests"

This reverts commit ea5efd3b3b45e7e7720b2aa893403aed8a458d9f.

* skip 2.0 tests

* use mvnw

* fail fast

* fix meta-codegen

* test java 11 first
This commit is contained in:
William Cheng 2021-04-26 22:08:49 +08:00 committed by GitHub
parent a62d22593e
commit ad3ecadd75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 38 deletions

View File

@ -2,6 +2,22 @@ kind: pipeline
name: default
steps:
# test Java 11 HTTP client
- name: java11-test
image: openjdk:11.0
commands:
- ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# run ensure up-to-date
- /bin/bash bin/utils/ensure-up-to-date
# test java native client
- ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
- ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
- ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml
# test all generators with fake petstore spec (2.0, 3.0)
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
# generate test scripts
- /bin/bash bin/tests/run-all-test
# test nim client
- name: nim-client-test
image: nimlang/nim
@ -38,21 +54,3 @@ steps:
image: haskell:8.6.5
commands:
- (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast)
# test Java 11 HTTP client
- name: java11-test
image: openjdk:11.0
commands:
- ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# test java native client
- ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
- ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
- ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml
# test all generators with fake petstore spec (2.0, 3.0)
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
# generate test scripts
- /bin/bash bin/tests/run-all-test
# generate all petstore samples (client, servers, doc)
- /bin/bash bin/generate-samples.sh
# generate all petstore samples (openapi3)
- /bin/bash bin/generate-samples.sh bin/configs/other/*.yaml

View File

@ -47,7 +47,8 @@ elif [ "$NODE_INDEX" = "2" ]; then
git checkout -- .
# look for outdated samples
./bin/utils/ensure-up-to-date
#./bin/utils/ensure-up-to-date
# UPDATE: moved to drone.io
fi
echo "Running node $NODE_INDEX to test haskell"
# install haskell

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
set -e
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
@ -18,8 +20,8 @@ ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o sampl
java $JAVA_OPTS -jar $executable $ags
(cd "$root"/samples/meta-codegen/ && mvn -B package -Djacoco.skip=true -DskipTests=true -f pom.xml)
(./mvnw -B package -Djacoco.skip=true -DskipTests=true -f "$root"/samples/meta-codegen/pom.xml)
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen/usage $@"
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/3_0/petstore.json -o samples/meta-codegen/usage $@"
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2

View File

@ -11,15 +11,16 @@ logfile="/tmp/generator-fake-petstore-output.log"
for GENERATOR in $(java -jar ${executable} list --short | sed -e 's/,/\'$'\n''/g')
do
if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR} > ${logfile} 2>&1; then
echo "[OAS 2.0] Executed ${GENERATOR} successfully!"
else
echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:"
echo "java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR}"
echo "ERROR: The output of the command was:"
cat ${logfile}
exit 1
fi
# no longer test 2.0 spec as we migrated to 3.0 spec
#if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR} > ${logfile} 2>&1; then
# echo "[OAS 2.0] Executed ${GENERATOR} successfully!"
#else
# echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:"
# echo "java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR}"
# echo "ERROR: The output of the command was:"
# cat ${logfile}
# exit 1
#fi
if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/3.0/${GENERATOR} > ${logfile} 2>&1; then
echo "[OAS 3.0] Executed ${GENERATOR} successfully!"

View File

@ -16,7 +16,7 @@ classname: PetApi
operationId: addPet
# and parameters:
body: Pet
pet: Pet
# each operation has an `operationId`:
@ -52,7 +52,7 @@ petId: Long
operationId: updatePet
# and parameters:
body: Pet
pet: Pet
# each operation has an `operationId`:

View File

@ -36,7 +36,7 @@ orderId: String
operationId: placeOrder
# and parameters:
body: Order
order: Order
# end of operations block

View File

@ -16,21 +16,21 @@ classname: UserApi
operationId: createUser
# and parameters:
body: User
user: User
# each operation has an `operationId`:
operationId: createUsersWithArrayInput
# and parameters:
body: List
user: List
# each operation has an `operationId`:
operationId: createUsersWithListInput
# and parameters:
body: List
user: List
# each operation has an `operationId`:
@ -66,7 +66,7 @@ operationId: updateUser
# and parameters:
username: String
body: User
user: User
# end of operations block