80 lines
1.7 KiB
Bash
Executable file
80 lines
1.7 KiB
Bash
Executable file
#!/bin/bash
|
|
# Copyright 2024 The Forgejo Authors
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
source $SELF_DIR/../lib/lib.sh
|
|
|
|
function run() {
|
|
local package=$1
|
|
|
|
bash -ex $SELF_DIR/$package.sh
|
|
}
|
|
|
|
function packages_v1_21() {
|
|
echo 'alpine'
|
|
}
|
|
|
|
function packages_v1_22() {
|
|
packages_v1_21
|
|
}
|
|
|
|
function setup() {
|
|
local binary=$1
|
|
forgejo-binary.sh setup root admin1234 $binary
|
|
}
|
|
|
|
function teardown() {
|
|
forgejo-curl.sh logout
|
|
forgejo-binary.sh teardown
|
|
}
|
|
|
|
function main() {
|
|
local binary="$1"
|
|
shift
|
|
export full_version="$1"
|
|
shift
|
|
export version="$1"
|
|
shift
|
|
|
|
export DOT=$DIR/forgejo-curl
|
|
|
|
teardown
|
|
|
|
if test "$#" = 0 ; then
|
|
packages=$(packages_${version/./_})
|
|
else
|
|
packages="$@"
|
|
fi
|
|
|
|
if test "$packages" = "none" ; then
|
|
exit 0
|
|
fi
|
|
|
|
setup $binary
|
|
|
|
if ! test -f "$DIR/forgejo-auth-url" ; then
|
|
echo "DIR=$DIR must be a directory with a forgejo-auth-url file"
|
|
fi
|
|
|
|
export url=$(cat $DIR/forgejo-auth-url)
|
|
export token=$(cat $DIR/forgejo-token)
|
|
|
|
for package in $packages ; do
|
|
echo "======================== BEGIN package-$package ==================="
|
|
if ! time run $package >& /tmp/run.out ; then
|
|
sed -e 's/^/[RUN] /' < /tmp/run.out
|
|
echo "======================== FAIL package-$package ==================="
|
|
sleep 5 # hack for Forgejo v1.21 to workaround a bug by which the last lines of the output are moved to the next step
|
|
false
|
|
else
|
|
if test "$VERBOSE" = true ; then
|
|
sed -e 's/^/[RUN] /' < /tmp/run.out
|
|
fi
|
|
fi
|
|
echo "======================== END package-$package ==================="
|
|
done
|
|
}
|
|
|
|
main "$@"
|