forgejo/.forgejo/cascading-pr-end-to-end
Earl Warren 1f8e6b6e31
chore(ci): optimize end-to-end runs
* specify the version targeted by the pull request. The end-to-end
  tests previously compiled all known branches which was a waste. The
  pull request now must specify which version it is targeting so that
  only this version is recompiled and used for testing.
* when building the daily releases, use the release from the
  integration organization to ensure the tests are run against the
  latest build. Clarify in a comment why the lookup order of
  organizations is reversed in this particular case.

Refs: https://code.forgejo.org/forgejo/end-to-end/pulls/239
2024-08-08 17:53:12 +02:00

35 lines
884 B
Bash
Executable file

#!/bin/bash
set -ex
end_to_end=$1
end_to_end_pr=$2
forgejo=$3
forgejo_pr_or_ref=$4
cd $forgejo
full_version=$(make show-version-full)
minor_version=$(make show-version-minor)
cd $end_to_end
if ! test -f forgejo/sources/$minor_version; then
echo "FAIL: forgejo/sources/$minor_version does not exist in the end-to-end repository"
false
fi
echo -n $minor_version >forgejo/build-from-sources
date >last-upgrade
if test -f "$forgejo_pr_or_ref"; then
forgejo_pr=$forgejo_pr_or_ref
head_url=$(jq --raw-output .head.repo.html_url <$forgejo_pr)
test "$head_url" != null
branch=$(jq --raw-output .head.ref <$forgejo_pr)
test "$branch" != null
echo $head_url $branch $full_version >forgejo/sources/$minor_version
else
forgejo_ref=$forgejo_pr_or_ref
echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY ${forgejo_ref#refs/heads/} $full_version >forgejo/sources/$minor_version
fi