Skip to content

Commit 4a91e62

Browse files
jimschubertwing328
authored andcommitted
[ci] Setting ensure-up-to-date to use batch option in CircleCI (#4445)
* [build] Enable --batch option in ensure-up-to-date * [samples] Regenerate * [ci] Use --batch in CircleCI script
1 parent bb4500e commit 4a91e62

3 files changed

Lines changed: 93 additions & 73 deletions

File tree

CI/circle_parallel.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ elif [ "$NODE_INDEX" = "2" ]; then
2828
git checkout -- .
2929

3030
# look for outdated samples
31-
./bin/utils/ensure-up-to-date
31+
./bin/utils/ensure-up-to-date --batch
3232
fi
3333
#elif [ "$NODE_INDEX" = "3" ]; then
3434
echo "Running node $NODE_INDEX to test haskell"

bin/utils/ensure-up-to-date

Lines changed: 91 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,110 @@
1-
#!/bin/bash
2-
# this bash script run the scripts for the 'mature' generators
1+
#!/usr/bin/env bash
2+
# this bash script runs the scripts for the 'mature' generators by default.
3+
# Supports --batch option which will compile all generators defined under bin/ci/*.json
34
# it ensures that all changes are committed into the 'samples/' folder
5+
# shellcheck disable=SC2155
6+
declare cwd="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
declare root="$(cd "$cwd" && cd ../../ && pwd)"
8+
declare executable="${root}/modules/openapi-generator-cli/target/openapi-generator-cli.jar"
9+
declare batch_mode="false"
410

511
echo "# START SCRIPT: $0"
612

713
echo "IMPORTANT: this script should be run by the CI (e.g. Shippable) to ensure that the 'samples/' folder is up to date."
14+
if [ "--batch" = "$1" ]; then
15+
batch_mode="true"
16+
echo "Running in 'batch mode' (single JVM, mutliple threads)."
17+
else
18+
echo "When running locally execute with argument --batch."
19+
fi
820
echo "Please press CTRL+C to stop or the script will continue in 5 seconds."
921

1022
sleep 5
1123

1224
# LIST OF SCRIPTS:
1325
declare -a scripts=(
1426
# SAMPLES
15-
"./bin/ruby-client-petstore.sh"
16-
"./bin/ruby-client-petstore-faraday.sh"
17-
"./bin/openapi3/ruby-client-petstore.sh"
18-
"./bin/openapi3/ruby-client-faraday-petstore.sh"
19-
20-
"./bin/java-petstore-all.sh"
21-
"./bin/java-jaxrs-petstore-server-all.sh"
22-
"./bin/java-msf4j-petstore-server.sh"
23-
"./bin/openapi3/jaxrs-jersey-petstore.sh"
24-
"./bin/spring-all-petstore.sh"
25-
"./bin/javascript-petstore-all.sh"
26-
"./bin/kotlin-client-all.sh"
27-
"./bin/kotlin-server-petstore.sh"
28-
"./bin/kotlin-springboot-petstore-server.sh"
29-
"./bin/kotlin-springboot-petstore-server-reactive.sh"
30-
"./bin/mysql-schema-petstore.sh"
31-
"./bin/nim-client-petstore.sh"
32-
"./bin/python-petstore-all.sh"
33-
"./bin/openapi3/python-petstore.sh"
34-
"./bin/php-petstore.sh"
35-
"./bin/php-silex-petstore-server.sh"
36-
"./bin/php-symfony-petstore.sh"
37-
"./bin/php-lumen-petstore-server.sh"
38-
"./bin/php-slim-server-petstore.sh"
39-
"./bin/php-slim4-server-petstore.sh"
40-
"./bin/php-ze-ph-petstore-server.sh"
41-
"./bin/openapi3/php-petstore.sh"
42-
"./bin/typescript-angularjs-petstore.sh"
43-
"./bin/typescript-angular-petstore-all.sh"
44-
"./bin/typescript-aurelia-petstore.sh"
45-
"./bin/typescript-axios-petstore-all.sh"
46-
"./bin/typescript-fetch-petstore-all.sh"
47-
"./bin/typescript-inversify-petstore.sh"
48-
"./bin/typescript-jquery-petstore-all.sh"
49-
"./bin/typescript-node-petstore-all.sh"
50-
"./bin/typescript-rxjs-petstore-all.sh"
51-
"./bin/rust-server-petstore.sh"
52-
"./bin/r-petstore.sh"
53-
"./bin/haskell-http-client-petstore.sh"
54-
"./bin/csharp-petstore.sh"
55-
"./bin/csharp-netcore-petstore-all.sh"
56-
"./bin/elixir-petstore.sh"
57-
"./bin/openapi3/go-petstore.sh"
58-
"./bin/go-experimental-petstore.sh"
59-
"./bin/go-petstore.sh"
60-
"./bin/go-petstore-withxml.sh"
61-
"./bin/go-petstore-server.sh"
62-
"./bin/go-gin-petstore-server.sh"
63-
"./bin/groovy-petstore.sh"
64-
"./bin/apex-petstore.sh"
65-
"./bin/perl-petstore-all.sh"
66-
"./bin/dart-jaguar-petstore.sh"
67-
#"./bin/dart-dio-petstore.sh"
68-
"./bin/dart-petstore.sh"
69-
"./bin/dart2-petstore.sh"
70-
"./bin/java-play-framework-petstore-server-all.sh"
71-
#"./bin/elm-petstore-all.sh"
72-
"./bin/meta-codegen.sh"
27+
"${root}/bin/ruby-client-petstore.sh"
28+
"${root}/bin/ruby-client-petstore-faraday.sh"
29+
"${root}/bin/openapi3/ruby-client-petstore.sh"
30+
"${root}/bin/openapi3/ruby-client-faraday-petstore.sh"
31+
"${root}/bin/java-petstore-all.sh"
32+
"${root}/bin/java-jaxrs-petstore-server-all.sh"
33+
"${root}/bin/java-msf4j-petstore-server.sh"
34+
"${root}/bin/openapi3/jaxrs-jersey-petstore.sh"
35+
"${root}/bin/spring-all-petstore.sh"
36+
"${root}/bin/javascript-petstore-all.sh"
37+
"${root}/bin/kotlin-client-all.sh"
38+
"${root}/bin/kotlin-server-petstore.sh"
39+
"${root}/bin/kotlin-springboot-petstore-server.sh"
40+
"${root}/bin/kotlin-springboot-petstore-server-reactive.sh"
41+
"${root}/bin/mysql-schema-petstore.sh"
42+
"${root}/bin/nim-client-petstore.sh"
43+
"${root}/bin/python-petstore-all.sh"
44+
"${root}/bin/openapi3/python-petstore.sh"
45+
"${root}/bin/php-petstore.sh"
46+
"${root}/bin/php-silex-petstore-server.sh"
47+
"${root}/bin/php-symfony-petstore.sh"
48+
"${root}/bin/php-lumen-petstore-server.sh"
49+
"${root}/bin/php-slim-server-petstore.sh"
50+
"${root}/bin/php-slim4-server-petstore.sh"
51+
"${root}/bin/php-ze-ph-petstore-server.sh"
52+
"${root}/bin/openapi3/php-petstore.sh"
53+
"${root}/bin/typescript-angularjs-petstore.sh"
54+
"${root}/bin/typescript-angular-petstore-all.sh"
55+
"${root}/bin/typescript-aurelia-petstore.sh"
56+
"${root}/bin/typescript-axios-petstore-all.sh"
57+
"${root}/bin/typescript-fetch-petstore-all.sh"
58+
"${root}/bin/typescript-inversify-petstore.sh"
59+
"${root}/bin/typescript-jquery-petstore-all.sh"
60+
"${root}/bin/typescript-node-petstore-all.sh"
61+
"${root}/bin/typescript-rxjs-petstore-all.sh"
62+
"${root}/bin/rust-server-petstore.sh"
63+
"${root}/bin/r-petstore.sh"
64+
"${root}/bin/haskell-http-client-petstore.sh"
65+
"${root}/bin/csharp-petstore.sh"
66+
"${root}/bin/csharp-netcore-petstore-all.sh"
67+
"${root}/bin/elixir-petstore.sh"
68+
"${root}/bin/openapi3/go-petstore.sh"
69+
"${root}/bin/go-experimental-petstore.sh"
70+
"${root}/bin/go-petstore.sh"
71+
"${root}/bin/go-petstore-withxml.sh"
72+
"${root}/bin/go-petstore-server.sh"
73+
"${root}/bin/go-gin-petstore-server.sh"
74+
"${root}/bin/groovy-petstore.sh"
75+
"${root}/bin/apex-petstore.sh"
76+
"${root}/bin/perl-petstore-all.sh"
77+
"${root}/bin/dart-jaguar-petstore.sh"
78+
#"${root}/bin/dart-dio-petstore.sh"
79+
"${root}/bin/dart-petstore.sh"
80+
"${root}/bin/dart2-petstore.sh"
81+
"${root}/bin/java-play-framework-petstore-server-all.sh"
82+
#"${root}/bin/elm-petstore-all.sh"
83+
"${root}/bin/meta-codegen.sh"
7384
# OTHERS
74-
"./bin/utils/export_docs_generators.sh"
75-
"./bin/utils/copy-to-website.sh"
76-
"./bin/utils/export_generators_readme.sh")
85+
"${root}/bin/utils/export_docs_generators.sh"
86+
"${root}/bin/utils/copy-to-website.sh"
87+
"${root}/bin/utils/export_generators_readme.sh")
7788

78-
export JAVA_OPTS="-Djava.awt.headless=true"
89+
export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"
7990

80-
for script in "${scripts[@]}"; do
81-
if eval $script > /dev/null 2>&1; then
82-
echo "Executed $script successfully!"
83-
else
84-
echo "ERROR: Failed to run $script"
85-
exit 1
91+
if [ "true" = "$batch_mode" ]; then
92+
if [ ! -f "$executable" ]; then
93+
(cd "${root}" && mvn -B clean package -DskipTests=true -Dmaven.javadoc.skip=true)
8694
fi
87-
done
95+
96+
# shellcheck disable=SC2086
97+
java $JAVA_OPTS -jar "$executable" batch --includes-base-dir "${root}" --fail-fast -- "${root}"/bin/ci/*
98+
else
99+
for script in "${scripts[@]}"; do
100+
if eval "$script" > /dev/null 2>&1; then
101+
echo "Executed $script successfully!"
102+
else
103+
echo "ERROR: Failed to run $script"
104+
exit 1
105+
fi
106+
done
107+
fi
88108

89109
# Check:
90110
if [ -n "$(git status --porcelain)" ]; then
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.2.0-SNAPSHOT
1+
4.2.1-SNAPSHOT

0 commit comments

Comments
 (0)