mirror of
https://code.forgejo.org/actions/cascading-pr.git
synced 2025-06-27 20:33:44 +00:00
move tests
This commit is contained in:
parent
ccf1ec2ffb
commit
95aee3f580
2 changed files with 1 additions and 1 deletions
96
tests/run.sh
Executable file
96
tests/run.sh
Executable file
|
@ -0,0 +1,96 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
VERBOSE=false
|
||||
DEBUG=false
|
||||
: ${EXIT_ON_ERROR:=true}
|
||||
|
||||
function debug() {
|
||||
DEBUG=true
|
||||
set -x
|
||||
PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: '
|
||||
}
|
||||
|
||||
function verbose() {
|
||||
VERBOSE=true
|
||||
}
|
||||
|
||||
function log() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
function log_error() {
|
||||
log "$@"
|
||||
}
|
||||
|
||||
function log_verbose() {
|
||||
if $VERBOSE ; then
|
||||
log "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function log_info() {
|
||||
log "$@"
|
||||
}
|
||||
|
||||
function fatal_error() {
|
||||
log_error "$@"
|
||||
if $EXIT_ON_ERROR ; then
|
||||
exit 1
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function push_self() {
|
||||
local host_port=$1
|
||||
|
||||
forgejo-test-helper.sh push_self_action http://root:admin1234@$host_port root cascading-pr vTest
|
||||
}
|
||||
|
||||
function run() {
|
||||
local host_port=$1 url=$2 token=$3
|
||||
|
||||
push_self $host_port
|
||||
|
||||
echo do something
|
||||
}
|
||||
|
||||
function main() {
|
||||
local command=run
|
||||
local host_port=$(cat forgejo-ip):3000
|
||||
local url=http://$host_port
|
||||
local token=$(cat forgejo-token)
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--verbose)
|
||||
shift
|
||||
verbose
|
||||
;;
|
||||
--debug)
|
||||
shift
|
||||
debug
|
||||
;;
|
||||
--host_port)
|
||||
shift
|
||||
host_port=$1
|
||||
;;
|
||||
--url)
|
||||
shift
|
||||
url=$1
|
||||
;;
|
||||
--token)
|
||||
shift
|
||||
token=$1
|
||||
;;
|
||||
*)
|
||||
"${1:-run}" "$host_port" "$url" "$token"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
${MAIN:-main} "${@}"
|
Loading…
Add table
Add a link
Reference in a new issue