mirror of
https://code.forgejo.org/actions/setup-forgejo
synced 2025-06-08 03:58:19 +02:00
add example of cron task
This commit is contained in:
parent
b081450249
commit
7e8c8064af
12 changed files with 102 additions and 41 deletions
|
@ -1,31 +1,24 @@
|
|||
on: [ push, pull_request ]
|
||||
|
||||
env:
|
||||
#
|
||||
# List of tests to run as found in testdata/example-$test. The
|
||||
# directory will be used to create a git repository uploaded to a
|
||||
# Forgejo instance.
|
||||
#
|
||||
# The test will be a success once the status of
|
||||
# the commit is success, as set by the Forgejo Action run.
|
||||
#
|
||||
TESTS: 'echo service container expression local-action docker-action if'
|
||||
#
|
||||
# The test is expected to fail the workflow and verify the expected
|
||||
# side effect of the failure with testdata/example-$test/expected-to-fail.sh
|
||||
#
|
||||
TESTS_FAILING: 'if-fail'
|
||||
|
||||
jobs:
|
||||
integration:
|
||||
runs-on: self-hosted
|
||||
strategy:
|
||||
matrix:
|
||||
info:
|
||||
- version: "1.21.0-0-rc0"
|
||||
image: codeberg.org/forgejo-experimental/forgejo
|
||||
tests: "echo cron service container expression local-action docker-action if if-fail"
|
||||
- version: "1.20"
|
||||
image: codeberg.org/forgejo/forgejo
|
||||
tests: "echo service container expression local-action docker-action if if-fail"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: |
|
||||
set -x
|
||||
LXC_IP_PREFIX=10.0.10 ./forgejo-dependencies.sh
|
||||
export PATH=$(pwd):$PATH
|
||||
forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.20
|
||||
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
|
||||
|
@ -34,33 +27,29 @@ jobs:
|
|||
#./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
|
||||
forgejo-runner.sh setup
|
||||
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
||||
|
||||
for example in $TESTS $TESTS_FAILING ; do
|
||||
for example in ${{ matrix.info.tests }} ; do
|
||||
export EXAMPLE_DIR=$(pwd)/testdata/example-$example
|
||||
|
||||
if test $example = service ; then
|
||||
> /srv/example-service-volume-valid
|
||||
> /srv/example-service-volume-invalid
|
||||
fi
|
||||
|
||||
config=$(pwd)/testdata/example-$example/runner-config.yaml
|
||||
if test -f $config ; then
|
||||
FORGEJO_RUNNER_CONFIG=$config ./forgejo-runner.sh reload
|
||||
if test -f $EXAMPLE_DIR/setup.sh ; then
|
||||
source $EXAMPLE_DIR/setup.sh
|
||||
fi
|
||||
|
||||
echo "============================ BEGIN example-$example ==================="
|
||||
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
|
||||
cat /tmp/run.out
|
||||
! test -f testdata/example-$example/expected-to-fail.sh
|
||||
if test -f $EXAMPLE_DIR/run.sh ; then
|
||||
source $EXAMPLE_DIR/run.sh
|
||||
else
|
||||
cat /tmp/run.out
|
||||
test -f testdata/example-$example/expected-to-fail.sh
|
||||
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
|
||||
cat /tmp/run.out
|
||||
false
|
||||
fi
|
||||
fi
|
||||
echo "============================ END example-$example ==================="
|
||||
|
||||
if test -f $config ; then
|
||||
./forgejo-runner.sh reload
|
||||
if test -f $EXAMPLE_DIR/teardown.sh ; then
|
||||
source $EXAMPLE_DIR/teardown.sh
|
||||
fi
|
||||
done
|
||||
echo "============================ demo ==================="
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue