Merge pull request 'merge actions test into end-to-end.sh' (#112) from twenty-panda/end-to-end:wip-actions into main

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/112
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
This commit is contained in:
earl-warren 2024-03-20 13:18:28 +00:00
commit b8c71e7201
21 changed files with 235 additions and 269 deletions

View file

@ -28,7 +28,7 @@ RELEASE_NUMBERS="7.0"
PREFIX===============
HOST_PORT=$IP:3000
DIR=/tmp/forgejo-end-to-end
export DIR=/tmp/forgejo-end-to-end
DIR_BINARIES=/srv/forgejo-binaries
export DOT_FORGEJO_CURL=$DIR/forgejo-curl
export DOT=$DOT_FORGEJO_CURL # for backward compatibility with forgejo-curl.sh 1.0.0
@ -47,9 +47,9 @@ function dependencies() {
$SUDO chmod +x /usr/local/bin/forgejo-curl.sh
fi
if ! which curl daemon jq git-lfs > /dev/null ; then
if ! which make curl daemon git-lfs jq sqlite3 > /dev/null ; then
$SUDO apt-get update -qq
$SUDO apt-get install -y -qq curl daemon git-lfs jq sqlite3 gettext-base
$SUDO apt-get install -y -qq make curl daemon git-lfs jq sqlite3 gettext-base
fi
if ! test -f /usr/local/bin/mc || ! test -f /usr/local/bin/minio ; then
@ -159,6 +159,8 @@ function start_forgejo() {
grep '' $work_path/log/*.log 2> /dev/null
return 1
fi
echo "$DIR_BINARIES/forgejo-$version --config $work_path/app.ini --work-path $work_path" '"$@"' > $DIR/forgejocli
chmod +x $DIR/forgejocli
create_user_and_login $version
}
@ -238,7 +240,7 @@ function reset_forgejo() {
local work_path=$DIR/forgejo-work-path
rm -fr $work_path
mkdir -p $work_path
WORK_PATH=$work_path envsubst < $config > $work_path/app.ini
IP=$IP WORK_PATH=$work_path envsubst < $config > $work_path/app.ini
}
function reset_minio() {
@ -249,20 +251,12 @@ function reset_garage() {
rm -fr $DIR/garage
}
function forgejo_cli() {
local version="$1"
shift
local work_path=$DIR/forgejo-work-path
$DIR_BINARIES/forgejo-$version --config $work_path/app.ini --work-path $work_path "$@"
}
function create_user_and_login() {
local version=$1
local email="$FORGEJO_USER@example.com"
if ! forgejo_cli $version admin user list | grep --quiet "$email" ; then
forgejo_cli $version admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email $email
if ! $DIR/forgejocli admin user list | grep --quiet "$email" ; then
$DIR/forgejocli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email $email
fi
forgejo-curl.sh logout
@ -309,10 +303,10 @@ function run() {
local fun=$1
shift
echo Start running $fun
echo Start running $fun "$@"
mkdir -p $DIR
> $DIR/$fun.out
tail --follow $DIR/$fun.out | sed --unbuffered -n -e "/^$PREFIX/s/^$PREFIX //p" &
tail --follow $DIR/$fun.out |& sed --unbuffered -n -e "/^$PREFIX/s/^$PREFIX //p" &
local pid=$!
if ! VERBOSE=true $SELF $fun "$@" >& $DIR/$fun.out ; then
kill $pid