update hacking instructions

This commit is contained in:
username 2023-11-08 15:55:01 +01:00
parent b5c5c6b4d5
commit 2db61b4f50
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -12,25 +12,39 @@ versions compiled from designated repositories.
## Hacking ## 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 ### Prepare the Forgejo instance and the runner
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.
* `forgejo-curl.sh logout` ```sh
* `forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.21` git clone https://code.forgejo.org/actions/setup-forgejo
* `firefox http://$(cat forgejo-ip):3000` export PATH=$(pwd)/setup-forgejo:$PATH
* `forgejo-runner.sh setup` git clone https://code.forgejo.org/forgejo/end-to-end
* `export example=pull-request` cd end-to-end
* `export EXAMPLE_DIR=$(pwd)/actions/example-$example` forgejo-curl.sh logout
* `$EXAMPLE_DIR/setup.sh` # if it exists forgejo-runner.sh teardown
* `$EXAMPLE_DIR/run.sh` or forgejo.sh teardown
* `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.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.21
* `forgejo-runner.sh teardown` forgejo-runner.sh setup
* `forgejo.sh teardown` 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 ### Remote testing