-
Notifications
You must be signed in to change notification settings - Fork 21
chore(tooling): clients scripts and Docker image #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b8a61c3
chore(tooling): clients script
shortcuts 003c046
fix: make scripts easier?
shortcuts 5cf00bc
fix: GitHub actions
shortcuts 34db07e
fix: scripts and dockerfile
shortcuts 6e62122
fix: GA cts
shortcuts 0c4d342
remove unused file
shortcuts 72612bf
fix: use Pierre's dockerfile
shortcuts 3cb73a4
feat: docker container
shortcuts 64f6cbe
merge main
shortcuts 50f1011
fix: GA
shortcuts e7e39d0
fix java linter for java>=16
millotp 5540140
fix: rename `clients` and `specs` scripts, move scripts to `build` fo…
shortcuts 40fa1bb
Merge branch 'chore/APIC-225/clients-script' of github.com:algolia/ap…
shortcuts c0bc1e9
Merge branch 'main' into chore/APIC-225/clients-script
shortcuts 2ea4aab
add `.git` to dockerignore
shortcuts 5c23c61
Merge branch 'main' into chore/APIC-225/clients-script
shortcuts f51e16d
throw when not using container
shortcuts 5c5e20e
Merge branch 'main' into chore/APIC-225/clients-script
shortcuts 2a90ccd
remove download formatter from scripts
shortcuts 2d0209f
Revert "remove download formatter from scripts"
shortcuts 6f63ef3
fix: java command
shortcuts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -7,16 +7,17 @@ | |
"tests/" | ||
], | ||
"scripts": { | ||
"build:clients": "./scripts/multiplexer.sh ./scripts/build/clients.sh ${0:-all} ${1:-all}", | ||
"build:specs": "./scripts/build/specs.sh ${0:-all} ${1:-yaml}", | ||
"build": "yarn build:specs && yarn build:clients", | ||
"clean": "rm -rf **/dist **/build **/node_modules", | ||
"client:build-java": "mvn clean install -f clients/algoliasearch-client-java-2/pom.xml", | ||
"client:build-js:analytics": "yarn workspace @algolia/client-analytics build", | ||
"client:build-js:personalization": "yarn workspace @algolia/client-personalization build", | ||
"client:build-js:recommend": "yarn workspace @algolia/recommend build", | ||
"client:build-js:search": "yarn workspace @algolia/client-search build", | ||
"client:build-js": "yarn client:build-js:search && yarn client:build-js:recommend && yarn client:build-js:personalization && yarn client:build-js:analytics", | ||
"client:build": "yarn client:build-js", | ||
"cts:generate": "yarn workspace tests cts:generate", | ||
"cts:test": "yarn workspace tests test", | ||
"docker:build": "./scripts/docker/build.sh", | ||
"docker:clean": "docker stop dev; docker rm -f dev; docker image rm -f api-clients-automation", | ||
"docker:mount": "./scripts/docker/mount.sh", | ||
"docker:setup": "yarn docker:clean && yarn docker:build && yarn docker:mount", | ||
"docker": "docker exec dev yarn $*", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to pass the signals too ? Like ctrl+c is not stopping the generation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not managed to reproduce, I'm able to use ctrl+c on my side 🤔 |
||
"lint": "eslint --ext=ts .", | ||
"post:generate": "./scripts/post-gen/global.sh", | ||
"generate": "./scripts/multiplexer.sh ./scripts/generate.sh ${0:-all} ${1:-all} && yarn post:generate", | ||
|
@@ -25,8 +26,7 @@ | |
"playground:js:personalization": "yarn workspace javascript-playground start:personalization", | ||
"playground:js:recommend": "yarn workspace javascript-playground start:recommend", | ||
"playground:js:search": "yarn workspace javascript-playground start:search", | ||
"specs:format": "yarn prettier --write specs", | ||
"specs": "./scripts/specs.sh ${0:-all} ${1:-yaml}" | ||
"specs:format": "yarn prettier --write specs" | ||
}, | ||
"devDependencies": { | ||
"@openapitools/openapi-generator-cli": "2.4.18", | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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)/../.." | ||
shortcuts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
cd $ROOT | ||
|
||
NODE_VERSION=$(cat .nvmrc) | ||
|
||
docker build --build-arg NODE_VERSION=$NODE_VERSION -t api-clients-automation . |
This file contains hidden or 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)/../.." | ||
shortcuts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
docker run -d -it --name dev --mount type=bind,source=$ROOT/,target=/app api-clients-automation | ||
shortcuts marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.