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

74 lines
3.3 KiB
YAML
Raw Normal View History

2023-04-01 08:52:42 -04:00
on: [ push, pull_request ]
2023-07-08 08:06:13 -04:00
2023-03-24 10:59:04 -04:00
jobs:
integration:
runs-on: self-hosted
2023-09-24 14:32:40 -04:00
strategy:
matrix:
info:
2023-10-04 09:42:53 -04:00
- version: "1.21.0-2-rc0"
2023-09-24 14:32:40 -04:00
image: codeberg.org/forgejo-experimental/forgejo
2023-10-04 11:57:11 -04:00
# keep "cron" last otherwise it will linger and pollute the following runs
tests: "${{ vars.V1_21_TESTS || 'echo push-cancel artifacts service checkout pull-request container expression local-action docker-action if if-fail cron' }}"
2023-09-24 14:32:40 -04:00
- version: "1.20"
image: codeberg.org/forgejo/forgejo
tests: "${{ vars.V1_20_TESTS || 'echo checkout service container expression local-action docker-action if if-fail' }}"
2023-03-24 10:59:04 -04:00
steps:
2023-03-24 17:42:52 -04:00
- uses: actions/checkout@v3
2023-09-29 14:19:00 -04:00
- if: matrix.info.tests != 'none'
2023-10-04 12:11:42 -04:00
shell: bash
2023-09-29 14:19:00 -04:00
run: |
LXC_IP_PREFIX=10.0.10 ./forgejo-dependencies.sh
2023-09-24 10:54:52 -04:00
export PATH=$(pwd):$PATH
2023-09-24 14:32:40 -04:00
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
#
2023-09-24 14:32:40 -04:00
forgejo-runner.sh setup
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
url=http://root:admin1234@$(cat forgejo-ip):3000
token=$(cat forgejo-token)
2023-10-04 12:11:42 -04:00
echo "============================ demo ==================="
forgejo-test-helper.sh run_workflow testdata/demo $url root demo setup-forgejo $token
2023-10-04 12:11:42 -04:00
function run() {
local example=$1
2023-09-26 15:53:30 -04:00
export example
2023-09-24 14:32:40 -04:00
export EXAMPLE_DIR=$(pwd)/testdata/example-$example
2023-09-24 14:32:40 -04:00
if test -f $EXAMPLE_DIR/setup.sh ; then
2023-10-04 12:11:42 -04:00
echo "============================ SETUP example-$example ==================="
bash -ex $EXAMPLE_DIR/setup.sh || return 1
2023-07-08 08:06:13 -04:00
fi
2023-09-24 14:32:40 -04:00
if test -f $EXAMPLE_DIR/run.sh ; then
2023-10-04 12:11:42 -04:00
echo "============================ RUN example-$example ==================="
bash -ex $EXAMPLE_DIR/run.sh || return 1
else
forgejo-test-helper.sh run_workflow testdata/example-$example $url root example-$example setup-forgejo $token || return 1
fi
2023-09-24 14:32:40 -04:00
if test -f $EXAMPLE_DIR/teardown.sh ; then
2023-10-04 12:11:42 -04:00
echo "============================ TEARDOWN example-$example ==================="
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
2023-07-08 08:06:13 -04:00
fi
2023-10-04 12:11:42 -04:00
}
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 ==================="
2023-05-29 09:26:29 -04:00
done