Skip to content

Commit

Permalink
Skip tests if all changes in docs (#6870)
Browse files Browse the repository at this point in the history
* Skip tests if all changes in website (and .ibm for testing this PR)

* Use Merge  base

* Add rule for podman-test on GH Actions
  • Loading branch information
feloy authored Jun 6, 2023
1 parent a830179 commit 029c538
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/podman-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ on:
pull_request:
branches:
- main

paths-ignore:
- 'docs/**'
- CONTRIBUTING.md
- OWNERS
- README.md
- USAGE_DATA.md

jobs:
ODO-PODMAN-TEST:
Expand Down
26 changes: 26 additions & 0 deletions .ibm/pipelines/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,29 @@ cleanup_namespaces() {
fi
done
}

skip_if_only() {
echo "Checking if tests need to be executed..."
NAMES=$(git diff --merge-base --name-only main)
for change in ${NAMES}; do
skip $change
if [[ $? == 0 ]]; then
return
fi
done
echo " => Skipping the tests."
exit 0
}

skip() {
SKIP_IF_ONLY="docs/ CONTRIBUTING.md OWNERS README.md USAGE_DATA.md"
change=$1
for skip in ${SKIP_IF_ONLY}; do
if [[ "${change}" == "${skip}"* ]]; then
echo " - ${change} is ${skip}*"
return 1
fi
done
echo " - $change not in $SKIP_IF_ONLY"
return 0
}
2 changes: 2 additions & 0 deletions .ibm/pipelines/kubernetes-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-kubernetes-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r "${IBM_REGION}"
ibmcloud ks cluster config --cluster "${IBM_KUBERNETES_ID}" --admin
Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/nocluster-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-nocluster-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r "${IBM_REGION}"

Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/openshift-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-openshift-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r eu-de
ibmcloud oc cluster config -c "${CLUSTER_ID}"
Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/openshift-unauth-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-openshift-unauth-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

ibmcloud login --apikey "${API_KEY_QE}"
ibmcloud target -r eu-de
ibmcloud oc cluster config -c "${CLUSTER_ID}"
Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-unit-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

(
set -e
make test
Expand Down
2 changes: 2 additions & 0 deletions .ibm/pipelines/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ LOGFILE="pr-${GIT_PR_NUMBER}-Validate-tests-${BUILD_NUMBER}"

source .ibm/pipelines/functions.sh

skip_if_only

(
set -e
make goget-tools
Expand Down
5 changes: 4 additions & 1 deletion .ibm/pipelines/windows-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

set -x

source .ibm/pipelines/functions.sh

skip_if_only

LOGFILE="pr-${GIT_PR_NUMBER}-windows-tests-${BUILD_NUMBER}"
export REPO=${REPO:-"https://github.com/redhat-developer/odo"}
#copy test script inside /tmp/
Expand All @@ -19,7 +23,6 @@ RESULT=$?
echo "RESULT: $RESULT"

# save log
source .ibm/pipelines/functions.sh
ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}"
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no Administrator@$WINDOWS_IP:~/AppData/Local/Temp/${LOGFILE} /tmp/${LOGFILE}
save_logs "${LOGFILE}" "Windows Tests (OCP)" $RESULT
Expand Down

0 comments on commit 029c538

Please sign in to comment.