From 2db61b4f501c217c4fd45492a343de89285a243d Mon Sep 17 00:00:00 2001 From: username Date: Wed, 8 Nov 2023 15:55:01 +0100 Subject: [PATCH] update hacking instructions --- README.md | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 535b88a..3cdff14 100644 --- a/README.md +++ b/README.md @@ -12,25 +12,39 @@ versions compiled from designated repositories. ## Hacking -### Local testing +To run and debug workflows from `actions/example-*`, from the root of +the source directory, with docker and forgejo-curl.sh installed, mimic +what `.forgejo/workflows/actions.yml` does. There may be some manual +tweaking (such as creating temporary directories) because the tests +run as root in the context of Forgejo Actions and assume they have +admin permissions. But they do not need to run as root and must work +fine when run as a regular user. -To run and debug workflows from `actions/example-*`, from -the root of the source directory, with docker and forgejo-curl.sh -installed, mimic what `.forgejo/workflows/actions.yml` does. There -may be some manual tweaking (such as creating temporary directories) -because the tests run as root, but they do not need to run as root. +### Prepare the Forgejo instance and the runner -* `forgejo-curl.sh logout` -* `forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.21` -* `firefox http://$(cat forgejo-ip):3000` -* `forgejo-runner.sh setup` -* `export example=pull-request` -* `export EXAMPLE_DIR=$(pwd)/actions/example-$example` -* `$EXAMPLE_DIR/setup.sh` # if it exists -* `$EXAMPLE_DIR/run.sh` or -* `forgejo-test-helper.sh run_workflow actions/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token)` -* `forgejo-runner.sh teardown` -* `forgejo.sh teardown` +```sh +git clone https://code.forgejo.org/actions/setup-forgejo +export PATH=$(pwd)/setup-forgejo:$PATH +git clone https://code.forgejo.org/forgejo/end-to-end +cd end-to-end +forgejo-curl.sh logout +forgejo-runner.sh teardown +forgejo.sh teardown +forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.21 +forgejo-runner.sh setup +export url=http://root:admin1234@$(cat forgejo-ip):3000 +export token=$(cat forgejo-token) +``` +### Run a single test + +```sh +export example=pull-request +export EXAMPLE_DIR=$(pwd)/actions/example-$example +sudo rm -fr /srv/example-$example ; mkdir /srv/example-$example +$EXAMPLE_DIR/setup.sh +$EXAMPLE_DIR/run.sh +forgejo-test-helper.sh run_workflow actions/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token) +``` ### Remote testing