refactor end-to-end.yml workflow to use a top-level end-to-end.sh
This commit is contained in:
parent
62f75aa56f
commit
bf689a2478
9 changed files with 142 additions and 74 deletions
24
lib/lib.sh
24
lib/lib.sh
|
@ -29,6 +29,7 @@ RELEASE_NUMBERS="7.0"
|
|||
PREFIX===============
|
||||
HOST_PORT=$IP:3000
|
||||
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
|
||||
: ${FORGEJO_USER:=root}
|
||||
|
@ -70,8 +71,13 @@ function dependencies() {
|
|||
|
||||
function build_all() {
|
||||
for dev in $RELEASE_NUMBERS ; do
|
||||
log_info $dev-dev
|
||||
$LIB_DIR/build.sh $dev $DIR
|
||||
local forgejo=$DIR_BINARIES/forgejo-$dev-dev
|
||||
if test -f $forgejo ; then
|
||||
log_info $dev already exists
|
||||
else
|
||||
$LIB_DIR/build.sh $dev $DIR_BINARIES
|
||||
log_info $dev built from sources
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -108,18 +114,18 @@ function full_version() {
|
|||
function download() {
|
||||
local version=$1
|
||||
|
||||
if ! test -f $DIR/forgejo-$version ; then
|
||||
mkdir -p $DIR
|
||||
if ! test -f $DIR_BINARIES/forgejo-$version ; then
|
||||
mkdir -p $DIR_BINARIES
|
||||
for owner in forgejo forgejo-experimental forgejo-integration ; do
|
||||
full_version=$(full_version $version $owner)
|
||||
if test "$full_version" = "" ; then
|
||||
continue
|
||||
fi
|
||||
if wget -O $DIR/forgejo-$version --quiet https://codeberg.org/$owner/forgejo/releases/download/v$full_version/forgejo-$full_version-linux-amd64 ; then
|
||||
if wget -O $DIR_BINARIES/forgejo-$version --quiet https://codeberg.org/$owner/forgejo/releases/download/v$full_version/forgejo-$full_version-linux-amd64 ; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -s $DIR/forgejo-$version ; then
|
||||
if test -s $DIR_BINARIES/forgejo-$version ; then
|
||||
if test "$version" != "$full_version" ; then
|
||||
log_info "downloaded $full_version for $version"
|
||||
fi
|
||||
|
@ -127,7 +133,7 @@ function download() {
|
|||
echo unable to download Forgejo $version
|
||||
return 1
|
||||
fi
|
||||
chmod +x $DIR/forgejo-$version
|
||||
chmod +x $DIR_BINARIES/forgejo-$version
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -147,7 +153,7 @@ function start_forgejo() {
|
|||
|
||||
download $version
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
daemon --chdir=$DIR --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --pidfile=$DIR/forgejo-pid --errlog=$DIR/forgejo-err.log --output=$DIR/forgejo-out.log -- $DIR/forgejo-$version --config $work_path/app.ini --work-path $work_path
|
||||
daemon --chdir=$DIR --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --pidfile=$DIR/forgejo-pid --errlog=$DIR/forgejo-err.log --output=$DIR/forgejo-out.log -- $DIR_BINARIES/forgejo-$version --config $work_path/app.ini --work-path $work_path
|
||||
if ! retry grep 'Starting server on' $work_path/log/forgejo.log ; then
|
||||
grep '' $DIR/*.log
|
||||
grep '' $work_path/log/*.log 2> /dev/null
|
||||
|
@ -247,7 +253,7 @@ function create_user_and_login() {
|
|||
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
local email="$FORGEJO_USER@example.com"
|
||||
local cli="$DIR/forgejo-$version --config $work_path/app.ini --work-path $work_path"
|
||||
local cli="$DIR_BINARIES/forgejo-$version --config $work_path/app.ini --work-path $work_path"
|
||||
if ! $cli admin user list | grep --quiet "$email" ; then
|
||||
$cli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email $email
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue