Skip to content

Commit a9f79ba

Browse files
committed
feat: Improvements
1 parent 45fcbf1 commit a9f79ba

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

scripts/download-oas.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fi
3333
# Move oas to root level
3434
mkdir ${ROOT_DIR}/oas
3535
cd ${work_dir}
36-
git clone ${OAS_REPO}
36+
git clone ${OAS_REPO} --quiet
3737

3838
for service_dir in ${work_dir}/${OAS_REPO_NAME}/services/*; do
3939
max_version_dir=""

scripts/generate-sdk/generate-sdk.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,21 @@ fi
7474
# Generate SDK for the specified language
7575
case "${LANGUAGE}" in
7676
go)
77-
echo -e "\nGenerating the Go SDK...\n"
77+
echo -e "\n>> Generating the Go SDK..."
7878

7979
source ${LANGUAGE_GENERATORS_FOLDER_PATH}/${LANGUAGE}.sh
8080
# Usage: generate_go_sdk GENERATOR_PATH GIT_HOST GIT_USER_ID [GIT_REPO_ID] [SDK_REPO_URL]
8181
generate_go_sdk ${jar_path} ${GIT_HOST} ${GIT_USER_ID} ${GIT_REPO_ID} ${SDK_REPO_URL}
8282
;;
8383
python)
84-
echo -e "\nGenerating the Python SDK...\n"
84+
echo -e "\n>> Generating the Python SDK..."
8585

8686
source ${LANGUAGE_GENERATORS_FOLDER_PATH}/${LANGUAGE}.sh
8787
# Usage: generate_python_sdk GENERATOR_PATH GIT_HOST GIT_USER_ID [GIT_REPO_ID] [SDK_REPO_URL]
8888
generate_python_sdk ${jar_path} ${GIT_HOST} ${GIT_USER_ID} ${GIT_REPO_ID} ${SDK_REPO_URL}
8989
;;
9090
*)
91-
echo "SDK language not supported."
91+
echo "! SDK language not supported."
9292
exit 1
9393
;;
9494
esac

scripts/generate-sdk/languages/go.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,4 @@ generate_go_sdk() {
215215
cd ${SDK_REPO_LOCAL_PATH}
216216
goimports -w ${SERVICES_FOLDER}/
217217
make sync-tidy
218-
219218
}

scripts/sdk-create-pr.sh

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ BRANCH_PREFIX=$1
1111
COMMIT_INFO=$2
1212

1313
if [ $# -lt 2 ]; then
14-
echo "Not enough arguments supplied. Required: 'branch-prefix' 'commit-info'"
14+
echo "! Not enough arguments supplied. Required: 'branch-prefix' 'commit-info'"
1515
exit 1
1616
fi
1717

1818
if type -p go >/dev/null; then
1919
:
2020
else
21-
echo "Go not installed, unable to proceed."
21+
echo "! Go not installed, unable to proceed."
2222
exit 1
2323
fi
2424

2525
if [ ! -d ${SDK_REPO_LOCAL_PATH} ]; then
26-
echo "sdk to commit not found in root. Please run make generate-sdk"
26+
echo "! SDK to commit not found in root. Please run make generate-sdk"
2727
exit 1
2828
fi
2929

@@ -41,7 +41,8 @@ else
4141
fi
4242

4343
# Create temp directory to work on
44-
work_dir=$(mktemp -d)
44+
work_dir="$ROOT_DIR/temp"
45+
mkdir -p ${work_dir}
4546
if [[ ! ${work_dir} || -d {work_dir} ]]; then
4647
echo "Unable to create temporary directory"
4748
exit 1
@@ -60,7 +61,7 @@ rm -rf ${work_dir}/sdk_to_push/.git
6061

6162
# Initialize git repo
6263
cd ${work_dir}/git_repo
63-
git clone ${REPO_URL_SSH} ./
64+
git clone ${REPO_URL_SSH} ./ --quiet
6465
git config user.name "${COMMIT_NAME}"
6566
git config user.email "${COMMIT_EMAIL}"
6667

@@ -80,6 +81,18 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
8081
service_changes=$(git status --porcelain "services/$service")
8182

8283
if [[ -n "$service_changes" ]]; then
84+
echo -e "\n>> Detected changes in $service service"
85+
86+
# If lint or test fails for a service, we skip it and continue to the next one
87+
make lint skip-non-generated-files=true service=$service || {
88+
echo "! Linting failed for $service. THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
89+
continue
90+
}
91+
go test ./services/$service/ -timeout=5m -cover -count=1 || {
92+
echo "! Testing failed for $service. THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
93+
continue
94+
}
95+
8396
if [[ "$BRANCH_PREFIX" != "main" ]]; then
8497
git switch main # This is needed to create a new branch for the service without including the previously committed files
8598
branch="$BRANCH_PREFIX/$service"
@@ -99,25 +112,13 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
99112

100113
if [[ "$branch" != "main" ]]; then
101114
echo ">> Creating PR for $service"
102-
103115
git commit -m "Generate $service"
104116
git push origin "$branch"
105117
gh pr create --title "Generator: Update SDK /services/$service" --body "$COMMIT_INFO" --head "$branch" --base "main"
106118
else
107119
echo ">> Pushing changes for $service service..."
108-
109-
# If lint or test fails for a service, we skip it and continue to the next one
110-
make lint skip-non-generated-files=true service=$service || {
111-
echo "! Linting failed for $service"
112-
continue
113-
}
114-
make test skip-non-generated-files=true service=$service || {
115-
echo "! Testing failed for $service"
116-
continue
117-
}
118-
119-
git commit -m "Generate $service: $COMMIT_INFO"
120-
git push origin "$branch"
120+
# git commit -m "Generate $service: $COMMIT_INFO"
121+
# git push origin "$branch"
121122
fi
122123
fi
123124
done

0 commit comments

Comments
 (0)