Skip to content
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

Check all commits in branch for examples (to trigger testing) #14243

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions scripts/test_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
set -e

# List files changed in the commit to check
FILES=`git log -n 2 --name-only --format=""`
FILES=($( git diff "$( git merge-base --fork-point master )" --name-only ))

TEST_EXAMPLES=No

# Currently examine en directory only, can extend to other lang when neded
for f in $FILES; do
if [[ $f =~ "content/en/examples/" ]]; then
# Check if examples folders (all locales) change in this branch
if printf -- '%s\n' "${FILES[@]}" | grep -qE '^"?content/[^/]+/examples/'; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice one, like this bit 👍

TEST_EXAMPLES=Yes
break
fi
done
fi

function install() {
if [[ $TEST_EXAMPLES == No ]]; then
echo "PR not touching examples, skipping example tests install"
if ! [[ $TEST_EXAMPLES == Yes ]]; then
echo "PR not touching examples, skipping example tests install" 1>&2
exit 0
fi

Expand All @@ -42,8 +39,8 @@ function install() {
}

function run_test() {
if [[ $TEST_EXAMPLES == No ]]; then
echo "PR not touching examples, skipping example tests execution"
if ! [[ $TEST_EXAMPLES == Yes ]]; then
echo "PR not touching examples, skipping example tests execution" 1>&2
exit 0
fi
go test -v k8s.io/website/content/en/examples
Expand Down