@@ -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