Fogejo Actions tests
This commit is contained in:
parent
d255395fc8
commit
7ccbeb7a46
34 changed files with 764 additions and 1 deletions
65
.forgejo/workflows/actions.yml
Normal file
65
.forgejo/workflows/actions.yml
Normal file
|
@ -0,0 +1,65 @@
|
|||
on: [ push ]
|
||||
|
||||
jobs:
|
||||
actions:
|
||||
runs-on: self-hosted
|
||||
strategy:
|
||||
matrix:
|
||||
info:
|
||||
- version: "1.21.0-5-rc2"
|
||||
image: codeberg.org/forgejo-experimental/forgejo
|
||||
# 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' }}"
|
||||
- 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' }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: https://code.forgejo.org/actions/setup-forgejo@v1
|
||||
with:
|
||||
install-only: true
|
||||
|
||||
- if: matrix.info.tests != 'none'
|
||||
shell: bash
|
||||
run: |
|
||||
forgejo.sh setup root admin1234 ${{ matrix.info.image }} ${{ matrix.info.version }}
|
||||
forgejo-runner.sh setup
|
||||
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
||||
export url=http://root:admin1234@$(cat forgejo-ip):3000
|
||||
export token=$(cat forgejo-token)
|
||||
|
||||
function run() {
|
||||
local example=$1
|
||||
|
||||
export example
|
||||
export EXAMPLE_DIR=$(pwd)/actions/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 actions/example-$example $url root example-$example setup-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
|
Loading…
Add table
Reference in a new issue