merge actions test into end-to-end.sh

* replace the high level test running actions tests with end-to-end.sh
* set DOMAIN to the IP instead of 127.0.0.1 for runner <-> forgejo communications
* move forgejo_cli from a function to a file so that it can be used by forgejo-runner.sh
* keep the documentation updates workflows separate because they need to open one PR per version
This commit is contained in:
Twenty Panda 2024-03-20 11:51:46 +01:00
parent 5bb5e037ce
commit 96f91063c9
21 changed files with 235 additions and 269 deletions

View file

@ -30,24 +30,24 @@ Action](https://forgejo.org/docs/v1.21/user/actions/) which is meant
to be used in workflows. However, it is implemented as shell scripts that
can also be used to create Forgejo instances and runners locally. This
is convenient for testing and the reason why it needs to be added to the PATH.
For instance, it is a dependency of the `actions/run.sh` script.
For instance, it is a dependency of the `end-to-end.sh` script.
```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
export DIR=/tmp/forgejo-end-to-end
rm -fr /tmp/forgejo-end-to-end ; sudo rm -fr /srv/example ; sudo mkdir /srv/example ; sudo chown -R $USER /srv/example
```
Run using Forgejo built from source.
## Running from locally built binary
```sh
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
cp -a forgejo $DIR/forgejo
cp -a forgejo /srv/forgejo-binaries/forgejo-7.0-dev
```
It will be used whenver the version `7.0-dev` is specified in a test.
## Running actions locally
To run and debug workflows from `actions/example-*`, from the root of
@ -58,43 +58,12 @@ 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.
Run one example
```sh
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 cron # runs actions/example-cron
./end-to-end.sh actions_setup 1.21
firefox 0.0.0.0:3000 # user root / admin1234
./end-to-end.sh actions_verify_example artifacts
./end-to-end.sh actions_teardown
```
Cleanup. It will teardown Forgejo & the runner and not run them because there is nothing to test.
```sh
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0 none
```
Run all examples for v7_0
```sh
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v7.0.0-test/forgejo-7.0.0-test-linux-amd64 v7.0.0-test v7_0
```
Run from sources
```sh
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
cp -a forgejo $DIR/forgejo
```
Remote testing
To reduce the runtime the following variables can be set to control
the number of cases run by the
[actions](.forgejo/workflows/actions.yml) tests. If set to
**none** they are not run at all for that version of Forgejo. If
it does not exist, all tests are run.
* `v7_0_TESTS`
* `V1_21_TESTS`
* `V1_20_TESTS`
## Running other tests locally
To run and debug tests, from the root of the source directory.
@ -102,12 +71,12 @@ To run and debug tests, from the root of the source directory.
Run one test. When the test fails the instance can be inspected at http://0.0.0.0:3000
```sh
VERBOSE=true ./forgejo/upgrades/test-upgrade.sh test_packages_alpine
VERBOSE=true ./forgejo/upgrades/test-upgrade.sh test_storage_stable_s3 minio
./end-to-end.sh test_packages_alpine
./end-to-end.sh test_storage_stable_s3 minio
```
Cleanup. It will teardown the Forgejo instance.
```sh
./forgejo/upgrades/test-upgrade.sh stop
./end-to-end.sh stop
```