spiegel-keyman/resources/build/ci/test/test-pull-requests.sh
Marc Durdin f394245636 maint(common): consolidate builder scripts
Clarifies the confusing builder.inc.sh / build-utils.sh distinction by
giving the scripts more appropriate names. Most build scripts should use
builder-full.inc.sh; some helper scripts can use builder-basic.inc.sh.
Documented in resources/build/README.md.

Renames:
* resources/build/builder.inc.sh to resources/build/builder-full.inc.sh
* resources/build/build-utils.sh to resources/build/builder-basic.inc.sh

Other changes:
* Moves Android-specific functions out of builder-basic.inc.sh and into
  android/build.sh.
* Renames functions in builder-basic.inc.sh

More functions may be moved from builder-basic.inc.sh into utils.inc.sh
or other scripts in the future.

Fixes: #14065
Build-bot: build all
Test-bot: skip
2025-08-02 08:11:24 +10:00

48 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# Tests the pull-requests.inc.sh functions. This is not really intended to be
# used as an automated test, but rather only to be run manually after changes to
# pull-requests.inc.sh.
#
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../../../resources/build/builder-basic.inc.sh"
# END STANDARD BUILD SCRIPT INCLUDE
cd "$THIS_SCRIPT_PATH"
. "$KEYMAN_ROOT/resources/build/ci/pull-requests.inc.sh"
test_repo_base=`mktemp -d`
test_repo="$test_repo_base/ci-test-repo"
test_filename="$(uuidgen).md"
builder_echo "Preparing local repository clone in $test_repo"
pushd "$test_repo_base" >/dev/null
git clone https://github.com/keymanapp/ci-test-repo
popd >/dev/null
builder_echo "Creating test file $test_filename"
echo "This is a test $test_filename" > "$test_repo/$test_filename"
builder_echo blue "Testing ci_add_files"
ci_add_files "$test_repo" .
builder_echo blue "Testing ci_repo_has_cached_changes"
if ! ci_repo_has_cached_changes "$test_repo"; then
builder_die "Expected to have a file to commit!"
fi
builder_echo blue "Testing ci_open_pull_request"
ci_open_pull_request "$test_repo" "test/ci" "chore: testing CI"
rm -rf "$test_repo_base"
builder_echo green "Tests passed"