Skip to content

Commit 082f924

Browse files
authored
fix: skip linter and tests in create PR script (#198)
* fix: skip linter and tests in create PR script - prevents unrecognized api changes because before no PR was created - if e.g. the waiter and the generated code aren't align anymore, no PR was created
1 parent 588f4f4 commit 082f924

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ jobs:
7070
uses: actions/setup-go@v5
7171
with:
7272
go-version: ${{ env.GO_VERSION_BUILD }}
73+
- name: Remove waiters
74+
working-directory: ./sdk-repo-updated
75+
run: rm -r services/*/wait
7376
- name: Lint
7477
working-directory: ./sdk-repo-updated
7578
run: make lint skip-non-generated-files=true

scripts/sdk-create-pr.sh

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,27 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
9898
go work use -r .
9999
fi
100100

101-
# If lint or test fails for a service, we skip it and continue to the next one
102-
make lint skip-non-generated-files=true service="$service" || {
103-
echo "! Linting failed for $service. THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
104-
continue
105-
}
106-
# Our unit test template fails because it doesn't support fields with validations,
107-
# such as the UUID component used by IaaS. We introduce this hardcoded skip until we fix it
108-
if [ "${service}" = "iaas" ] || [ "${service}" = "iaasalpha" ]; then
109-
echo ">> Skipping tests of $service service"
110-
else
111-
make test skip-non-generated-files=true service="$service" || {
112-
echo "! Testing failed for $service. THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
101+
# If the target branch is main, we run the linter and tests in order to have code which can be compiled.
102+
# If the target branch is not main, we skip the linter and tests, because in the create PRs the CI pipeline will check run them as well.
103+
# This prevents unrecognized api changes, because we will see them within the PR itself.
104+
if [[ "$branch" == "main" ]]; then
105+
# If lint or test fails for a service, we skip it and continue to the next one
106+
make lint skip-non-generated-files=true service="$service" || {
107+
echo "! Linting failed for $service. THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
113108
continue
114109
}
110+
# Our unit test template fails because it doesn't support fields with validations,
111+
# such as the UUID component used by IaaS. We introduce this hardcoded skip until we fix it
112+
if [ "${service}" = "iaas" ] || [ "${service}" = "iaasalpha" ]; then
113+
echo ">> Skipping tests of $service service"
114+
else
115+
make test skip-non-generated-files=true service="$service" || {
116+
echo "! Testing failed for $service. THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
117+
continue
118+
}
119+
fi
115120
fi
116-
121+
117122
git add "services/${service}/"
118123
if [ "${LANGUAGE}" == "go" ] && [ ! -d "${work_dir}/sdk_backup/services/${service}/" ]; then # Check if it is a newly added SDK module
119124
git add go.work

0 commit comments

Comments
 (0)