packages: add alpine test cases

This commit is contained in:
Earl Warren 2024-01-24 00:03:34 +01:00
parent d825dac67e
commit 74d11b5eaf
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
10 changed files with 305 additions and 10 deletions

76
packages/run.sh Executable file
View file

@ -0,0 +1,76 @@
#!/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
fi
echo "======================== END package-$package ==================="
done
}
main "$@"