-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tooling): clients scripts and Docker image (#43)
- Loading branch information
Showing
16 changed files
with
227 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.github | ||
.git | ||
.vscode | ||
**/dist | ||
**/build | ||
**/node_modules | ||
playground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ARG NODE_VERSION=16.13.0 | ||
|
||
FROM node:$NODE_VERSION-alpine | ||
|
||
ENV DOCKER=true | ||
|
||
RUN apk add openjdk11 maven jq bash yamllint perl curl | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json yarn.lock .yarnrc.yml ./ | ||
COPY clients/ ./clients/ | ||
COPY .yarn .yarn | ||
RUN yarn install | ||
|
||
RUN mkdir dist | ||
RUN curl -L "https://github.com/google/google-java-format/releases/download/v1.13.0/google-java-format-1.13.0-all-deps.jar" > dist/google-java-format-1.13.0-all-deps.jar | ||
|
||
COPY . . | ||
|
||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
# Break on non-zero code | ||
set -e | ||
|
||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" | ||
# Move to the root (easier to locate other scripts) | ||
cd ${DIR}/../.. | ||
|
||
lang=$1 | ||
client=$2 | ||
generator="$lang-$client" | ||
package=$(cat openapitools.json | jq -r --arg generator "$generator" '."generator-cli".generators[$generator].additionalProperties.packageName') | ||
|
||
# Commands are based on the lang | ||
build_client(){ | ||
echo "> Building $generator..." | ||
|
||
if [[ $lang == 'javascript' ]]; then | ||
yarn workspace $package build | ||
elif [[ $lang == 'java' ]]; then | ||
set +e | ||
|
||
log=$(mvn clean install -f clients/$package/pom.xml) | ||
|
||
if [[ $? != 0 ]]; then | ||
echo "$log" | ||
exit 1 | ||
fi | ||
|
||
set -e | ||
fi | ||
} | ||
|
||
|
||
|
||
if [[ -z $package ]]; then | ||
echo "Unknown package ${package}" | ||
exit 1 | ||
fi | ||
|
||
build_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)/../.." | ||
|
||
cd $ROOT | ||
|
||
NODE_VERSION=$(cat .nvmrc) | ||
|
||
docker build --build-arg NODE_VERSION=$NODE_VERSION -t api-clients-automation . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)/../.." | ||
|
||
docker run -d -it --name dev --mount type=bind,source=$ROOT/,target=/app api-clients-automation |
Oops, something went wrong.