Skip to content

Commit ad3ecad

Browse files
authored
Move ensure up-to-date script to drone.io (OpenAPITools#9339)
* move ensure up-to-date to drone.io * fix tests * Revert "fix tests" This reverts commit ea5efd3. * skip 2.0 tests * use mvnw * fail fast * fix meta-codegen * test java 11 first
1 parent a62d225 commit ad3ecad

File tree

7 files changed

+40
-38
lines changed

7 files changed

+40
-38
lines changed

CI/.drone.yml

+16-18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@ kind: pipeline
22
name: default
33

44
steps:
5+
# test Java 11 HTTP client
6+
- name: java11-test
7+
image: openjdk:11.0
8+
commands:
9+
- ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
10+
- ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
11+
# run ensure up-to-date
12+
- /bin/bash bin/utils/ensure-up-to-date
13+
# test java native client
14+
- ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
15+
- ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
16+
- ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml
17+
# test all generators with fake petstore spec (2.0, 3.0)
18+
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
19+
# generate test scripts
20+
- /bin/bash bin/tests/run-all-test
521
# test nim client
622
- name: nim-client-test
723
image: nimlang/nim
@@ -38,21 +54,3 @@ steps:
3854
image: haskell:8.6.5
3955
commands:
4056
- (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast)
41-
# test Java 11 HTTP client
42-
- name: java11-test
43-
image: openjdk:11.0
44-
commands:
45-
- ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
46-
- ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
47-
# test java native client
48-
- ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
49-
- ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
50-
- ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml
51-
# test all generators with fake petstore spec (2.0, 3.0)
52-
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
53-
# generate test scripts
54-
- /bin/bash bin/tests/run-all-test
55-
# generate all petstore samples (client, servers, doc)
56-
- /bin/bash bin/generate-samples.sh
57-
# generate all petstore samples (openapi3)
58-
- /bin/bash bin/generate-samples.sh bin/configs/other/*.yaml

CI/circle_parallel.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ elif [ "$NODE_INDEX" = "2" ]; then
4747
git checkout -- .
4848

4949
# look for outdated samples
50-
./bin/utils/ensure-up-to-date
50+
#./bin/utils/ensure-up-to-date
51+
# UPDATE: moved to drone.io
5152
fi
5253
echo "Running node $NODE_INDEX to test haskell"
5354
# install haskell

bin/meta-codegen.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -e
4+
35
SCRIPT="$0"
46
echo "# START SCRIPT: $SCRIPT"
57

@@ -18,8 +20,8 @@ ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o sampl
1820

1921
java $JAVA_OPTS -jar $executable $ags
2022

21-
(cd "$root"/samples/meta-codegen/ && mvn -B package -Djacoco.skip=true -DskipTests=true -f pom.xml)
23+
(./mvnw -B package -Djacoco.skip=true -DskipTests=true -f "$root"/samples/meta-codegen/pom.xml)
2224

23-
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen/usage $@"
25+
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/3_0/petstore.json -o samples/meta-codegen/usage $@"
2426

25-
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
27+
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2

bin/utils/test-fake-petstore-for-all.sh

+10-9
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ logfile="/tmp/generator-fake-petstore-output.log"
1111

1212
for GENERATOR in $(java -jar ${executable} list --short | sed -e 's/,/\'$'\n''/g')
1313
do
14-
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
15-
echo "[OAS 2.0] Executed ${GENERATOR} successfully!"
16-
else
17-
echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:"
18-
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}"
19-
echo "ERROR: The output of the command was:"
20-
cat ${logfile}
21-
exit 1
22-
fi
14+
# no longer test 2.0 spec as we migrated to 3.0 spec
15+
#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
16+
# echo "[OAS 2.0] Executed ${GENERATOR} successfully!"
17+
#else
18+
# echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:"
19+
# 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}"
20+
# echo "ERROR: The output of the command was:"
21+
# cat ${logfile}
22+
# exit 1
23+
#fi
2324

2425
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
2526
echo "[OAS 3.0] Executed ${GENERATOR} successfully!"

samples/meta-codegen/usage/src/org/openapitools/api/PetApi.sample

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ classname: PetApi
1616
operationId: addPet
1717

1818
# and parameters:
19-
body: Pet
19+
pet: Pet
2020

2121

2222
# each operation has an `operationId`:
@@ -52,7 +52,7 @@ petId: Long
5252
operationId: updatePet
5353

5454
# and parameters:
55-
body: Pet
55+
pet: Pet
5656

5757

5858
# each operation has an `operationId`:

samples/meta-codegen/usage/src/org/openapitools/api/StoreApi.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ orderId: String
3636
operationId: placeOrder
3737

3838
# and parameters:
39-
body: Order
39+
order: Order
4040

4141

4242
# end of operations block

samples/meta-codegen/usage/src/org/openapitools/api/UserApi.sample

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ classname: UserApi
1616
operationId: createUser
1717

1818
# and parameters:
19-
body: User
19+
user: User
2020

2121

2222
# each operation has an `operationId`:
2323
operationId: createUsersWithArrayInput
2424

2525
# and parameters:
26-
body: List
26+
user: List
2727

2828

2929
# each operation has an `operationId`:
3030
operationId: createUsersWithListInput
3131

3232
# and parameters:
33-
body: List
33+
user: List
3434

3535

3636
# each operation has an `operationId`:
@@ -66,7 +66,7 @@ operationId: updateUser
6666

6767
# and parameters:
6868
username: String
69-
body: User
69+
user: User
7070

7171

7272
# end of operations block

0 commit comments

Comments
 (0)