setup-forgejo/.forgejo/workflows/integration.yml

72 lines
3.3 KiB
YAML

on: [ push, pull_request ]
jobs:
integration:
runs-on: self-hosted
strategy:
matrix:
info:
- version: "1.21.0-2-rc0"
image: codeberg.org/forgejo-experimental/forgejo
# keep "cron" last otherwise it will linger and pollute the following runs
tests: "${{ vars.V121_TESTS || 'echo artifacts service checkout pull-request container expression local-action docker-action if if-fail cron' }}"
- version: "1.20"
image: codeberg.org/forgejo/forgejo
tests: "${{ vars.V120_TESTS || 'echo checkout service container expression local-action docker-action if if-fail' }}"
steps:
- uses: actions/checkout@v3
- if: matrix.info.tests != 'none'
shell: bash
run: |
LXC_IP_PREFIX=10.0.10 ./forgejo-dependencies.sh
export PATH=$(pwd):$PATH
forgejo.sh setup root admin1234 ${{ matrix.info.image }} ${{ matrix.info.version }}
#
# Uncomment the following for a shortcut to debugging the Forgejo runner.
# It will build the runner from a designated repository and branch instead of
# downloading it from a canonical release.
#
#./forgejo-test-helper.sh build_runner http://code.forgejo.org/earl-warren/runner wip-sync
#export PATH=$(pwd)/forgejo-runner:$PATH
#
forgejo-runner.sh setup
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
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_DIR=$(pwd)/testdata/example-$example
if test -f $EXAMPLE_DIR/setup.sh ; then
echo "============================ SETUP example-$example ==================="
bash -ex $EXAMPLE_DIR/setup.sh || return 1
fi
if test -f $EXAMPLE_DIR/run.sh ; then
echo "============================ RUN example-$example ==================="
bash -ex $EXAMPLE_DIR/run.sh || return 1
else
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
fi
if test -f $EXAMPLE_DIR/teardown.sh ; then
echo "============================ TEARDOWN example-$example ==================="
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
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