mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-24 00:00:56 -05:00
better verbosity for integration tests
This commit is contained in:
parent
eaecaaa2e6
commit
65714b4555
3 changed files with 27 additions and 20 deletions
|
@ -16,8 +16,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- if: matrix.info.tests != 'none'
|
- if: matrix.info.tests != 'none'
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -x
|
|
||||||
LXC_IP_PREFIX=10.0.10 ./forgejo-dependencies.sh
|
LXC_IP_PREFIX=10.0.10 ./forgejo-dependencies.sh
|
||||||
export PATH=$(pwd):$PATH
|
export PATH=$(pwd):$PATH
|
||||||
forgejo.sh setup root admin1234 ${{ matrix.info.image }} ${{ matrix.info.version }}
|
forgejo.sh setup root admin1234 ${{ matrix.info.image }} ${{ matrix.info.version }}
|
||||||
|
@ -32,29 +32,41 @@ jobs:
|
||||||
forgejo-runner.sh setup
|
forgejo-runner.sh setup
|
||||||
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
||||||
|
|
||||||
for example in ${{ matrix.info.tests }} ; do
|
echo "============================ demo ==================="
|
||||||
|
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output
|
||||||
|
grep '^sha=' /tmp/output
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
local example=$1
|
||||||
|
|
||||||
export example
|
export example
|
||||||
export EXAMPLE_DIR=$(pwd)/testdata/example-$example
|
export EXAMPLE_DIR=$(pwd)/testdata/example-$example
|
||||||
|
|
||||||
if test -f $EXAMPLE_DIR/setup.sh ; then
|
if test -f $EXAMPLE_DIR/setup.sh ; then
|
||||||
$EXAMPLE_DIR/setup.sh
|
echo "============================ SETUP example-$example ==================="
|
||||||
|
bash -ex $EXAMPLE_DIR/setup.sh || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "============================ BEGIN example-$example ==================="
|
|
||||||
if test -f $EXAMPLE_DIR/run.sh ; then
|
if test -f $EXAMPLE_DIR/run.sh ; then
|
||||||
$EXAMPLE_DIR/run.sh
|
echo "============================ RUN example-$example ==================="
|
||||||
|
bash -ex $EXAMPLE_DIR/run.sh || return 1
|
||||||
else
|
else
|
||||||
if ! forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token) >& /tmp/run.out ; then
|
forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token) || return 1
|
||||||
cat /tmp/run.out
|
|
||||||
false
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
echo "============================ END example-$example ==================="
|
|
||||||
|
|
||||||
if test -f $EXAMPLE_DIR/teardown.sh ; then
|
if test -f $EXAMPLE_DIR/teardown.sh ; then
|
||||||
$EXAMPLE_DIR/teardown.sh
|
echo "============================ TEARDOWN example-$example ==================="
|
||||||
|
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
for example in ${{ matrix.info.tests }} ; do
|
||||||
|
echo "============================ BEGIN example-$example ==================="
|
||||||
|
if ! time run $example >& /tmp/run.out ; then
|
||||||
|
cat /tmp/run.out
|
||||||
|
echo "============================ FAIL example-$example ==================="
|
||||||
|
sleep 5 # hack for Forgejo v1.21 to workaround a but by which the last lines of the output are moved to the next step
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
echo "============================ END example-$example ==================="
|
||||||
done
|
done
|
||||||
echo "============================ demo ==================="
|
|
||||||
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output
|
|
||||||
grep '^sha=' /tmp/output
|
|
||||||
|
|
5
testdata/example-if-fail/run.sh
vendored
5
testdata/example-if-fail/run.sh
vendored
|
@ -1,7 +1,4 @@
|
||||||
if forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token) >& /tmp/run.out ; then
|
! forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token)
|
||||||
cat /tmp/run.out
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
|
|
||||||
grep --quiet 'IF TEST FAILURE' $FORGEJO_RUNNER_LOGS
|
grep --quiet 'IF TEST FAILURE' $FORGEJO_RUNNER_LOGS
|
||||||
grep --quiet 'IF TEST ALWAYS' $FORGEJO_RUNNER_LOGS
|
grep --quiet 'IF TEST ALWAYS' $FORGEJO_RUNNER_LOGS
|
||||||
|
|
2
testdata/example-pull-request/run.sh
vendored
2
testdata/example-pull-request/run.sh
vendored
|
@ -1,5 +1,3 @@
|
||||||
set -e
|
|
||||||
|
|
||||||
url=http://root:admin1234@$(cat forgejo-ip):3000
|
url=http://root:admin1234@$(cat forgejo-ip):3000
|
||||||
api=$url/api/v1
|
api=$url/api/v1
|
||||||
export d=/srv/example-pull-request
|
export d=/srv/example-pull-request
|
||||||
|
|
Loading…
Reference in a new issue