Skip to content

Commit 8eda2e4

Browse files
earl-warrenearl-warren
authored andcommitted
chore: rework the README (#903)
- Explain how to run tests locally instead of pointing to the workflow. - Explain how to run lint checks & fix locally - Replace the `forgejo-setup` based instructions with shorter and more actionable instructions based out of the end-to-end tests. - Remove the reporting bug section, the issue template has all the information it needs. It is unlikely that someone reporting a bug will read that section in the README before filing the bug. It removes the suggestion to file a bug in the end-to-end repository but I don't think it was actually beneficial to anyone in the past two years. - Remove the mock generation part as it is now self documented in the job that takes care of it. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/903): <!--number 903 --><!--line 0 --><!--description Y2hvcmU6IHJld29yayB0aGUgUkVBRE1FIFtza2lwIGNhc2NhZGVd-->chore: rework the README [skip cascade]<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/903 Reviewed-by: Gusted <[email protected]> Reviewed-by: Mathieu Fenniak <[email protected]> Co-authored-by: Earl Warren <[email protected]> Co-committed-by: Earl Warren <[email protected]>
1 parent d2b3916 commit 8eda2e4

File tree

1 file changed

+27
-70
lines changed

1 file changed

+27
-70
lines changed

README.md

Lines changed: 27 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
A daemon that connects to a Forgejo instance and runs jobs for continuous integration. The [installation and usage instructions](https://forgejo.org/docs/next/admin/actions/) are part of the Forgejo documentation.
44

5-
# Reporting bugs
6-
7-
When filing a bug in [the issue tracker](https://code.forgejo.org/forgejo/runner/issues), it is very helpful to propose a pull request [in the end-to-end tests](https://code.forgejo.org/forgejo/end-to-end/src/branch/main/actions) repository that adds a reproducer. It will fail the CI and unambiguously demonstrate that the problem exists. In most cases it is enough to add a workflow ([see the echo example](https://code.forgejo.org/forgejo/end-to-end/src/branch/main/actions/example-echo)). For more complicated cases it is also possible to add a runner config file as well as shell scripts to setup and teardown the test case ([see the service example](https://code.forgejo.org/forgejo/end-to-end/src/branch/main/actions/example-service)).
5+
# Reporting security-related issues
86

97
Sensitive security-related issues should be reported to [[email protected]](mailto:[email protected]) using [encryption](https://keyoxide.org/[email protected]).
108

11-
129
## License
1310

1411
The Forgejo runner source code is distributed under the terms of the following licenses:
@@ -36,77 +33,37 @@ The Forgejo runner is a dependency of the [setup-forgejo action](https://code.fo
3633
- Install [Go](https://go.dev/doc/install) and `make(1)`
3734
- `make build`
3835

39-
The [test workflow](.forgejo/workflows/test.yml) is a full example that builds the binary, runs the tests and launches the runner binary against a live Forgejo instance.
40-
41-
## Generate mocks
42-
43-
- `make deps-tools`
44-
- `make generate`
45-
46-
If there are changes, commit them to the repository.
47-
48-
## Local debug
49-
50-
The repositories are checked out in the same directory:
51-
52-
- **runner**: [Forgejo runner](https://code.forgejo.org/forgejo/runner)
53-
- **setup-forgejo**: [setup-forgejo](https://code.forgejo.org/actions/setup-forgejo)
54-
55-
### Install dependencies
56-
57-
The dependencies are installed manually or with:
36+
## Linting
5837

59-
```shell
60-
setup-forgejo/forgejo-dependencies.sh
61-
```
62-
63-
### Build the Forgejo runner
64-
65-
```shell
66-
cd runner ; rm -f forgejo-runner ; make forgejo-runner
67-
```
68-
69-
### Launch Forgejo and the runner
38+
- `make lint-check`
39+
- `make lint` # will fix some lint errors
7040

71-
A Forgejo instance is launched with:
41+
## Testing
7242

73-
```shell
74-
cd setup-forgejo
75-
./forgejo.sh setup
76-
firefox $(cat forgejo-url)
77-
```
43+
The [workflow](.forgejo/workflows/test.yml) that runs in the CI uses similar commands.
7844

79-
The user is `root` with password `admin1234`. The runner is registered with:
45+
### Without a Forgejo instance
8046

81-
```
82-
cd setup-forgejo
83-
docker exec --user 1000 forgejo forgejo actions generate-runner-token > forgejo-runner-token
84-
../runner/forgejo-runner register --no-interactive --instance "$(cat forgejo-url)" --name runner --token $(cat forgejo-runner-token) --labels docker:docker://node:22-bookworm,self-hosted:host,lxc:lxc://debian:bookworm
85-
```
47+
- Install [Docker](https://docs.docker.com/engine/install/)
48+
- `make test integration-test`
8649

87-
And launched with:
88-
89-
```shell
90-
cd setup-forgejo ; ../runner/forgejo-runner --config runner-config.yml daemon
91-
```
50+
### With a Forgejo instance
9251

93-
Note that the `runner-config.yml` is required in that particular case
94-
to configure the network in `bridge` mode, otherwise the runner will
95-
create a network that cannot reach the forgejo instance.
96-
97-
### Try a sample workflow
98-
99-
From the Forgejo web interface, create a repository and add the
100-
following to `.forgejo/workflows/try.yaml`. It will launch the job and
101-
the result can be observed from the `actions` tab.
102-
103-
```yaml
104-
on: [push]
105-
jobs:
106-
ls:
107-
runs-on: docker
108-
steps:
109-
- uses: actions/checkout@v4
110-
- run: |
111-
ls ${{ github.workspace }}
52+
- Run a Forgejo instance locally (for instance at http://0.0.0.0:8080) and create as shared secret
53+
```sh
54+
export FORGEJO_RUNNER_SECRET='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
55+
export FORGEJO_URL=http://0.0.0.0:8080
56+
forgejo forgejo-cli actions register --labels docker --name therunner --secret $FORGEJO_RUNNER_SECRET
11257
```
58+
- `make test integration-test` # which will run addional tests because FORGEJO_URL is set
59+
60+
### end-to-end
61+
62+
- Follow the instructions from the end-to-end tests to [run actions tests locally](https://code.forgejo.org/forgejo/end-to-end#running-from-locally-built-binary).
63+
- `./end-to-end.sh actions_teardown` # stop the Forgejo and runner daemons running in the end-to-end environment
64+
- `( cd ~/clone-of-the-runner-repo ; make build ; cp forgejo-runner /tmp/forgejo-end-to-end/forgejo-runner )` # install the runner built from sources
65+
- `./end-to-end.sh actions_setup 13.0` # start Forgejo v13.0 and the runner daemon in the end-to-end environment
66+
- `./end-to-end.sh actions_verify_example echo` # run the [echo workflow](https://code.forgejo.org/forgejo/end-to-end/src/branch/main/actions/example-echo/.forgejo/workflows/test.yml)
67+
- `xdg-open http://127.0.0.1:3000/root/example-echo/actions/runs/1` # see the logs workflow
68+
- `less /tmp/forgejo-end-to-end/forgejo-runner.log` # analyze the runner logs
69+
- `less /tmp/forgejo-end-to-end/forgejo-work-path/log/forgejo.log` # analyze the Forgejo logs

0 commit comments

Comments
 (0)