Incorporates these changes: - When `forgejo/build-from-sources` is present, Actions & Packages tests are run only against the built versions. Otherwise, they are run against the versions defined in `$RELEASE_NUMBERS` - Updates Packages tests which are testing Alpine publishing to use currently supported Alpine releases - Actions & Packages tests are run in a matrix, allowing parallel execution Only the Actions & Packages tests take a significant amount of time (>10 minutes), so changes have been limited to those test suites -- every test suite that is moved into a matrix adds additional overhead in the 1 minute `prepare-end-to-end` step. Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/1367 Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net> Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
80 lines
2.6 KiB
Bash
Executable file
80 lines
2.6 KiB
Bash
Executable file
TMPDIR=$(mktemp -d)
|
|
|
|
trap "rm -fr $TMPDIR" EXIT
|
|
|
|
api=$url/api/v1
|
|
export d=/srv/example/cache-pull-request
|
|
|
|
function main() {
|
|
mkdir -p $d
|
|
|
|
#
|
|
# open a pull request
|
|
# - from the same repository
|
|
# - from a forked repository
|
|
#
|
|
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
|
|
|
|
forgejo-curl.sh api_json --data-raw '{"username":"cache-fork-org"}' $api/orgs
|
|
forgejo-curl.sh api_json --data-raw '{"organization":"cache-fork-org"}' $api/repos/root/example-cache-pull-request/forks
|
|
|
|
(
|
|
cd $d
|
|
git clone $url/cache-fork-org/example-cache-pull-request fork
|
|
cd fork
|
|
git config user.email root@example.com
|
|
git config user.name username
|
|
touch file-unique-to-the-pr-branch
|
|
git add .
|
|
git commit -m 'fork change'
|
|
git push
|
|
)
|
|
|
|
forgejo.sh retry forgejo-curl.sh api_json --data-raw '{"title":"PR from fork","base":"main","head":"cache-fork-org:main"}' $api/repos/root/example-cache-pull-request/pulls
|
|
|
|
(
|
|
cd $d
|
|
git clone $url/root/example-cache-pull-request
|
|
cd example-cache-pull-request
|
|
git checkout -b other
|
|
git config user.email root@example.com
|
|
git config user.name username
|
|
touch file-unique-to-the-forked-pr
|
|
git add .
|
|
git commit -m 'other change'
|
|
git push --force -u origin other
|
|
)
|
|
|
|
forgejo.sh retry forgejo-curl.sh api_json --data-raw '{"title":"PR same repo","base":"main","head":"other"}' $api/repos/root/example-cache-pull-request/pulls
|
|
|
|
export RETRY_DELAYS="10 20 60 60 60 60 60"
|
|
|
|
#
|
|
# wait for the opened event to succeed using the cache on all pull requests
|
|
#
|
|
if ! forgejo.sh retry $EXAMPLE_DIR/assert-contexts-opened.sh; then
|
|
echo "assert-contexts-opened.sh failed; printing related logs and information:"
|
|
find $d
|
|
sed -e 's/^/[RUNNER LOGS]/' <$FORGEJO_RUNNER_LOGS
|
|
return 1
|
|
fi
|
|
|
|
#
|
|
# merge all pull requests
|
|
#
|
|
forgejo-curl.sh api_json $api/repos/root/example-cache-pull-request/pulls | jq -r '.[] | .number' | while read pr; do
|
|
forgejo-curl.sh api_json --data-raw '{"Do":"merge"}' $api/repos/root/example-cache-pull-request/pulls/$pr/merge
|
|
done
|
|
|
|
#
|
|
# wait for the closed event to succeed using the cache on all pull requests
|
|
#
|
|
if ! forgejo.sh retry $EXAMPLE_DIR/assert-contexts-closed.sh; then
|
|
echo "assert-contexts-closed.sh failed; printing related logs and information:"
|
|
find $d
|
|
sed -e 's/^/[RUNNER LOGS]/' <$FORGEJO_RUNNER_LOGS
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
main
|