Compare commits

..

300 commits

Author SHA1 Message Date
cascading-pr
089d35d1dc cascading-pr update 2025-02-09 00:51:52 +00:00
cascading-pr
857cdc9f29 cascading-pr update 2025-02-09 00:37:52 +00:00
cascading-pr
ffa53456cd cascading-pr update 2025-02-08 10:04:24 +00:00
cascading-pr
2313439ade cascading-pr update 2025-02-08 09:57:46 +00:00
cascading-pr
55391ea452 cascading-pr update 2025-02-08 07:02:21 +00:00
cascading-pr
c877850dee cascading-pr update 2025-02-08 00:47:27 +00:00
cascading-pr
d1e4ada7b4 cascading-pr update 2025-02-08 00:45:22 +00:00
cascading-pr
a2e31f300e cascading-pr update 2025-02-07 00:48:06 +00:00
cascading-pr
ada284d308 cascading-pr update 2025-02-07 00:44:48 +00:00
cascading-pr
e35337144a cascading-pr update 2025-02-06 16:43:21 +00:00
cascading-pr
7d8218b965 cascading-pr update 2025-02-06 07:41:59 +00:00
cascading-pr
4beaf10fbb cascading-pr update 2025-02-06 00:42:32 +00:00
cascading-pr
2f597ab499 cascading-pr update 2025-02-05 00:44:54 +00:00
cascading-pr
222d33af0c cascading-pr update 2025-02-05 00:42:42 +00:00
cascading-pr
7a97f04acc cascading-pr update 2025-02-04 00:45:16 +00:00
cascading-pr
03134ba737 cascading-pr update 2025-02-04 00:44:43 +00:00
cascading-pr
9c085b74c4 cascading-pr update 2025-02-03 00:42:57 +00:00
cascading-pr
fc0775ecdb cascading-pr update 2025-02-03 00:40:35 +00:00
cascading-pr
979c0f604d cascading-pr update 2025-02-02 00:39:06 +00:00
cascading-pr
83c3e832d7 cascading-pr update 2025-02-01 00:45:48 +00:00
cascading-pr
c4c44730ee cascading-pr update 2025-02-01 00:42:14 +00:00
cascading-pr
eb4e3df0f1 cascading-pr update 2025-01-31 00:43:04 +00:00
cascading-pr
8005e37122 cascading-pr update 2025-01-31 00:39:29 +00:00
cascading-pr
fcd27fa94f cascading-pr update 2025-01-30 00:45:16 +00:00
cascading-pr
c9a4c320b1 cascading-pr update 2025-01-30 00:41:57 +00:00
cascading-pr
61904c5565 cascading-pr update 2025-01-29 07:04:21 +00:00
cascading-pr
d67c3f64d6 cascading-pr update 2025-01-29 07:04:13 +00:00
cascading-pr
e86837c658 cascading-pr update 2025-01-29 06:57:05 +00:00
cascading-pr
12d13427a9 cascading-pr update 2025-01-28 00:46:12 +00:00
cascading-pr
8b33ac7b01 cascading-pr update 2025-01-27 00:37:22 +00:00
earl-warren
6717b76117
Merge pull request 'feat: actions: verify that container.options --hostname is valid' (#505) from earl-warren/end-to-end:wip-options-hostname into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/505
2025-01-22 23:13:07 +00:00
Renovate Bot
a3388d98dc
Update https://code.forgejo.org/actions/setup-forgejo action to v2.0.7 (#509)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [https://code.forgejo.org/actions/setup-forgejo](https://code.forgejo.org/actions/setup-forgejo) | action | patch | `v2.0.6` -> `v2.0.7` |

---

### Release Notes

<details>
<summary>actions/setup-forgejo (https://code.forgejo.org/actions/setup-forgejo)</summary>

### [`v2.0.7`](https://code.forgejo.org/actions/setup-forgejo/compare/v2.0.6...v2.0.7)

[Compare Source](https://code.forgejo.org/actions/setup-forgejo/compare/v2.0.6...v2.0.7)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* 0-3 * * *" (UTC), Automerge - "* 0-3 * * *" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMTcuMiIsInVwZGF0ZWRJblZlciI6IjM5LjExNy4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/509
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-01-22 23:09:03 +00:00
Renovate Bot
3275d464e5
Update https://code.forgejo.org/actions/setup-forgejo action to v2.0.7 2025-01-22 23:45:00 +01:00
Earl Warren
ff2c6790b3
feat: actions: verify that container.options --hostname is valid
Refs: https://code.forgejo.org/forgejo/act/pulls/95
2025-01-22 18:46:02 +01:00
earl-warren
925c936032 Merge pull request 'fix: catch warnings and errors' (#493) from earl-warren/end-to-end:wip-upgrades into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/493
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-16 20:48:36 +00:00
Earl Warren
5f9ea45844
fix: catch warnings and errors 2025-01-16 19:27:44 +01:00
earl-warren
ba6c49b79b Merge pull request 'feat: v9.0 is EOL and v11.0 needs testing' (#492) from earl-warren/end-to-end:wip-upgrades into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/492
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-16 09:53:04 +00:00
Earl Warren
80b6d688d0
feat: v9.0 is EOL and v11.0 needs testing 2025-01-16 09:43:45 +01:00
earl-warren
46bfc4e4d7 Merge pull request 'Update actions/setup-forgejo action to v2.0.6' (#489) from renovate/actions-setup-forgejo-2.x into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/489
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2025-01-16 06:26:29 +00:00
Renovate Bot
faaa390f15
Update actions/setup-forgejo action to v2.0.6 2025-01-16 00:01:54 +00:00
earl-warren
46ca949012 Merge pull request 'fix: upgrade must use code.forgejo.org/oci' (#483) from earl-warren/end-to-end:wip-upgrades into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/483
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-15 12:43:00 +00:00
Earl Warren
5c2eebc521
fix: upgrade must use code.forgejo.org/oci
Otherwise it may get rate limited in the CI verifying it works
2025-01-15 13:18:50 +01:00
earl-warren
37572630e8 Merge pull request 'feat: use alpine 3.21 and forgejo 10.0' (#478) from earl-warren/end-to-end:wip-packages into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/478
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-13 06:28:56 +00:00
earl-warren
fca9278771 Merge pull request 'fix: use code.forgejo.org instead of docker.io' (#477) from earl-warren/end-to-end:wip-docker into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/477
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-13 06:28:44 +00:00
Earl Warren
135bd00a26
feat: use alpine 3.21 and forgejo 10.0
and no longer alpine 3.19 and forgejo 9.0
2025-01-13 06:05:00 +01:00
Earl Warren
beae8629a6
fix: use code.forgejo.org instead of docker.io
to avoid throttling

Fixes: https://code.forgejo.org/forgejo/end-to-end/actions/runs/2316
2025-01-13 05:30:48 +01:00
earl-warren
eebf6a1062 Merge pull request 'actions: force-rebuild must use a copy of the repository' (#474) from earl-warren/end-to-end:wip-force-rebuild into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/474
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-12 07:46:53 +00:00
Earl Warren
adb09f901b
actions: force-rebuild use code.forgejo.org/oci to avoid throttling 2025-01-12 08:21:50 +01:00
Earl Warren
65e3fafd02
actions: force-rebuild must use a copy of the repository
it may not have permission to write on the repository itself, nor
should it.
2025-01-12 08:06:46 +01:00
earl-warren
3d53d7f99e Merge pull request 'Update actions/setup-forgejo action to v2.0.5' (#471) from renovate/actions-setup-forgejo-2.x into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/471
2025-01-11 18:40:11 +00:00
earl-warren
ae389fc5a2 Merge pull request 'chore(cleanup): log compression test does not belong' (#470) from earl-warren/end-to-end:wip-compress into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/470
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-11 18:21:26 +00:00
Renovate Bot
734eb7de64
Update actions/setup-forgejo action to v2.0.5 2025-01-11 18:18:13 +00:00
Earl Warren
dacb3b0fac
chore(cleanup): log compression test does not belong
It is a feature and best tested in Forgejo itself, not in
end-to-end. It is a recurring source of false negative and there is
little to no value is fixing the associated border case because it
only applies to short lived Forgejo instances used during tests.

Fixes: https://code.forgejo.org/forgejo/end-to-end/issues/431
2025-01-11 18:07:48 +01:00
gratux
dbe50bffc7 add test for force_rebuild (#448)
see also [forgejo/runner #406](https://code.forgejo.org/forgejo/runner/pulls/406)

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/448
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: gratux <gratux@noreply.code.forgejo.org>
Co-committed-by: gratux <gratux@noreply.code.forgejo.org>
2025-01-11 15:27:44 +00:00
earl-warren
5e0b4c6419 Merge pull request 'actions: verify runner config options for the container' (#463) from earl-warren/end-to-end:wip-config-options into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/463
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-01-11 09:58:23 +00:00
Earl Warren
f6f0acae0e
actions: verify runner config options for the container
- is not restricted to --volume (can use --env, etc.)
- --volume is sanitized with valid_volumes
2025-01-11 09:02:39 +01:00
earl-warren
d9edb00c72 Merge pull request 'chore(release): cut branch v11.0' (#437) from earl-warren/end-to-end:wip-10.0 into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/437
2025-01-01 08:44:56 +00:00
Earl Warren
3bfb74d358
chore(release): cut branch v11.0 2025-01-01 08:44:00 +00:00
earl-warren
f2214d547f Merge pull request 'fix: actions: verify the docker_host socket works' (#399) from earl-warren/end-to-end:wip-docker-host into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/399
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-31 19:41:34 +00:00
earl-warren
421cdcb03c Merge pull request 'upgrade: verify that Forgejo upgrades show no migration warnings' (#446) from earl-warren/end-to-end:wip-10.0-migration into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/446
2024-12-30 21:01:51 +00:00
Earl Warren
346b44a198
upgrade: verify that Forgejo upgrades show no migration warnings
Refs: https://codeberg.org/forgejo/forgejo/issues/6389
2024-12-29 16:14:07 +00:00
earl-warren
3de2a36f6c Merge pull request 'feat: verify migration warnings when upgrading from Gitea' (#430) from earl-warren/end-to-end:wip-migration into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/430
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-24 11:25:03 +00:00
earl-warren
c9e68961b1 Merge pull request 'Revert "feat: test FORGEJO_TOKEN"' (#435) from earl-warren/end-to-end:wip-branding into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/435
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-24 09:31:51 +00:00
Earl Warren
186b29a8a0
Revert "feat: test FORGEJO_TOKEN"
This reverts commit af5923c7d4.
2024-12-24 09:56:36 +01:00
Earl Warren
33d36a0e99
feat: verify migration warnings when upgrading from Gitea 2024-12-22 12:48:09 +01:00
earl-warren
32779c4d6d Merge pull request 'feat: test FORGEJO_TOKEN' (#416) from xtex/forgejo-end-to-end:forgejo-token into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/416
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-12-20 20:27:42 +00:00
xtex
af5923c7d4
feat: test FORGEJO_TOKEN 2024-12-20 17:38:55 +08:00
Earl Warren
d142c4a60d
fix: actions: verify the docker_host socket works
It could be mounted but not functional.
2024-12-08 16:18:15 +01:00
earl-warren
3450de64aa Merge pull request 'Update actions/setup-forgejo action to v2.0.4' (#396) from renovate/actions-setup-forgejo-2.x into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/396
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-12-08 07:43:48 +00:00
Renovate Bot
0a782ec58f
Update actions/setup-forgejo action to v2.0.4 2024-12-08 00:01:21 +00:00
Michael Kriese
ec8c704034 Merge pull request 'fix: do not use api.github.com to avoid being rate limited' (#381) from earl-warren/end-to-end:wip-github into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/381
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-04 13:28:30 +00:00
Earl Warren
6ce90814b2
fix: do not use api.github.com to avoid being rate limited 2024-12-04 14:11:17 +01:00
earl-warren
b12130646b Merge pull request 'Update actions/setup-forgejo action to v2.0.3' (#372) from renovate/actions-setup-forgejo-2.x into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/372
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-11-27 12:26:33 +00:00
Renovate Bot
bc7eb2f245
Update actions/setup-forgejo action to v2.0.3 2024-11-27 12:01:13 +00:00
Earl Warren
77e6412295
fix(actions): documentation update matrix needs prepare_dockerd
It runs all actions tests to collect artefacts relevant to the
documentation and has the same dependencies as running the actions
tests in a pull request.
2024-11-27 10:26:17 +00:00
earl-warren
acb860ef24 Merge pull request 'actions: runner [container].docker_host variations' (#370) from earl-warren/end-to-end:wip-actions-docker into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/370
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-27 09:55:35 +00:00
Earl Warren
33749f5a5e
actions: runner [container].docker_host variations
* automount
* "" or "-"
* unix:///var/run/docker.sock
* tcp://127.0.0.1:2375
2024-11-27 09:33:08 +00:00
earl-warren
801c760a4e Merge pull request 'Update actions/setup-go action to v5' (#365) from renovate/actions-setup-go-5.x into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/365
2024-11-21 13:31:03 +00:00
Renovate Bot
4f84eefa62
Update actions/setup-go action to v5 2024-11-21 13:01:22 +00:00
Michael Kriese
0cbcd6763f Merge pull request 'Configure Renovate' (#360) from renovate/configure into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/360
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-11-21 07:37:23 +00:00
Renovate Bot
48f422b903
Add renovate.json 2024-11-21 07:32:07 +00:00
earl-warren
40906683a3 Merge pull request 'actions: fix: wait for the action logs to show up' (#337) from earl-warren/end-to-end:wip-compression into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/337
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-13 17:08:12 +00:00
Earl Warren
c4b3c61325
actions: fix: wait for the action logs to show up
The Forgejo instance completed the echo test successfully, there must
be a log at some point. But since Forgejo is still running, it may not
had time to write the logs just yet. Retry instead of giving up
immediately.
2024-11-12 15:40:12 +01:00
earl-warren
60e90f5bc0 Merge pull request 'actions: run echo and compression tests first' (#326) from earl-warren/end-to-end:wip-compression into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/326
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-11 08:24:49 +00:00
Earl Warren
8bf5b2c802
actions: run echo and compression tests first 2024-11-11 08:30:01 +01:00
earl-warren
a51b472fef Merge pull request 'fix: update the docs branches' (#322) from earl-warren/end-to-end:wip-docs into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/322
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-10 12:06:35 +00:00
Earl Warren
33f3e7eb65
fix: update the docs branches
Closes forgejo/end-to-end#188
2024-11-10 12:09:05 +01:00
earl-warren
946586b807 Merge pull request 'lib: retry longer to allow for slower machines' (#321) from earl-warren/end-to-end:wip-wait into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/321
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-10 08:29:18 +00:00
Earl Warren
aca70a3e54
lib: retry longer to allow for slower machines
The end-to-end tests moved to a slower machine recently. When the
daily releases are build, the end-to-end all run simultaneously and
slow down the machine to a point where it will take more than 30
seconds for a Forgejo instance to start.

Be more forgiving and let it retry for a minute.

https://code.forgejo.org/forgejo/end-to-end/actions/runs/1857/jobs/6
2024-11-10 08:37:44 +01:00
earl-warren
49e99f95d4 Merge pull request 'Set runner log level to Debug' (#303) from Kwonunn/end-to-end:runner-loglevel into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/303
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-10-28 14:47:56 +00:00
Kwonunn
3433d6ced2 forgot two of the configs 2024-10-28 14:55:49 +01:00
Kwonunn
6508a9e2ca set runner loglevel to debug 2024-10-28 13:52:33 +00:00
earl-warren
2374e25593 Merge pull request 'fix: attempt to avoid database timeouts due to locking' (#295) from Kwonunn/end-to-end:avoid-db-timeout into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/295
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-10-21 06:40:25 +00:00
Kwonunn
3875197a1b fix: attempt to avoid database timeouts due to locking 2024-10-17 11:48:22 +02:00
earl-warren
2db3b373bb Merge pull request 'actions: logs-compression check depends on echo' (#292) from earl-warren/end-to-end:wip-logs-compression into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/292
2024-10-15 12:05:19 +00:00
Earl Warren
f7d1900c5b
actions: logs-compression check depends on echo
There is no guarantee that a test will not reset the actions logs from a
previous test. Since logs-compression depends on the logs from the
echo test, make that dependency explicit.
2024-10-15 13:02:02 +02:00
earl-warren
800cfcc0a8 Merge pull request 'Add test for schedule not being cancelled' (#289) from Kwonunn/end-to-end:schedule-noncancel-test into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/289
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-10-14 05:46:12 +00:00
Kwonunn
222313181f Add schedule-noncancel test to 9.0 suite 2024-10-13 13:57:07 +02:00
Kwonunn
c3eb8918b4 implement waiting based on a file 2024-10-13 12:45:19 +02:00
Kwonunn
631055d190 rewrite schedule cancelling test 2024-10-12 15:11:22 +02:00
Kwonunn
f48fa02916 WIP: Add test for schedule not being cancelled 2024-10-09 15:50:17 +02:00
earl-warren
54f810c1df Merge pull request 'README: update local testing instructions' (#288) from earl-warren/end-to-end:wip-readme into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/288
2024-10-06 15:30:39 +00:00
Earl Warren
294ca18400
README: update local testing instructions 2024-10-06 06:22:58 +02:00
earl-warren
09819336a1 Merge pull request 'v10.0 development cycle started' (#282) from earl-warren/end-to-end:wip-10.0 into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/282
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-09-25 15:16:48 +00:00
Earl Warren
94289bc80d
v10.0 development cycle started 2024-09-25 14:12:49 +02:00
earl-warren
26eefbf61b Merge pull request 'lib: reduce GitLab noise' (#267) from limiting-factor/end-to-end:wip-noise into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/267
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-09-02 10:20:13 +00:00
limiting-factor
1f2f98fb21 lib: reduce GitLab noise
The absence of the test-gitlab container will display

Error response from daemon: No such container: test-gitlab

which can be mistaken as an actual error where in fact it should be
ignored.
2024-09-02 11:45:26 +02:00
earl-warren
4df9a89f4e Merge pull request 'tests: upgrade setup-forgejo to v2.0.2' (#258) from earl-warren/end-to-end:wip-explicit-version into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/258
2024-08-26 06:47:28 +00:00
Earl Warren
427d9ed267
tests: upgrade setup-forgejo to v2.0.2 2024-08-24 08:23:23 +02:00
earl-warren
d3bce65195 Merge pull request 'actions: feature: compression: do not hardcode the log path' (#259) from earl-warren/end-to-end:wip-compression into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/259
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-08-23 15:30:37 +00:00
Earl Warren
75503c5396
actions: feature: compression: do not hardcode the log path
The log path depends on the previous actions run and may not always
be 01/1.log.zst. Assuming it is makes this test fragile as it is
influenced by which previous tests are run and what they do.
2024-08-23 16:53:03 +02:00
earl-warren
812385a18c Merge pull request 'actions: verify the log compression feature' (#246) from earl-warren/end-to-end:wip-actions-log into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/246
2024-08-15 05:15:36 +00:00
Earl Warren
8636471d63
actions: verify the log compression feature
If running Forgejo >= v9.0, verify the logs are compressed by default
2024-08-11 16:47:14 +02:00
earl-warren
5ad828b7a2 Merge pull request 'lib: source build replace the matching release' (#239) from earl-warren/end-to-end:wip-optimize into main
Reviewed-on: https://code.forgejo.org///forgejo/end-to-end/pulls/239
2024-08-08 16:09:23 +00:00
Earl Warren
149c6a545c
lib: source build replace the matching release
Instead of having an explicit vX.Y-dev version to be referenced
explicitly, a binary built from source replaces the matching
version. For instance, if forgejo/build-from-sources contains v9.0,

* the development branch is compiled from source
* the v9.0 artifact is uploaded
* prior to running any test, the artificat is downloaded and used
* the v9.0 binary is not downloaded from
  forgejo/experimental/integration because it is already present

The vX.Y release is built daily and the end-to-end tests run on it. If
a regression is introduced, it will be spotted within 24h.

Compiling from source is used when the Forgejo runs the end-to-end
suite on a specific pull request.
2024-08-08 17:46:04 +02:00
Earl Warren
427c46dbf9
lib: remove RELEASE_NUMBERS_AND_DEV, use RELEASE_NUMBERS
In the lifecycle of vX.Y.Z, all tests are run against vX.Y-test
before it is published, including when the tag is pushed because the
automated release process now runs end-to-end before pushing the
release to forgejo-experimental.

Running end-to-end against vX.Y-dev is therefore redundant with at least
two other runs with exactly the same SHA (the one before the tag is
pushed and the one when the tag is pushed). There would be value in
doing that if it allowed to detect race conditions in Forgejo. But
such races were not found in the past six months and there is a lot
more scrutiny on commits merged in Forgejo which makes it even less
likely than it was before.

Running the tests on vX.Y instead of also including the built version
provide the same coverage and reduces the workload.
2024-08-08 17:46:04 +02:00
earl-warren
996373c707 Merge pull request 'Forgejo v1.21 is EOL & add v9.0' (#238) from earl-warren/end-to-end:wip-9.0 into main
Reviewed-on: https://code.forgejo.org///forgejo/end-to-end/pulls/238
2024-08-08 14:37:12 +00:00
Earl Warren
6224249696
upgrade: test pprof against the two active stable releases 2024-08-07 11:49:17 +02:00
Earl Warren
0f4173555f
forgejo: fix sources Gitea compatibility
It is cosmetic, keep it accurate.
2024-08-07 11:42:22 +02:00
Earl Warren
af9305b221
README: link to v7.0 documentation instead of v1.21 2024-08-07 11:42:22 +02:00
Earl Warren
944dd98727
test Gitea upgrades with v7.0 and v9.0
the upgrade path from Gitea v1.21 & v1.22 to v8.0 was tested before it
was published. The patch releases for v8.0 will only include bug fixes
and no database upgrades: they are the only kind of changes that could
cause a problem with upgrades.
2024-08-07 11:42:22 +02:00
Earl Warren
d872865242
test Forgejo upgrades starting with v7.0 instead of v1.21 2024-08-07 11:42:22 +02:00
Earl Warren
497a5d76bb
actions: trim v1.20 & v1.21 specific comment 2024-08-07 11:42:22 +02:00
Earl Warren
f46d01885f
packages: alpine: verify supported versions
v8.0-dev should be supported too but it is not LTS: only care for
9.0-dev which is not different for Alpine.
2024-08-07 11:42:22 +02:00
Earl Warren
50c5908a91
Forgejo v1.21 is EOL, v9.0 is dev 2024-08-07 11:42:22 +02:00
earl-warren
47a6f7ee78 Merge pull request 'shfmt -w globally' (#237) from earl-warren/end-to-end:wip-shfmt into main
Reviewed-on: https://code.forgejo.org///forgejo/end-to-end/pulls/237
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-08-07 08:20:51 +00:00
Earl Warren
d5f66e4c0a
shfmt -w globally 2024-08-07 08:31:33 +02:00
earl-warren
4e207414d4 Merge pull request 'forgejo: add 9.0' (#225) from earl-warren/end-to-end:wip-9.0 into main
Reviewed-on: https://code.forgejo.org///forgejo/end-to-end/pulls/225
2024-07-18 08:43:08 +00:00
Earl Warren
2bc5c804ef
forgejo: add 9.0 2024-07-18 08:41:26 +02:00
earl-warren
de08b8c0f5 Merge pull request 'federation: wait for the asynchronous star to land' (#223) from earl-warren/end-to-end:wip-federation into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/223
2024-07-08 08:17:50 +00:00
Earl Warren
ad5790b566
federation: wait for the asynchronous star to land
The check races with the propagation of the star from one forge to the
other. It must wait for it to land instead.
2024-07-08 08:29:20 +02:00
earl-warren
631262b3b9 Merge pull request 'actions: add an example for workflow-dispatch' (#220) from earl-warren/end-to-end:wip-workflow-dispatch into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/220
2024-07-05 10:21:59 +00:00
Earl Warren
05a341e201
actions: add an example for workflow-dispatch
/repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches

* fails if the required inputs are not provided
* sets defaults to inputs that are not provided

The type of inputs are only used for building the web UI interface,
not for validation. All values are strings.
2024-07-05 07:16:35 +02:00
Earl Warren
64489247aa
actions: run in development mode for debug purposes 2024-07-04 20:15:10 +02:00
earl-warren
63df181d7a Merge pull request 'Revert "actions: use Forgejo runner v3.5.0"' (#218) from earl-warren/end-to-end:wip-runner into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/218
2024-07-02 19:26:50 +00:00
Earl Warren
87df9095b9
Revert "actions: use Forgejo runner v3.5.0"
Do not force the runner version, use whatever default setup-forgejo
provides.

Forcing the version will break the cascading-pr workflow. It will
attempt to download a version that does not exist instead of building
it from sources.

This reverts commit dca3641cf3.
2024-07-02 20:54:27 +02:00
earl-warren
ec9543a6b6 Merge pull request 'lib: enable ActivityPub in GitLab' (#215) from twenty-panda/end-to-end:wip-gitlab into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/215
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-06-29 09:29:02 +00:00
Twenty Panda
b43cfb6e0c cleanup(gitlab): move hardcoded strings to variables [skip ci] 2024-06-25 18:55:19 +02:00
earl-warren
e4fa6d814f Merge pull request 'lib: start & stop GitLab' (#207) from twenty-panda/end-to-end:wip-gitlab into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/207
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-06-23 08:26:40 +00:00
earl-warren
148b7ca98c Merge pull request 'test: make it easier to comment out tests' (#209) from twenty-panda/end-to-end:wip-test into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/209
2024-06-23 08:26:01 +00:00
earl-warren
d99352c80e Merge pull request 'test: upgrade actions/cache@v4' (#208) from twenty-panda/end-to-end:wip-cache into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/208
2024-06-23 08:25:43 +00:00
Twenty Panda
76ac081fb9 lib: start & stop GitLab
The image is saved to disk and cached because it is over 1GB, to save bandwidthc.
2024-06-23 09:16:25 +02:00
Twenty Panda
6b35ea27c3 test: make it easier to comment out tests
When the build stage is commented out, the /srv/forgejo-binaries
directory will not exist. Change the script to work in both cases.
2024-06-23 09:13:36 +02:00
Twenty Panda
cc16df533b test: upgrade actions/cache@v4
Refs: https://code.forgejo.org/forgejo/runner/issues/209
2024-06-23 09:10:52 +02:00
earl-warren
c2b7f36bc8 Merge pull request 'actions: test cache/{restore,save}@v4 support' (#206) from twenty-panda/end-to-end:wip-cache into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/206
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-06-22 19:04:03 +00:00
Twenty Panda
8b3c0a55e7 actions: test cache/{restore,save}@v4 support 2024-06-22 20:27:04 +02:00
Twenty Panda
dca3641cf3 actions: use Forgejo runner v3.5.0 2024-06-22 20:24:47 +02:00
earl-warren
a402d490ba Merge pull request 'upgrades: add Gitea 1.21 & 1.22 to Forgejo 8.0-test' (#205) from twenty-panda/end-to-end:wip-gitea into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/205
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-06-22 11:15:29 +00:00
Twenty Panda
c1ce4361b9 upgrades: add Gitea 1.22.0 & 1.21.11 to Forgejo 8.0-test 2024-06-22 12:42:19 +02:00
earl-warren
9cfd043b8a Merge pull request 'federation: add star scenario' (#196) from earl-warren/end-to-end:wip-federation into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/196
2024-06-07 16:26:04 +00:00
Earl Warren
233b73d7c8
federation: add star scenario
Refs: https://codeberg.org/forgejo/forgejo/pulls/1680
2024-06-04 19:57:31 +02:00
earl-warren
a1b6e192d9 Merge pull request 'federation: stub that checks the nodeinfo of the two instances' (#195) from earl-warren/end-to-end:wip-federation into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/195
2024-06-04 15:32:52 +00:00
Earl Warren
9b6442bfcf
federation: stub that checks the nodeinfo of the two instances 2024-06-04 16:38:32 +02:00
Earl Warren
19ce0fe6b1
lib: add $work_path/forgejo-curl.sh for each Forgejo instance
The $work_path/forgejo-curl.sh for each Forgejo instance is logged
in with admin permissions and ready to use.

The default forgejo-curl.sh remains logged in the last Forgejo
instance that was launched.
2024-06-04 16:30:35 +02:00
Earl Warren
078107026b
lib: get_host_port is $IP:3000 or read from app.ini 2024-06-04 15:29:00 +02:00
Earl Warren
b62866f3ae
lib: move forgejocli to the forgejo instance WORK_PATH
Instead of having it in $DIR so that there can be one forgejocli per
forgejo instance.
2024-06-04 15:29:00 +02:00
Earl Warren
2461666aca
lib: use the WORK_PATH base instead of forgejo for the daemon
Instead of hardcoding "forgejo" as the base for the daemon to store
the PID and the logs, use the base of the WORK_PATH so that a given
work path can run a dedicated forgejo instance by the same name.
2024-06-04 13:04:05 +02:00
Earl Warren
4a19e9c90b
lib: get the base of WORK_PATH from app.ini
instead of hardcoding forgejo-work-path to be the base of WORK_PATH
relative to DIR, read it from the app.ini file. It will allow
multiple Forgejo instances to run simultaneously, each using a
different directory.
2024-06-04 12:00:42 +02:00
earl-warren
6f3f3ec0f2 Merge pull request 'docs(README): remove unhelpful sentence about actions' (#183) from earl-warren/end-to-end:wip-readme into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/183
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-06-01 14:19:12 +00:00
earl-warren
f8dae4b6c1 Merge pull request 'actions: post-7-0-schedule: create /srv/example/post-7-0-schedule/contexts first' (#192) from earl-warren/end-to-end:wip-cron into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/192
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-06-01 14:18:52 +00:00
Earl Warren
9e60ae4449
actions: post-7-0-schedule: create /srv/example/post-7-0-schedule/contexts first
A loop is waiting for /srv/example/post-7-0-schedule-volume/DONE to exist before
declaring the workflow is successfully run. But it is not really until
/srv/example/post-7-0-schedule/contexts is created with the event content and they
will race.

Fixes: https://code.forgejo.org/forgejo/end-to-end/issues/181

Exactly the same as 57fdd1cd49 but for
post-7-0-schedule instead of cron
2024-06-01 09:36:45 +02:00
earl-warren
2b8c2826c5 Merge pull request 'actions: automerge: check when review happens after CI success' (#189) from earl-warren/end-to-end:wip-automerge into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/189
2024-05-30 20:04:55 +00:00
Earl Warren
fcb48eff5c
actions: automerge: check when review happens after CI success 2024-05-28 00:47:02 +02:00
thefox
7fd268b02f Merge pull request 'actions: add automerge example' (#187) from earl-warren/end-to-end:wip-automerge into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/187
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-05-27 19:28:55 +00:00
Earl Warren
f9e20e7770
actions: add automerge example 2024-05-27 20:57:40 +02:00
Earl Warren
abe9f5f52d
docs(README): remove unhelpful sentence about actions 2024-05-22 11:07:45 +02:00
thefox
c6cd39b074 Merge pull request 'actions: cron: create /srv/example/cron/contexts first' (#182) from earl-warren/end-to-end:wip-cron into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/182
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-05-21 06:52:08 +00:00
Earl Warren
57fdd1cd49
actions: cron: create /srv/example/cron/contexts first
A loop is waiting for /srv/example/cron-volume/DONE to exist before
declaring the workflow is successfully run. But it is not really until
/srv/example/cron/contexts is created with the event content and they
will race.

Fixes: https://code.forgejo.org/forgejo/end-to-end/issues/181
2024-05-21 08:16:39 +02:00
thefox
657e367db9 Merge pull request 'lib: retry git fetch a few times (take 2)' (#180) from earl-warren/end-to-end:wip-codeberg-retry into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/180
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-05-20 04:46:11 +00:00
Earl Warren
f6da41ec8e
lib: retry git fetch a few times (take 2)
Wrap the failure in a if statement. Otherwise it will fail the first
time because the script runs under -e
2024-05-20 01:54:22 +02:00
thefox
56fb137646 Merge pull request 'lib: retry git fetch a few times' (#178) from earl-warren/end-to-end:wip-codeberg-retry into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/178
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-05-19 08:59:09 +00:00
Earl Warren
872e4632bf
lib: retry git fetch a few times
The instance hosting the forgejo repository may be down or very slow
while the build tries to fetch from it, retry a few times instead of
giving up immediately.

A total retry time of 3 * 60 seconds is probably sufficient since
Forgejo startup time is lower than this, even on large instances.
2024-05-19 09:16:55 +02:00
thefox
90e5b72123 Merge pull request 'logs: always prefix with the file name' (#149) from earl-warren/end-to-end:wip-logs into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/149
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-05-13 19:09:54 +00:00
earl-warren
8d48bb7639 Merge pull request 'actions: push-cancel intermitent failure' (#175) from earl-warren/end-to-end:wip-actions-push-cancel into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/175
Reviewed-by: thefox <thefox@noreply.code.forgejo.org>
2024-05-13 18:33:55 +00:00
Earl Warren
9f55d67bd2
actions: push-cancel intermitent failure
A) When both push happen within the same second, the SHA will be
  identical and there will not be any cancelation.
B) When `sleep infinity` happens after the reload of the runner, it
   will block the following tests forever because it has a capacity of one.

Fixes: https://code.forgejo.org/forgejo/end-to-end/issues/144

2024-05-13T00:58:49.1453499Z actions_verify_example.out:[main (root-commit) cbf3afb] initial commit
2024-05-13T00:58:49.1453528Z actions_verify_example.out: 3 files changed, 28 insertions(+)
2024-05-13T00:58:49.1453556Z actions_verify_example.out: create mode 100644 .forgejo/workflows/test.yml
2024-05-13T00:58:49.1453585Z actions_verify_example.out: create mode 100755 run.sh
2024-05-13T00:58:49.1453611Z actions_verify_example.out: create mode 100644 teardown.sh
2024-05-13T00:58:49.1453638Z actions_verify_example.out:+ git remote add origin http://root:admin1234@10.201.14.172:3000/root/example-push-cancel
2024-05-13T00:58:49.1453669Z actions_verify_example.out:+ git push --force -u origin main
2024-05-13T00:58:49.1453699Z actions_verify_example.out:remote: . Processing 1 references
2024-05-13T00:58:49.1453728Z actions_verify_example.out:remote: Processed 1 references in total
2024-05-13T00:58:49.1453758Z actions_verify_example.out:To http://10.201.14.172:3000/root/example-push-cancel
2024-05-13T00:58:49.1453786Z actions_verify_example.out: * [new branch]      main -> main
2024-05-13T00:58:49.1453814Z actions_verify_example.out:branch 'main' set up to track 'origin/main'.
...
2024-05-13T00:58:49.1458629Z actions_verify_example.out:[main (root-commit) cbf3afb] initial commit
2024-05-13T00:58:49.1458656Z actions_verify_example.out: 3 files changed, 28 insertions(+)
2024-05-13T00:58:49.1458683Z actions_verify_example.out: create mode 100644 .forgejo/workflows/test.yml
2024-05-13T00:58:49.1458711Z actions_verify_example.out: create mode 100755 run.sh
2024-05-13T00:58:49.1458738Z actions_verify_example.out: create mode 100644 teardown.sh
2024-05-13T00:58:49.1458764Z actions_verify_example.out:+ git remote add origin http://root:admin1234@10.201.14.172:3000/root/example-push-cancel
2024-05-13T00:58:49.1458795Z actions_verify_example.out:+ git push --force -u origin main
2024-05-13T00:58:49.1458822Z actions_verify_example.out:Everything up-to-date
2024-05-13 19:42:42 +02:00
earl-warren
888ddb992c Merge pull request 'fix(lib): explicitly set the page limit for releases' (#170) from earl-warren/end-to-end:wip-limit into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/170
2024-05-03 07:13:24 +00:00
Earl Warren
d9fc5cee11
fix(lib): explicitly set the page limit for releases
otherwise it is subject to limitations imposed by the server and as
the number of releases grow, the older ones will no longer be found.
2024-05-03 07:40:34 +01:00
earl-warren
2171ed7a5e Merge pull request 'chore(cleanup): v1.20 is EOL, trim it' (#167) from earl-warren/end-to-end:wip-trim-v1.20 into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/167
2024-04-25 13:21:58 +00:00
Earl Warren
c5a35b1ad5
fix(pprof): reset_forgejo before running it
it was working before because the previous tests did it. Now that it
is gone, it no longer worked because there was no app.ini.
2024-04-25 14:24:52 +02:00
Earl Warren
e80f12ace9
chore(cleanup): v1.20 is EOL, trim it 2024-04-25 14:24:50 +02:00
Earl Warren
456dab5002
docs: managing legacy tests and cutting branches 2024-04-25 13:24:51 +02:00
earl-warren
449890d712 Merge pull request 'lib: sort releases in version order' (#164) from earl-warren/end-to-end:wip-find-download into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/164
2024-04-19 15:20:18 +00:00
Earl Warren
4bff22bc37
lib: sort releases in version order
If sorted in alphabetical order v1.21.11 will be lower than v1.21.8
2024-04-19 16:36:38 +02:00
earl-warren
8260f4ac6f Merge pull request 'upgrades: gitea 1.21.10 -> forgejo 7.0.0' (#158) from earl-warren/end-to-end:wip-gitea-upgrade into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/158
2024-04-13 17:04:52 +00:00
Earl Warren
3bd723d6b8
upgrades: gitea 1.21.10 -> forgejo 7.0.0 2024-04-13 16:41:24 +02:00
thefox
9ca95cd19a add 7.0-test to pprof (#148)
Test backport of pprof to 7.0

Closes #143

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/148
Co-authored-by: thefox <thefox@noreply.code.forgejo.org>
Co-committed-by: thefox <thefox@noreply.code.forgejo.org>
2024-04-13 10:42:40 +00:00
Earl Warren
74294d14f0
logs: always prefix with the file name
otherwise it is difficult to figure out where the runner logs end and
where the forgejo logs start.
2024-04-13 12:09:41 +02:00
earl-warren
e9bb6f67e6 Merge pull request 'Revert "temporarily skip 8.0-test"' (#152) from earl-warren/end-to-end:wip-8-0-migration into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/152
2024-04-12 21:43:36 +00:00
TheFox0x7
416db9031b add schedule runs-on variables test for post 7.0 releases (#151)
reimplements: forgejo/end-to-end#146 for 8.0-dev and 8.0-test
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/151
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
2024-04-07 20:25:02 +00:00
Earl Warren
05341f1ae0
Revert "temporarily skip 8.0-test"
This reverts commit 174cb37ac9.
2024-04-07 07:45:05 +02:00
earl-warren
1a3b74f520 Merge pull request 'temporarily skip 8.0-test' (#150) from earl-warren/end-to-end:wip-8-0-migration into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/150
2024-04-06 19:59:39 +00:00
Earl Warren
174cb37ac9
temporarily skip 8.0-test
because 7.0-dev contains a migration that is ahead of 8.0 which should
not happen but does today because a PR was backported. The last one.
2024-04-06 16:15:12 +02:00
earl-warren
56110cffcc Merge pull request 'logs: show logs, not just the .out files' (#147) from earl-warren/end-to-end:wip-logs into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/147
2024-04-06 09:58:04 +00:00
Earl Warren
4a6ed59cb6
logs: show logs, not just the .out files 2024-04-06 11:08:05 +02:00
earl-warren
922508d1b5 Merge pull request 'Revert "actions: workaround for possible 404 transient bug on artifacts"' (#145) from earl-warren/end-to-end:wip-fixes into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/145
2024-04-06 07:11:17 +00:00
Earl Warren
e3a6e1fd8a
Revert "actions: workaround for possible 404 transient bug on artifacts"
Refs: https://code.forgejo.org/forgejo/end-to-end/issues/144

This reverts commit 191976a836.
2024-04-05 05:24:04 +02:00
earl-warren
4f34b12bb2 Merge pull request 'add pprof upload test' (#141) from thefox/end-to-end:pprof_upload_test into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/141
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-04-02 18:54:52 +00:00
TheFox0x7
4a82c559b9
run pprof test on test build 2024-04-02 20:15:57 +02:00
earl-warren
dd768c648e Merge pull request 'actions: workaround for possible 404 transient bug on artifacts' (#142) from earl-warren/end-to-end:wip-artifacts into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/142
2024-04-02 09:43:11 +00:00
Earl Warren
191976a836
actions: workaround for possible 404 transient bug on artifacts
Refs: https://codeberg.org/forgejo/forgejo/issues/2949
2024-04-02 07:40:08 +02:00
TheFox0x7
c00a5bfc9c
download profilecli 2024-04-01 19:25:11 +02:00
TheFox0x7
0b216e9851
actually add test to suite 2024-04-01 01:47:56 +02:00
TheFox0x7
5a5b461453
correct version to run against 2024-04-01 01:21:59 +02:00
TheFox0x7
fbe3c3c59c
add pprof test 2024-03-31 22:49:52 +02:00
earl-warren
9a1a91333e Merge pull request 'the forgejo development branch is now 8.0' (#139) from earl-warren/end-to-end:wip-8.0 into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/139
2024-03-30 14:26:15 +00:00
Earl Warren
6be26d2a69
the forgejo development branch is now 8.0 2024-03-30 14:44:43 +01:00
earl-warren
0afc6ee868 Merge pull request 'various minor fixes' (#134) from earl-warren/end-to-end:wip-fixes into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/134
2024-03-26 16:48:36 +00:00
Earl Warren
cd377ddbad
actions: push-cancel: fix typo 2024-03-26 09:21:32 +01:00
Earl Warren
d8673b8c0b
actions: pull-request: squash main/setup functions 2024-03-26 08:35:16 +01:00
Earl Warren
36456ee74f
actions: pull-request: assert the existence of contexts
and not the existence of tokens
2024-03-26 08:31:26 +01:00
earl-warren
8b6609ac4b Merge pull request 'tests: the development branch requires go 1.22 to build' (#131) from earl-warren/end-to-end:wip-go-1.22 into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/131
2024-03-25 18:09:32 +00:00
Earl Warren
f3ec6704ba
tests: the development branch requires go 1.22 to build 2024-03-25 18:26:07 +01:00
earl-warren
d69a12b4af Merge pull request 'actions: services: cover the case when no container is specified' (#127) from earl-warren/end-to-end:wip-regression into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/127
2024-03-24 11:03:25 +00:00
Earl Warren
be033071a4
actions: services: cover the case when no container is specified
When the container for running the steps is specificied, it is setup
differently than when it is implicit. This test adds coverage for both
instead of running all examples with an explicitly specified container
image.
2024-03-24 10:51:02 +01:00
earl-warren
4f3e03b917 Merge pull request 'actions: Forgejo 7.0 is equivalent to 7.0-test and run artifacts v4' (#124) from earl-warren/end-to-end:wip-artifacts-v4 into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/124
2024-03-21 17:02:05 +00:00
Earl Warren
13f18f9f47
actions: Forgejo 7.0 is equivalent to 7.0-test and run artifacts v4 2024-03-21 17:16:05 +01:00
Earl Warren
a9a46b7b7d
actions: display the runner version 2024-03-21 15:34:38 +01:00
earl-warren
73ef53dce5 Merge pull request 'actions: test {upload,download}-artifacts@v4 support' (#121) from earl-warren/end-to-end:wip-artifacts-v4 into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/121
2024-03-21 14:16:04 +00:00
Earl Warren
e1fd4cbc0f
actions: test {upload,download}-artifacts@v4 support
If Forgejo version is >= 7.0 and Forgejo runner > 3.3.0 artifacts@v4
are tested to work with a forked modified version that claims to be
compatible.
2024-03-21 14:25:28 +01:00
earl-warren
c461ace62b Merge pull request 'lib: ORGANIZATIONS ordered list' (#118) from twenty-panda/end-to-end:wip-actions into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/118
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-03-20 19:14:52 +00:00
Twenty Panda
02d263e212 lib: ORGANIZATIONS ordered list
they determine the order in which Forgejo binaries will be looked
up. It is moved to a file so it can be overriden to change the order.
2024-03-20 19:49:21 +01:00
Twenty Panda
4e517fb4df outputs do not cross local actions 2024-03-20 19:44:15 +01:00
Twenty Panda
f4c266f6b2 actions: add step to show logs 2024-03-20 19:44:00 +01:00
Earl Warren
dd5d55f032
upgrade to cascading-pr@v2.1
Closes: https://code.forgejo.org/forgejo/end-to-end/issues/114
2024-03-20 16:53:29 +01:00
earl-warren
8c9d1ff068 Merge pull request 'versions must be strings' (#113) from twenty-panda/end-to-end:wip-actions into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/113
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-03-20 14:37:57 +00:00
Twenty Panda
473c9820c9 versions must be strings 2024-03-20 14:54:17 +01:00
Twenty Panda
8d8994f7ea always cache minio & garage binaries
they are sometime very slow to download and it does not help to do it
five times for each workflow
2024-03-20 14:54:17 +01:00
earl-warren
b8c71e7201 Merge pull request 'merge actions test into end-to-end.sh' (#112) from twenty-panda/end-to-end:wip-actions into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/112
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-03-20 13:18:28 +00:00
Twenty Panda
96f91063c9 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
2024-03-20 13:42:44 +01:00
earl-warren
ee1b082c3f Merge pull request 'Add E2E test for Alpine package with noarch architecture' (#110) from twenty-panda/end-to-end:wip-alpine into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/110
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-03-17 20:46:14 +00:00
Twenty Panda
81eebc10d8 show the full logs in a separate step for forensic analysis 2024-03-17 21:19:13 +01:00
Twenty Panda
b563e5cd19 packages: Add E2E test for Alpine package with noarch
Refs: https://code.forgejo.org/forgejo/end-to-end/pulls/75
2024-03-17 21:08:13 +01:00
earl-warren
5bb5e037ce Merge pull request 'add editorconfig to help with Forgejo space display' (#92) from earl-warren/end-to-end:wip-editorconfig into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/92
2024-03-17 19:04:35 +00:00
earl-warren
8034186267 Merge pull request 'split tests into upgrades, storages and packages' (#108) from twenty-panda/end-to-end:wip-versions into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/108
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-03-17 18:21:25 +00:00
Twenty Panda
6bb5e947fb upgrades: run doctor check --all after each upgrade 2024-03-17 18:22:31 +01:00
Twenty Panda
21920b10d9 upgrades: add LFS assert 2024-03-17 18:22:22 +01:00
Twenty Panda
51f7263dee hide expected errors so they are not confused with actual errors 2024-03-17 17:56:03 +01:00
Twenty Panda
554d2b48c0 split storage & ugprade and separate fixtures 2024-03-17 17:56:03 +01:00
Twenty Panda
bf689a2478 refactor end-to-end.yml workflow to use a top-level end-to-end.sh 2024-03-17 16:27:35 +01:00
earl-warren
62f75aa56f Merge pull request 'unify packages & upgrades' (#107) from twenty-panda/end-to-end:wip-lib into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/107
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-03-15 13:15:00 +00:00
Twenty Panda
2bb546d366 upgrades: run on LXC to allow for running docker 2024-03-15 19:54:34 +07:00
Twenty Panda
f321bf5d5e upgrades: test_successful_upgrades must stop lingering Forgejo 2024-03-15 19:54:34 +07:00
Twenty Panda
8f0f6537c6 upgrades: use setup-forgejo as a helper to setup docker & user 2024-03-15 19:54:34 +07:00
Twenty Panda
9ff495254a packages: simplify the setup to use the same as upgrades
the packages tests control which Forgejo version they run against so
they can test a feature on version X+1 and not on version X
2024-03-15 19:54:34 +07:00
Twenty Panda
dd35a9f1a8 lib: import generic helpers from upgrades 2024-03-15 19:54:34 +07:00
Twenty Panda
8347d9e040 upgrades; move SUDO and verbosity control to lib 2024-03-15 13:17:01 +07:00
Twenty Panda
bf6ece0f52 README: v7.0.0-test is known as v7.0-test 2024-03-15 13:15:54 +07:00
Twenty Panda
3ead37ed37 upgrades: use the host IP instead of 0.0.0.0
otherwise it cannot be used when running from a LXC/docker container
2024-03-15 12:37:17 +07:00
earl-warren
e0c4025af5 Merge pull request 'upgrades: remove ad-hoc code and use forgejo-curl.sh instead' (#106) from twenty-panda/end-to-end:wip-forgejo-curl into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/106
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-03-15 03:48:19 +00:00
Twenty Panda
f4d0c03302 upgrades: remove ad-hoc code and use forgejo-curl.sh instead 2024-03-15 10:21:58 +07:00
earl-warren
d7e067b418 Merge pull request 'run upgrades on the development version' (#103) from twenty-panda/end-to-end:wip-cidr into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/103
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2024-03-14 10:11:17 +00:00
Twenty Panda
b011f038aa upgrades: split v1.20 & database v3 tests in separate files 2024-03-14 16:51:34 +07:00
Twenty Panda
be86fe2e44 upgrade: RELEASE_NUMBERS is a variable with all known releases
the development branch is not build for v1.21 & v1.20 because they
pre-date the hard fork and near EOL
2024-03-14 16:51:34 +07:00
Twenty Panda
aa83694fd7 upgrades: leftovers in the avatars storage is not important, ignore 2024-03-14 16:51:34 +07:00
Twenty Panda
dcab318b4a upgrades: prefix the logs with the filename for debugging 2024-03-14 16:51:34 +07:00
Twenty Panda
8bc234e82f upgrades: verify S3 storage works on v1.21 & v7.0 2024-03-14 16:51:34 +07:00
Twenty Panda
1546793d0a upgrades: verify storage settings on the latest v1.21 & v7.0 2024-03-14 16:51:34 +07:00
Twenty Panda
bc55c01cc6 upgrades: the X.Y version is equivalent to the latest patch release 2024-03-14 16:51:34 +07:00
Twenty Panda
4dc1068027 upgrade: fix the version number
FORGEJO_VERSION=$semver must be set for make backend
2024-03-14 16:51:34 +07:00
Twenty Panda
77b08e6e33 upgrades: fix path to test-upgrade.sh 2024-03-14 16:51:34 +07:00
Twenty Panda
67dcb074ea use CIDR in insecure-registries example 2024-03-14 16:51:34 +07:00
Earl Warren
f1fa7c581f
add editorconfig to help with Forgejo space display 2024-02-28 18:49:46 +01:00
earl-warren
cff067a118 Merge pull request 'Forgejo v1.22 will actually be Forgejo v7.0' (#91) from earl-warren/end-to-end:wip-alpine into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/91
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-02-28 17:07:43 +00:00
Earl Warren
78027e672d
Forgejo v1.22 will actually be Forgejo v7.0 2024-02-28 17:38:31 +01:00
Earl Warren
0f6708163f
packages: support vars.VERBOSE to see what's happening
and debug false positives
2024-02-28 17:09:44 +01:00
earl-warren
d885c84bbe Merge pull request 'tests: set the name of the packages jobs' (#88) from earl-warren/end-to-end:wip-event into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/88
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-02-27 22:17:40 +00:00
Earl Warren
9daf947453
tests: set the name of the packages jobs
actions is a copy/paste from the action workflow and packages is
better.

It also solves a name clash problem as the commit status is based on
the job name.
2024-02-27 17:15:05 +01:00
earl-warren
fa28ae8fbd Merge pull request 'packages: add alpine test cases' (#71) from earl-warren/end-to-end:wip-packages into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/71
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-02-26 09:01:41 +00:00
Earl Warren
985388b5b6
README: explain why setup-forgejo is needed for local debug 2024-02-26 09:13:26 +01:00
Earl Warren
74d11b5eaf
packages: add alpine test cases 2024-02-03 19:14:03 +01:00
earl-warren
d825dac67e Merge pull request 'actions/example-cron: verify the type of the event' (#70) from earl-warren/end-to-end:wip-cron into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/70
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-18 18:28:26 +00:00
username
5cdebe65db
actions/example-cron: verify the type of the event 2024-01-18 18:06:08 +00:00
Earl Warren
4879daf24a
update hacking instructions 2024-01-18 17:46:08 +00:00
earl-warren
6e3976b17c Merge pull request 'actions: add example-tag' (#67) from earl-warren/end-to-end:wip-event into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/67
2024-01-13 18:36:47 +00:00
Earl Warren
6236202f09
actions: CASCADE_DOCS_FORCE_VERSION can force generating a version 2024-01-13 18:21:50 +01:00
Earl Warren
dcc61603a2
actions: add example-tag 2024-01-13 18:21:50 +01:00
earl-warren
d1d87511f1 Merge pull request 'actions: push: paths' (#65) from earl-warren/end-to-end:wip-event into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/65
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-13 17:02:14 +00:00
Earl Warren
f9e93647fb
update hacking instructions 2024-01-13 17:57:29 +01:00
Earl Warren
9222919990
actions: push: paths 2024-01-13 17:38:04 +01:00
earl-warren
d3eb40ac8b Merge pull request 'actions: add example-push' (#64) from earl-warren/end-to-end:wip-event into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/64
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-13 16:19:18 +00:00
Earl Warren
465538429e
actions: add example-push 2024-01-12 17:15:47 +01:00
earl-warren
746826e3e6 Merge pull request 'actions: use volumes: instead of options:' (#63) from earl-warren/end-to-end:wip-context into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/63
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-10 21:04:28 +00:00
Earl Warren
b648c1cd50
actions: use volumes: instead of options:
for test coverage purposes
2024-01-10 21:38:05 +01:00
earl-warren
b6591e2f71 Merge pull request 'actions: context: add github.' (#62) from earl-warren/end-to-end:wip-context into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/62
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-10 17:41:37 +00:00
Earl Warren
3a47977c68
actions: context: add github. 2024-01-10 16:12:47 +01:00
Earl Warren
9d4becce06
docs: enable updates 2024-01-10 16:05:41 +01:00
Earl Warren
8aa95dc301
docs: do nothing if /srv/contexts does not exist 2024-01-10 15:57:22 +01:00
earl-warren
bc1e2aafa9 Merge pull request 'event cascading-prs need branches built out of the version' (#60) from earl-warren/end-to-end:wip-events into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/60
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-09 20:58:07 +00:00
Earl Warren
793c91b254
event cascading-prs need branches built out of the version
each version for which events are collected need a different branch in
the destination repository because they will open pull requests for
each of the versions.
2024-01-09 21:44:00 +01:00
Earl Warren
cb4932192a
documentation updates is half done, disable it for now 2024-01-08 00:43:26 +01:00
earl-warren
218494c27f Merge pull request 'actions: update the documentation with context examples' (#58) from earl-warren/end-to-end:wip-events into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/58
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-07 23:22:11 +00:00
Earl Warren
921ed6f481
actions: update the documentation with context examples 2024-01-08 00:07:40 +01:00
Earl Warren
79cc059d98
actions: update the documentation with context examples (script) 2024-01-07 23:48:36 +01:00
earl-warren
42d0557b87 Merge pull request 'do not hardcode the full version' (#57) from earl-warren/end-to-end:wip-context into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/57
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-07 18:04:34 +00:00
Earl Warren
f0570182b8
do not hardcode the full version 2024-01-07 18:45:15 +01:00
earl-warren
69747630a9 Merge pull request 'actions: context examples supporting the documentation' (#56) from earl-warren/end-to-end:wip-context into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/56
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
2024-01-05 22:32:02 +00:00
Earl Warren
4768908489
actions: add context example 2024-01-05 23:17:38 +01:00
Earl Warren
c5cccca38d
actions: service: upgrade node:20-bookworm 2024-01-05 19:37:32 +01:00
Earl Warren
66b125cffa
actions: container: upgrade alpine 3.19 2024-01-05 19:37:32 +01:00
Earl Warren
b63144cb0d
always allow workflows to mount /srv/example
because it is generally useful to store informations about how the
workflow ran
2024-01-05 19:37:32 +01:00
127 changed files with 3055 additions and 1314 deletions

10
.editorconfig Normal file
View file

@ -0,0 +1,10 @@
root = true
[*]
indent_style = space
indent_size = 4
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

23
.forgejo/cascading-docs Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
set -ex
docs=$1
docs_pr=$2
end_to_end=$3
end_to_end_ref=$4
if ! test -d /srv/contexts ; then
echo no contexts in /srv/contexts, do nothing
exit 0
fi
cd $docs/docs/user
if test "$FORCE_VERSION" = "$VERSION" || ! test -f actions-contexts/version.txt || test "$VERSION" != $(cat actions-contexts/version.txt) ; then
rm -fr actions-contexts
mkdir actions-contexts
echo "$VERSION" > actions-contexts/version.txt
# populated by actions/run.sh
rsync -av /srv/contexts/ actions-contexts/
fi

View file

@ -0,0 +1,30 @@
runs:
using: "composite"
steps:
- name: cache S3 binaries
id: S3
uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
/usr/local/bin/minio
/usr/local/bin/mc
/usr/local/bin/garage
key: S3
- uses: https://code.forgejo.org/actions/setup-forgejo@v2.0.7
with:
install-only: true
- run: forgejo-binary.sh ensure_user forgejo
- uses: actions/download-artifact@v3
with:
name: forgejo-dev
path: /srv/forgejo-binaries
- name: chown/chmod /srv/forgejo-binaries
run: |
mkdir -p /srv/forgejo-binaries
chown -R forgejo /srv/forgejo-binaries
chmod -R +x /srv/forgejo-binaries
- run: |
script=$(pwd)/end-to-end.sh
$script run dependencies
$script clobber

View file

@ -1,40 +0,0 @@
on:
pull_request:
push:
branches:
- 'main'
jobs:
actions:
runs-on: node-bookworm
strategy:
matrix:
info:
- binary: https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64
version: v1_22
tests: ${{ vars.V1_22_TESTS }}
- binary: https://codeberg.org/forgejo/forgejo/releases/download/v1.21.3-0/forgejo-1.21.3-0-linux-amd64
version: v1_21
tests: ${{ vars.V1_21_TESTS }}
- binary: https://codeberg.org/forgejo/forgejo/releases/download/v1.20.6-1/forgejo-1.20.6-1-linux-amd64
version: v1_20
tests: ${{ vars.V1_20_TESTS }}
steps:
- uses: actions/checkout@v4
- uses: https://code.forgejo.org/actions/setup-forgejo@v2
with:
install-only: true
- if: matrix.info.tests != 'none'
shell: bash
run: |
set -x
forgejo-binary.sh ensure_user forgejo
test "${{ matrix.info.binary }}"
test "${{ matrix.info.version }}"
export DIR=$(mktemp -d)
chown forgejo $DIR /srv
su -c "actions/run.sh ${{ matrix.info.binary }} ${{ matrix.info.version }} ${{ matrix.info.tests }}" forgejo

View file

@ -0,0 +1,163 @@
#
#
# https://code.forgejo.org/forgejo/end-to-end/settings/actions
#
# secrets.CASCADE_DOCS_ORIGIN_TOKEN
# https://code.forgejo.org/forgejo-ci scope write:issue, read:repository, read:user
# vars.CASCADE_DOCS_DESTINATION_DOER
# forgejo-cascading-pr (https://codeberg.org/forgejo-cascading-pr)
# secrets.CASCADE_DOCS_DESTINATION_TOKEN
# https://codeberg.org/forgejo-cascading-pr scope write:issue, write:repository, read:user
# vars.CASCADE_DOCS_FORCE_VERSION
# replace the generated documentation for a given version even if it has already
# been generated (e.g. v7.0.0-test)
#
on:
pull_request:
push:
branches:
- 'main'
jobs:
build:
runs-on: docker
container:
image: 'code.forgejo.org/oci/node:20-bookworm'
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: https://code.forgejo.org/actions/setup-go@v5
with:
go-version: "1.22"
- name: lib/build.sh
run: |
mkdir $d /tmp/forgejo-upload
touch /tmp/forgejo-upload/PLACEHOLDER
if ! test -f forgejo/build-from-sources; then
echo forgejo/build-from-sources is not present, do not build any version from source
exit 0
fi
set -x
#
# SQLite needs gcc to be compiled
#
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get -q install -y -qq build-essential
d=/tmp/forgejo-binaries
for version in $(cat forgejo/build-from-sources) ; do
lib/build.sh $version $d
forgejo=$d/forgejo-$version-dev
$forgejo --version
mv $forgejo /tmp/forgejo-upload/forgejo-$version
done
- uses: actions/upload-artifact@v3
with:
name: forgejo-dev
path: /tmp/forgejo-upload
packages:
needs: [build]
runs-on: lxc-bookworm
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: ./.forgejo/prepare-end-to-end
- run: su forgejo -c "./end-to-end.sh test_packages"
- name: full logs
if: always()
run: su forgejo -c "./end-to-end.sh show_logs"
actions:
needs: [build]
runs-on: lxc-bookworm
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: ./.forgejo/prepare-end-to-end
- run: ./end-to-end.sh prepare_dockerd
- run: su forgejo -c "./end-to-end.sh test_actions"
- name: full logs
if: always()
run: su forgejo -c "./end-to-end.sh show_logs"
federation:
needs: [build]
runs-on: lxc-bookworm
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: ./.forgejo/prepare-end-to-end
- name: install zstd
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get -q install -y -qq zstd
- name: cache GitLab OCI image
uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
/srv/forgejo-binaries/gitlab
key: gitlab
- run: |
su forgejo -c "./end-to-end.sh test_federation"
- name: full logs
if: always()
run: su forgejo -c "./end-to-end.sh show_logs"
actions-docs:
needs: [build]
runs-on: lxc-bookworm
if: github.ref == 'refs/heads/main'
strategy:
matrix:
info:
- version: "11.0"
branch: next
forgejo: https://codeberg.org
owner: forgejo-experimental
- version: "10.0"
forgejo: https://codeberg.org
owner: forgejo
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: ./.forgejo/prepare-end-to-end
- name: set full-version
id: full-version
shell: bash
run: |
set -x
full_version=$(./end-to-end.sh full_version ${{ matrix.info.version }} ${{ matrix.info.owner }})
echo value="$full_version" >> $GITHUB_OUTPUT
- run: ./end-to-end.sh prepare_dockerd
- run: su forgejo -c "./end-to-end.sh test_actions ${{ matrix.info.version }}"
- name: update documentation
uses: https://code.forgejo.org/actions/cascading-pr@v2.1
with:
origin-url: ${{ env.GITHUB_SERVER_URL }}
origin-repo: ${{ github.repository }}
origin-token: ${{ secrets.CASCADE_DOCS_ORIGIN_TOKEN }}
origin-ref: refs/heads/main
destination-url: https://codeberg.org
destination-fork-repo: ${{ vars.CASCADE_DOCS_DESTINATION_DOER }}/docs
destination-repo: forgejo/docs
destination-branch: ${{ matrix.info.branch || format('v{0}', matrix.info.version) }}
destination-token: ${{ secrets.CASCADE_DOCS_DESTINATION_TOKEN }}
prefix: ${{ env.GITHUB_REPOSITORY }}-${{ matrix.info.version }}
update: .forgejo/cascading-docs
env:
FORCE_VERSION: "${{ vars.CASCADE_DOCS_FORCE_VERSION }}"
VERSION: "${{ steps.full-version.outputs.value }}"
upgrade:
name: upgrade and storage
needs: [build]
runs-on: lxc-bookworm
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: ./.forgejo/prepare-end-to-end
- run: su forgejo -c "./end-to-end.sh test_upgrades"
- run: su forgejo -c "./end-to-end.sh test_storage"
- name: full logs
if: always()
run: su forgejo -c "./end-to-end.sh show_logs"

View file

@ -1,41 +0,0 @@
name: upgrade
on:
pull_request:
push:
branches:
- 'main'
jobs:
upgrade:
runs-on: docker
container:
image: 'docker.io/node:20-bookworm'
steps:
- name: cache S3 binaries
id: S3
uses: https://code.forgejo.org/actions/cache@v3
with:
path: |
/usr/local/bin/minio
/usr/local/bin/mc
/usr/local/bin/garage
key: S3
- name: skip if S3 cache hit
if: steps.S3.outputs.cache-hit != 'true'
run: echo no hit
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: https://code.forgejo.org/actions/setup-go@v4
with:
go-version: "1.21"
- run: |
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
chown -R forgejo:forgejo .
- run: |
script=$(pwd)/forgejo/upgrades/test-upgrade.sh
$script run dependencies
$script clobber
su forgejo -c "$script test_upgrades"

3
.gitignore vendored
View file

@ -1,12 +1,9 @@
*~
forgejo-api
forgejo-header
forgejo-ip
forgejo-runner-home
forgejo-runner-pid
forgejo-runner-token
forgejo-runner.clientpid
forgejo-runner.log
forgejo-token
.runner
#*

View file

@ -2,60 +2,93 @@
A series of tests scenarios and assertions covering
[Forgejo](https://codeberg.org/forgejo/forgejo) and the [Forgejo
runner](https://code.forgejo.org/forgejo/runner). They partially rely
on [Forgejo actions](https://code.forgejo.org/actions) developped
specifically for testing such as
[setup-forgejo](https://code.forgejo.org/actions/setup-forgejo).
runner](https://code.forgejo.org/forgejo/runner).
They are designed to run using Forgejo releases and development
versions compiled from designated repositories.
## Hacking
# Removing legacy tests
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.
End-to-end tests cover the supported range of releases and when one of
them is EOL, it must be removed as well as the tests that target it
specifically. Otherwise the test suite would grow indefinitely.
### Prepare the Forgejo instance and the runner
When a release is EOL, a branch is cut with a name following the
pattern `legacy/vX.Y-vA.B`. For instance when `v8.0` is published and
`v1.21` is EOL, the branch `legacy/v8.0-v1.21` is cut.
# Hacking
docker and sudo must be installed with insecure registries allowed in
/etc/docker/daemon.json for the IP that will be used for forgejo such
as:
```json
{
"insecure-registries": [ "10.0.0.0/8" ]
}
```
Use setup-forgejo from source.
The [setup-forgejo](https://code.forgejo.org/actions/setup-forgejo)
repository is a [Forgejo
Action](https://forgejo.org/docs/v7.0/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 `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/end-to-end
```
Run one example
## Running from locally built binary
```sh
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1_22 cron # runs actions/example-cron
make TAGS='bindata sqlite sqlite_unlock_notify' generate forgejo
cp -a forgejo /srv/forgejo-binaries/forgejo-10.0
```
Cleanup
It will be used whenever the version `10.0` is specified in a test.
## Running actions locally
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/end-to-end.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.
```sh
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1_22 none
./end-to-end.sh run dependencies
./end-to-end.sh actions_setup 10.0
firefox 0.0.0.0:3000 # user root / admin1234
./end-to-end.sh actions_verify_example echo
./end-to-end.sh actions_teardown
```
Run all examples for v1_22
Note that `with-docker-tcp` requires the docker daemon listens to
tcp://127.0.0.1:2375. See `actions/actions.sh` for how to do that.
## Running other tests locally
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
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1_22
./end-to-end.sh test_packages_alpine
./end-to-end.sh test_storage_stable_s3 minio
```
### Remote testing
Cleanup. It will teardown the Forgejo instance.
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.
* `V1_22_TESTS`
* `V1_21_TESTS`
* `V1_20_TESTS`
```sh
./end-to-end.sh stop
```

172
actions/actions.sh Executable file
View file

@ -0,0 +1,172 @@
# Copyright 2024 The Forgejo Authors
# SPDX-License-Identifier: MIT
ACTIONS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
function actions_export_variables() {
export HOST_PORT
export url=http://${FORGEJO_USER}:${FORGEJO_PASSWORD}@${HOST_PORT}
export token=$(cat $DOT_FORGEJO_CURL/token)
}
function actions_verify_feature() {
local feature=$1
actions_export_variables
export FEATURE_DIR=$ACTIONS_DIR/feature-$feature
echo "============================ RUN feature-$feature ==================="
bash -ex $FEATURE_DIR/run.sh || return 1
}
function actions_verify_example() {
local example=$1
actions_export_variables
actions_cleanup_example_volume
export example
export EXAMPLE_DIR=$ACTIONS_DIR/example-$example
if test -f $EXAMPLE_DIR/setup.sh; then
echo "============================ SETUP example-$example ==================="
bash -ex $EXAMPLE_DIR/setup.sh || return 1
fi
if test -f $EXAMPLE_DIR/run.sh; then
echo "============================ RUN example-$example ==================="
bash -ex $EXAMPLE_DIR/run.sh || return 1
else
forgejo-test-helper.sh run_workflow actions/example-$example $url root example-$example $example $token || return 1
fi
if test -f $EXAMPLE_DIR/teardown.sh; then
echo "============================ TEARDOWN example-$example ==================="
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
fi
actions_save_contexts $example
}
function actions_save_contexts() {
local example="$1"
if test -d /srv/example/$example/contexts; then
mkdir -p /srv/contexts
rsync -av /srv/example/$example/contexts/ /srv/contexts/$example/
fi
}
function actions_cleanup_example_volume() {
if test $(id -u) != 0; then
$SUDO chown $(id -u) /srv
fi
if ! test -d /srv/example; then
mkdir -p /srv/example
return
fi
$SUDO rm -fr /srv/example/*
}
function actions_setup() {
local version=$1
actions_teardown
reset_forgejo $ACTIONS_DIR/default-app.ini
start_forgejo $version
export FORGEJO_RUNNER_LOGS=$DIR/forgejo-runner.log
actions_cleanup_example_volume
export FORGEJO_RUNNER_CONFIG=$ACTIONS_DIR/runner-config.yaml
forgejo-runner.sh setup '' '' http://${HOST_PORT}
}
function actions_teardown() {
forgejo-curl.sh logout
forgejo-runner.sh teardown
stop_forgejo
}
function actions_runner_version() {
local runner_version=$($DIR/forgejo-runner --version | sed -n -e 's/forgejo-runner version v//p')
if test -z "$runner_version"; then
$DIR/forgejo-runner --version
echo failed to parse version
false
fi
echo $runner_version
}
function prepare_dockerd() {
mkdir -p /etc/systemd/system/docker.service.d
cat >/etc/systemd/system/docker.service.d/override.conf <<'EOF'
[Service]
ExecStart=
ExecStart=/usr/sbin/dockerd -H unix:///var/run/docker.sock -H tcp://127.0.0.1:2375 --containerd=/run/containerd/containerd.sock $DOCKER_OPTS
EOF
systemctl daemon-reload
if ! systemctl restart docker.service; then
journalctl --no-pager --unit docker.service
return 1
fi
netstat -lntp | grep 127.0.0.1:2375
}
function test_actions() {
local versions="${1:-$RELEASE_NUMBERS}"
for version in $versions; do
actions_setup $version
local runner_version=$(actions_runner_version)
log_info "Testing actions with Forgejo $version & Forgejo runner $runner_version"
run actions_verify_example with-docker-tcp
if dpkg --compare-versions $runner_version gt 5.0.2; then
for example in with-docker-host with-docker-socket without-docker-socket; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $runner_version gt 6.0.1; then
run actions_verify_example force-rebuild
fi
if dpkg --compare-versions $version ge 7.0 && dpkg --compare-versions $runner_version gt 3.3.0; then
for example in artifacts-v4; do
run actions_verify_example $example
done
fi
for example in echo config-options cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context; do
run actions_verify_example $example
done
if dpkg --compare-versions $version lt 7.1; then
for example in cron; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $version ge 7.1; then
for example in automerge post-7-0-schedule; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $version ge 8.0; then
for example in workflow-dispatch; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $version ge 9.0; then
run actions_verify_example schedule-noncancel
fi
done
}

View file

@ -1,18 +1,23 @@
RUN_MODE = prod
WORK_PATH = ${WORK_PATH}
RUN_MODE = dev
WORK_PATH = forgejo-work-path
[server]
APP_DATA_PATH = ${WORK_PATH}/data
DOMAIN = ${IP}
HTTP_PORT = 3000
SSH_LISTEN_PORT = 2222
LFS_START_SERVER = true
[queue]
TYPE = immediate
[database]
DB_TYPE = sqlite3
PATH = ${WORK_PATH}/forgejo.db
[log]
MODE = file
LEVEL = debug
LEVEL = trace
ROUTER = file
[log.file]
@ -24,21 +29,7 @@ INSTALL_LOCK = true
[repository]
ENABLE_PUSH_CREATE_USER = true
DEFAULT_PUSH_CREATE_PRIVATE = false
DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,repo.actions
[attachment]
PATH = relative-attachments
[lfs]
PATH = relative-lfs
[avatar]
PATH = relative-avatars
[repo-avatar]
PATH = relative-repo-avatars
[repo-archive]
PATH = relative-repo-archive
[packages]
PATH = relative-packages
[actions]
ENABLED = true

View file

@ -0,0 +1,47 @@
on: [push]
jobs:
upload-many:
runs-on: docker
steps:
- run: mkdir -p artifacts
- run: touch artifacts/ONE artifacts/TWO
- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: many-artifacts
path: artifacts/
download-many:
needs: [upload-many]
runs-on: docker
steps:
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
- run: |
test -f many-artifacts/ONE
test -f many-artifacts/TWO
upload-one:
runs-on: docker
steps:
- run: mkdir -p path/to/artifact
- run: echo hello > path/to/artifact/world.txt
- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: my-artifact
path: path/to/artifact/world.txt
download-one:
needs: [upload-one]
runs-on: docker
steps:
- run: "! test -f world.txt"
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
with:
name: my-artifact
- run: "test -f world.txt"

View file

@ -0,0 +1,13 @@
on:
pull_request:
jobs:
test:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
options: "--volume /srv/example:/srv/example"
steps:
- run: |
${{ vars.SCRIPT }}

108
actions/example-automerge/run.sh Executable file
View file

@ -0,0 +1,108 @@
TMPDIR=$(mktemp -d)
trap "rm -fr $TMPDIR" EXIT
source $EXAMPLE_DIR/../../lib/lib.sh
api=$url/api/v1
repo=root/example-automerge
export d=/srv/example/automerge
function reset_automerge_pr() {
#
# repository with a pull_request event workflow that always succeeds
#
mkdir -p $d
forgejo-curl.sh api_json -X DELETE $api/repos/$repo >&/dev/null || true
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
forgejo-curl.sh api_json -X DELETE $api/repos/$repo/actions/variables/SCRIPT >&/dev/null || true
forgejo-curl.sh api_json -X POST --data-raw '{"value":"true"}' $api/repos/$repo/actions/variables/SCRIPT
(
cd $d
rm -fr example-automerge
git clone $url/$repo
cd example-automerge
git checkout -b other
git config user.email root@example.com
git config user.name username
touch file-unique-to-the-pr-branch
echo other >>README
git add .
git commit -m 'other change'
git push --force -u origin other
)
#
# make sure the runner won't race with the sequence that follows
#
forgejo-runner.sh teardown
#
# create a PR and schedule it for automerge when the workflow succeeds
#
api_pr_delete_all $api $repo
forgejo-curl.sh api_json --data-raw '{"title":"PR title","base":"main","head":"other"}' $api/repos/$repo/pulls >$TMPDIR/pr.json
local pr=$(jq -r .number <$TMPDIR/pr.json)
forgejo-curl.sh api_json --data-raw '{"Do":"merge","merge_when_checks_succeed":true}' $api/repos/$repo/pulls/$pr/merge
if api_pr_is_merged $api $repo $pr; then
echo pull request already merged although it should not be
return 1
fi
}
function verify_automerge_on_status_success() {
reset_automerge_pr
local pr=$(jq -r .number <$TMPDIR/pr.json)
#
# run the workflow
#
forgejo-runner.sh run
local sha=$(api_branch_tip $api $repo other)
api_pr_wait_success $api $repo $sha
#
# verify the PR was automerged
#
if ! retry api_pr_is_merged $api $repo $pr; then
echo pull request is not automerged as expected
return 1
fi
}
function verify_automerge_on_reviewer_approval() {
reset_automerge_pr
local pr=$(jq -r .number <$TMPDIR/pr.json)
#
# require at least one review for a PR to be merged
#
api_branch_protect $api $repo main
#
# run the workflow
#
forgejo-runner.sh run
local sha=$(api_branch_tip $api $repo other)
api_pr_wait_success $api $repo $sha
#
# approve the PR
#
local username=user1
api_user_create $api $username $username@example.com
api_user_make_admin $api $username
user_login $username
DOT=$API_TMPDIR/$username api_pr_approve $api $repo $pr
#
# verify the PR was automerged
#
if ! retry api_pr_is_merged $api $repo $pr; then
echo pull request is not automerged as expected
return 1
fi
}
function main() {
verify_automerge_on_status_success
verify_automerge_on_reviewer_approval
}
main

View file

@ -0,0 +1 @@
mkdir -p /srv/example/automerge

View file

@ -0,0 +1,51 @@
on: [push]
jobs:
build:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
steps:
- name: cache restore
id: cachestep1
uses: https://code.forgejo.org/actions/cache/restore@v4
with:
path: |
/usr/local/bin/something
key: cachekey
- name: cache hit
run: |
set -x
test "${{ steps.cachestep1.outputs.cache-hit }}" != true
- name: create something
run: echo SOMETHING > /usr/local/bin/something
- name: cache save
uses: https://code.forgejo.org/actions/cache/save@v4
with:
path: |
/usr/local/bin/something
key: ${{ steps.cachestep1.outputs.cache-primary-key }}
- name: remove something
run: rm /usr/local/bin/something
- name: cache restore
id: cachestep2
uses: https://code.forgejo.org/actions/cache/restore@v4
with:
path: |
/usr/local/bin/something
key: cachekey
- name: verify something
run: |
set -x
test SOMETHING = $(cat /usr/local/bin/something)
- name: cache hit
run: |
set -x
test "${{ steps.cachestep2.outputs.cache-hit }}" = true

View file

@ -0,0 +1,30 @@
log:
level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: true
dir: "/srv/example/cache"
host: ""
port: 0
container:
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example"]
docker_host: ""
host:
workdir_parent:

1
actions/example-cache/setup.sh Executable file
View file

@ -0,0 +1 @@
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -0,0 +1,16 @@
on: [push]
jobs:
test:
runs-on: docker
container:
options: "--hostname customname"
steps:
- run: |
test -f /srv/example-config-options-volume-valid
- run: |
! test -f /srv/example-config-options-volume-invalid
- run: |
test "$FROB" = "NITZ"
- run: |
test "$(cat /etc/hostname)" = customname

View file

@ -0,0 +1,31 @@
log:
level: debug
job_level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: false
dir: ""
host: ""
port: 0
container:
network: ""
privileged: false
options: "--volume /srv/example-config-options-volume-valid:/srv/example-config-options-volume-valid --volume /srv/example-config-options-volume-invalid:/srv/example-config-options-volume-invalid --env FROB=NITZ"
workdir_parent:
valid_volumes: ["/srv/example-config-options-volume-valid"]
docker_host: ""
host:
workdir_parent:

View file

@ -0,0 +1,3 @@
>/srv/example-config-options-volume-valid
>/srv/example-config-options-volume-invalid
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -3,6 +3,6 @@ jobs:
test:
runs-on: docker
container:
image: alpine:3.18
image: code.forgejo.org/oci/alpine:3.21
steps:
- run: grep Alpine /etc/os-release

View file

@ -1 +0,0 @@
ONE

View file

@ -0,0 +1,206 @@
on: [push]
jobs:
test:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
volumes:
- /srv/example:/srv/example
steps:
- name: env.CI
run: |
set -x
test "$CI" = true
test "$CI" = "${{ env.CI }}"
- name: GITHUB_ACTION
run: |
set -x
echo "$GITHUB_ACTION" | grep -E '^[0-9]+$'
test "$GITHUB_ACTION" = "${{ env.GITHUB_ACTION }}"
test "$GITHUB_ACTION" = "${{ github.ACTION }}"
# See also actions/example-local-action/.forgejo/local-action/action.yml
- name: GITHUB_ACTION_PATH
run: |
set -x
test -z "$GITHUB_ACTION_PATH"
test "$GITHUB_ACTION_PATH" = "${{ env.GITHUB_ACTION_PATH }}"
test "$GITHUB_ACTION_PATH" = "${{ github.ACTION_PATH }}"
- name: when running an action
if: ${{ env.GITHUB_ACTIONS }}
uses: SELF@main
with:
input-one: "otherone"
- name: GITHUB_ACTION_REPOSITORY
run: test -f /srv/example/example-context/GITHUB_ACTION_REPOSITORY
- name: GITHUB_ACTION_PATH
run: test -f /srv/example/example-context/GITHUB_ACTION_PATH
- name: GITHUB_ACTIONS
run: |
set -x
test "$GITHUB_ACTIONS" = true
test "$GITHUB_ACTIONS" = "${{ env.GITHUB_ACTIONS }}"
- name: GITHUB_ACTOR
run: |
set -x
test "$GITHUB_ACTOR"
test "$GITHUB_ACTOR" = "${{ env.GITHUB_ACTOR }}"
test "$GITHUB_ACTOR" = "${{ github.ACTOR }}"
- name: GITHUB_API_URL
shell: bash
run: |
set -x
[[ "$GITHUB_API_URL" =~ /api/v1$ ]]
test "$GITHUB_API_URL" = "${{ env.GITHUB_API_URL }}"
test "$GITHUB_API_URL" = "${{ github.API_URL }}"
# See also actions/example-pull-request/.forgejo/workflows/test.yml
- name: GITHUB_BASE_REF
run: |
set -x
test -z "$GITHUB_BASE_REF"
test "$GITHUB_BASE_REF" = "${{ env.GITHUB_BASE_REF }}"
test "$GITHUB_BASE_REF" = "${{ github.BASE_REF }}"
# See also actions/example-pull-request/.forgejo/workflows/test.yml
- name: GITHUB_HEAD_REF
run: |
set -x
test -z "$GITHUB_HEAD_REF"
test "$GITHUB_HEAD_REF" = "${{ env.GITHUB_HEAD_REF }}"
test "$GITHUB_HEAD_REF" = "${{ github.HEAD_REF }}"
- name: GITHUB_ENV
run: |
set -x
test -f "$GITHUB_ENV"
test "$GITHUB_ENV" = "${{ env.GITHUB_ENV }}"
- name: GITHUB_EVENT_NAME
run: |
set -x
test "$GITHUB_EVENT_NAME" = push
test "$GITHUB_EVENT_NAME" = "${{ env.GITHUB_EVENT_NAME }}"
test "$GITHUB_EVENT_NAME" = "${{ github.EVENT_NAME }}"
- name: GITHUB_JOB
run: |
set -x
test "$GITHUB_JOB" = test
test "$GITHUB_JOB" = "${{ env.GITHUB_JOB }}"
test "$GITHUB_JOB" = "${{ github.JOB }}"
- name: GITHUB_OUTPUT
run: |
set -x
test -f "$GITHUB_OUTPUT"
test "$GITHUB_OUTPUT" = "${{ env.GITHUB_OUTPUT }}"
- name: GITHUB_PATH
run: |
set -x
test -f "$GITHUB_PATH"
test "$GITHUB_PATH" = "${{ env.GITHUB_PATH }}"
- name: GITHUB_REF
shell: bash
run: |
set -x
[[ "$GITHUB_REF" =~ ^refs/ ]]
test "$GITHUB_REF" = "${{ env.GITHUB_REF }}"
test "$GITHUB_REF" = "${{ github.REF }}"
- name: GITHUB_REF_NAME
shell: bash
run: |
set -x
! [[ "$GITHUB_REF_NAME" =~ ^refs/ ]]
test "$GITHUB_REF_NAME" = "${{ env.GITHUB_REF_NAME }}"
test "$GITHUB_REF_NAME" = "${{ github.REF_NAME }}"
- name: GITHUB_REPOSITORY
run: |
set -x
test "$GITHUB_REPOSITORY" = root/example-context
test "$GITHUB_REPOSITORY" = "${{ env.GITHUB_REPOSITORY }}"
test "$GITHUB_REPOSITORY" = "${{ github.REPOSITORY }}"
- name: GITHUB_REPOSITORY_OWNER
run: |
set -x
test "$GITHUB_REPOSITORY_OWNER" = root
test "$GITHUB_REPOSITORY_OWNER" = "${{ env.GITHUB_REPOSITORY_OWNER }}"
test "$GITHUB_REPOSITORY_OWNER" = "${{ github.REPOSITORY_OWNER }}"
- name: GITHUB_RUN_NUMBER
run: |
set -x
echo "$GITHUB_RUN_NUMBER" | grep -E '^[0-9]+$'
test "$GITHUB_RUN_NUMBER" = "${{ env.GITHUB_RUN_NUMBER }}"
test "$GITHUB_RUN_NUMBER" = "${{ github.RUN_NUMBER }}"
- name: GITHUB_SERVER_URL
shell: bash
run: |
set -x
[[ "$GITHUB_SERVER_URL" =~ ^http ]]
test "$GITHUB_SERVER_URL" = "${{ env.GITHUB_SERVER_URL }}"
test "$GITHUB_SERVER_URL" = "${{ github.SERVER_URL }}"
- name: GITHUB_SHA
run: |
set -x
test "$GITHUB_SHA"
test "$GITHUB_SHA" = "${{ env.GITHUB_SHA }}"
test "$GITHUB_SHA" = "${{ github.SHA }}"
- name: GITHUB_STEP_SUMMARY
run: |
set -x
test -f "$GITHUB_STEP_SUMMARY"
test "$GITHUB_STEP_SUMMARY" = "${{ env.GITHUB_STEP_SUMMARY }}"
# See also actions/example-pull-request/.forgejo/workflows/test.yml
- name: GITHUB_TOKEN
run: |
set -x
test "$GITHUB_TOKEN"
test "$GITHUB_TOKEN" = "${{ env.GITHUB_TOKEN }}"
test "$GITHUB_TOKEN" = "${{ github.TOKEN }}"
- name: GITHUB_WORKSPACE
run: |
set -x
test -d "$GITHUB_WORKSPACE"
test "$GITHUB_WORKSPACE" = "${{ env.GITHUB_WORKSPACE }}"
test "$GITHUB_WORKSPACE" = "${{ github.WORKSPACE }}"
- name: RUNNER_ARCH
run: |
set -x
test "$RUNNER_ARCH" = X64
- name: RUNNER_OS
run: |
set -x
test "$RUNNER_OS" = Linux
# runner 3.3.0 $RUNNER_TOOL_CACHE is not an existing directory
# - name: RUNNER_TOOL_CACHE
# run: |
# set -x
# test -d "$RUNNER_TOOL_CACHE"
- name: RUNNER_TEMP
run: |
set -x
test -d "$RUNNER_TEMP"

View file

@ -0,0 +1,23 @@
inputs:
input-one:
default: 'one'
description: 'description one'
runs:
using: "composite"
steps:
- name: GITHUB_ACTION_REPOSITORY
run: |
set -x
test "$GITHUB_ACTION_REPOSITORY" = root/action-for-context
test "$GITHUB_ACTION_REPOSITORY" = "${{ env.GITHUB_ACTION_REPOSITORY }}"
test "$GITHUB_ACTION_REPOSITORY" = "${{ github.ACTION_REPOSITORY }}"
touch /srv/example/example-context/GITHUB_ACTION_REPOSITORY
- name: GITHUB_ACTION_PATH
shell: bash
run: |
set -x
[[ "$GITHUB_ACTION_PATH" =~ action-for-context@main$ ]]
test "$GITHUB_ACTION_PATH" = "${{ github.ACTION_PATH }}"
touch /srv/example/example-context/GITHUB_ACTION_PATH

View file

@ -0,0 +1 @@
forgejo-test-helper.sh run_workflow actions/example-$example $url root example-$example action-for-context $token

View file

@ -0,0 +1,3 @@
mkdir -p /srv/example/example-context
forgejo-test-helper.sh push actions/example-$example/action-for-context $url root action-for-context

View file

@ -7,8 +7,16 @@ jobs:
runs-on: docker
container:
image: code.forgejo.org/oci/debian:bookworm
options: "--volume /srv/example-cron-volume:/srv/example-cron-volume"
options: "--volume /srv/example:/srv/example"
steps:
- name: save context
run: |
d=/srv/example/cron/contexts/$GITHUB_EVENT_NAME
mkdir -p $d
cat > $d/github <<'EOF'
${{ toJSON(github) }}
EOF
- run: |
touch /srv/example-cron-volume/DONE
touch /srv/example/cron-volume/DONE

View file

@ -7,7 +7,7 @@ forgejo-test-helper.sh push_workflow actions/example-$example $url root example-
# See https://codeberg.org/forgejo/forgejo/pulls/1941 for more information
#
function verify_ref() {
local ref=$(sqlite3 $DIR/forgejo-work-path/forgejo.db 'select ref from action_schedule')
local ref=$(sqlite3 $DIR/forgejo-work-path/forgejo.db 'select ref from action_schedule')
test "${ref##*/}" = "main"
}
verify_ref
@ -16,7 +16,12 @@ forgejo-curl.sh api_json --data '{"new_branch_name":"zzzz"}' $api/repos/root/exa
verify_ref
# cron runs once per minute, give it three minutes max before declaring failure
if ! RETRY_DELAYS="30 30 30 30 30 30" forgejo.sh retry test -f /srv/example-cron-volume/DONE ; then
if ! RETRY_DELAYS="30 30 30 30 30 30" forgejo.sh retry test -f /srv/example/cron-volume/DONE; then
cat $FORGEJO_RUNNER_LOGS
false
fi
c=/srv/example/cron/contexts/schedule/github
cat $c
test "schedule" = "$(jq -r .event_name <$c)"
test "schedule" = "$(jq -r .event.action <$c)"

View file

@ -1,3 +1 @@
rm -fr /srv/example-cron-volume
mkdir -p /srv/example-cron-volume
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload
mkdir -p /srv/example/cron-volume

View file

@ -0,0 +1,5 @@
FROM code.forgejo.org/oci/debian:bookworm
COPY entrypoint.sh /run/entrypoint.sh
# if we rebuild, we should notice this file change
COPY input.txt /run/input.txt
ENTRYPOINT [ "/run/entrypoint.sh" ]

View file

@ -0,0 +1,6 @@
name: local docker action
description: local docker action, build depends on "input.txt"
runs:
using: 'docker'
image: 'Dockerfile'

View file

@ -0,0 +1,3 @@
#! /usr/bin/env bash
set -x
exit "$(< /run/input.txt)"

View file

@ -0,0 +1 @@
this file will be filled by the test

View file

@ -0,0 +1,10 @@
---
on:
push:
jobs:
test:
runs-on: docker
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: ./.forgejo/local-docker-action

View file

@ -0,0 +1,42 @@
TMPDIR=$(mktemp -d)
trap "rm -fr $TMPDIR" EXIT
function setup_with_rebuild() {
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config-with-rebuild.yml forgejo-runner.sh reload
}
function setup_without_rebuild() {
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config-without-rebuild.yml forgejo-runner.sh reload
}
function run() {
local dir="$1"
local expected="$2"
local repo=root/example-$example
forgejo-test-helper.sh push_workflow $dir $url root example-$example setup-forgejo $token
sha=$(forgejo-test-helper.sh branch_tip $url $repo main)
forgejo-test-helper.sh wait_$expected $url $repo $sha
}
function main() {
local dir=$TMPDIR/repository
cp -a $EXAMPLE_DIR $dir
# set up passing docker action
echo "0" >$dir/.forgejo/local-docker-action/input.txt
setup_with_rebuild
run $dir success
# change docker action to fail
echo "1" >$dir/.forgejo/local-docker-action/input.txt
# ... but without a rebuild, it should still pass
setup_without_rebuild
run $dir success
# now the action should fail
setup_with_rebuild
run $dir failure
}
main

View file

@ -1,6 +1,5 @@
log:
level: info
level: debug
runner:
file: .runner
@ -10,7 +9,7 @@ runner:
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:16-bullseye"]
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: false
@ -19,12 +18,13 @@ cache:
port: 0
container:
network: ""
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example-cron-volume"]
valid_volumes: ["/srv/example"]
docker_host: ""
force_rebuild: true
host:
workdir_parent:

View file

@ -0,0 +1,30 @@
log:
level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: false
dir: ""
host: ""
port: 0
container:
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example"]
docker_host: ""
force_rebuild: false
host:
workdir_parent:

View file

@ -0,0 +1 @@
forgejo-runner.sh reload

View file

@ -1,9 +1,3 @@
#
# As of Forgejo v1.20 running this example would require using the web
# endpoints because there is no API to do the same.
#
# It was manually tested to **not work** with Forgejo v1.21 & runner 3.0.1
#
on: [push]
jobs:

View file

@ -13,4 +13,10 @@ outputs:
runs:
using: "composite"
steps:
- name: GITHUB_ACTION_PATH
run: |
set -x
test "$(basename $GITHUB_ACTION_PATH)" = local-action
test "$GITHUB_ACTION_PATH" = "${{ env.GITHUB_ACTION_PATH }}"
- run: echo key=${{ inputs.input-two-required }} >> $GITHUB_OUTPUT

View file

@ -0,0 +1,23 @@
on:
schedule:
- cron: '* * * * *'
jobs:
test:
runs-on: ${{ vars.TEST_SCHEDULE_RUNSON }}
container:
image: code.forgejo.org/oci/debian:bookworm
options: "--volume /srv/example:/srv/example"
steps:
- name: save context
run: |
d=/srv/example/post-7-0-schedule/contexts/$GITHUB_EVENT_NAME
mkdir -p $d
cat > $d/github <<'EOF'
${{ toJSON(github) }}
EOF
- run: |
echo "TEST_SCHEDULE_RUNSON=${{ vars.TEST_SCHEDULE_RUNSON }}"
touch /srv/example/post-7-0-schedule-volume/DONE

View file

@ -0,0 +1,30 @@
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
forgejo-curl.sh web -X POST http://${HOST_PORT}/admin/actions/variables/1/delete || true
forgejo-curl.sh web --form name=TEST_SCHEDULE_RUNSON --form data=docker http://${HOST_PORT}/admin/actions/variables/new
#
# Verify that creating a new branch with the same SHA as the default branch
# does not change the ref associated with the schedule
#
# See https://codeberg.org/forgejo/forgejo/pulls/1941 for more information
#
function verify_ref() {
local ref=$(sqlite3 $DIR/forgejo-work-path/forgejo.db 'select ref from action_schedule')
test "${ref##*/}" = "main"
}
verify_ref
api=$url/api/v1
forgejo-curl.sh api_json --data '{"new_branch_name":"zzzz"}' $api/repos/root/example-post-7-0-schedule/branches
verify_ref
# runs once per minute, give it three minutes max before declaring failure
if ! RETRY_DELAYS="30 30 30 30 30 30" forgejo.sh retry test -f /srv/example/post-7-0-schedule-volume/DONE; then
cat $FORGEJO_RUNNER_LOGS
false
fi
c=/srv/example/post-7-0-schedule/contexts/schedule/github
cat $c
test "schedule" = "$(jq -r .event_name <$c)"
test "schedule" = "$(jq -r .event.action <$c)"

View file

@ -0,0 +1 @@
mkdir -p /srv/example/post-7-0-schedule-volume

View file

@ -10,7 +10,7 @@ jobs:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
options: "--volume /srv/example-pull-request:/srv/example-pull-request"
options: "--volume /srv/example:/srv/example"
steps:
- name: setup
@ -33,6 +33,24 @@ jobs:
echo value=true >> $GITHUB_OUTPUT
fi
# See also actions/example-context/.forgejo/workflows/test.yml
- name: env.GITHUB_BASE_REF
run: |
set -x
test "$GITHUB_BASE_REF" = main
test "$GITHUB_BASE_REF" = "${{ env.GITHUB_BASE_REF }}"
# See also actions/example-context/.forgejo/workflows/test.yml
- name: env.GITHUB_HEAD_REF
run: |
set -x
if ${{ steps.forked.outputs.value }} ; then
test "$GITHUB_HEAD_REF" = main
else
test "$GITHUB_HEAD_REF" = other
fi
test "$GITHUB_HEAD_REF" = "${{ env.GITHUB_HEAD_REF }}"
- name: secrets
shell: bash
run: |
@ -115,10 +133,10 @@ jobs:
- name: save event
run: |
d=/srv/example-pull-request/${{ github.event.pull_request.head.repo.owner.username }}/$GITHUB_EVENT_NAME/${{ github.event.action }}
d=/srv/example/pull-request/contexts/${{ github.event.pull_request.head.repo.owner.username }}/$GITHUB_EVENT_NAME
mkdir -p $d
cat > $d/event <<'EOF'
${{ toJSON(github.event) }}
cat > $d/github <<'EOF'
${{ toJSON(github) }}
EOF
- uses: https://code.forgejo.org/actions/checkout@v4

View file

@ -0,0 +1,11 @@
#!/bin/bash
set -ex
c=$d/contexts
test opened = "$(jq -r .event.action <$c/fork-org/pull_request/github)"
test opened = "$(jq -r .event.action <$c/fork-org/pull_request_target/github)"
test opened = "$(jq -r .event.action <$c/root/pull_request/github)"
test opened = "$(jq -r .event.action <$c/root/pull_request_target/github)"

View file

@ -1,8 +0,0 @@
#!/bin/bash
set -ex
test -d $d/fork-org/pull_request/opened
test -d $d/fork-org/pull_request_target/opened
test -d $d/root/pull_request/opened
test -d $d/root/pull_request_target/opened

View file

@ -1,59 +1,56 @@
api=$url/api/v1
export d=/srv/example-pull-request
export d=/srv/example/pull-request
PROOF='some proof'
function setup() {
function main() {
mkdir -p $d
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
forgejo-curl.sh api_json --data-raw '{"username":"fork-org"}' $api/orgs
forgejo-curl.sh api_json --data-raw '{"organization":"fork-org"}' $api/repos/root/example-pull-request/forks
forgejo-curl.sh api_json -X PUT --data-raw '{"data":"AAAA"}' $api/repos/root/example-pull-request/actions/secrets/SECRET
(
cd $d
git clone $url/fork-org/example-pull-request fork
cd fork
git config user.email root@example.com
git config user.name username
echo fork $PROOF >> README
touch file-unique-to-the-pr-branch
git add .
git commit -m 'fork change'
git push
cd $d
git clone $url/fork-org/example-pull-request fork
cd fork
git config user.email root@example.com
git config user.name username
echo fork $PROOF >>README
touch file-unique-to-the-pr-branch
git add .
git commit -m 'fork change'
git push
)
forgejo.sh retry forgejo-curl.sh api_json --data-raw '{"title":"PR from fork","base":"main","head":"fork-org:main"}' $api/repos/root/example-pull-request/pulls
(
cd $d
git clone $url/root/example-pull-request
cd example-pull-request
git checkout -b other
git config user.email root@example.com
git config user.name username
touch file-unique-to-the-pr-branch
echo other $PROOF >> README
git add .
git commit -m 'other change'
git push --force -u origin other
cd $d
git clone $url/root/example-pull-request
cd example-pull-request
git checkout -b other
git config user.email root@example.com
git config user.name username
touch file-unique-to-the-pr-branch
echo other $PROOF >>README
git add .
git commit -m 'other change'
git push --force -u origin other
)
forgejo.sh retry forgejo-curl.sh api_json --data-raw '{"title":"PR same repo","base":"main","head":"other"}' $api/repos/root/example-pull-request/pulls
export RETRY_DELAYS="60 60 60 60 60 60 60"
for assert in $EXAMPLE_DIR/assert-*.sh ; do
if ! forgejo.sh retry $assert ; then
find $d
cat $FORGEJO_RUNNER_LOGS
false
fi
for assert in $EXAMPLE_DIR/assert-*.sh; do
if ! forgejo.sh retry $assert; then
find $d
sed -e 's/^/[RUNNER LOGS]/' <$FORGEJO_RUNNER_LOGS
false
fi
done
}
function main() {
setup
}
main

View file

@ -1,8 +1 @@
if test $(id -u) != 0 ; then
SUDO=sudo
fi
$SUDO rm -fr /srv/example-pull-request/{root,fork-org}
rm -fr /srv/example-pull-request
mkdir -p /srv/example-pull-request
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload
mkdir -p /srv/example/pull-request

View file

@ -11,8 +11,8 @@ forgejo-test-helper.sh wait_running $url $repo $sha
#
# push to the same branch
#
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
forgejo-test-helper.sh push_workflow actions/example-echo $url root example-$example setup-forgejo $token
#
# wait for the workflow to be canceld as a result of the previous push
# wait for the workflow to be canceled as a result of the previous push
#
forgejo-test-helper.sh wait_failure $url $repo $sha 'Has been cancelled'

View file

@ -0,0 +1,23 @@
on:
push:
branches:
- 'mai*'
paths:
- '**/test.yml'
jobs:
test:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
volumes:
- /srv/example:/srv/example
steps:
- name: save event
run: |
d=/srv/example/push/contexts/$GITHUB_EVENT_NAME
mkdir -p $d
cat > $d/github <<'EOF'
${{ toJSON(github) }}
EOF

View file

@ -0,0 +1,15 @@
on:
schedule:
- cron: "* * * * *"
jobs:
test:
runs-on: docker
container:
image: code.forgejo.org/oci/debian:bookworm
volumes:
- /srv/example:/srv/example
steps:
- run: |
while ! [ -f /srv/example/schedule-noncancel/PUSHED ]; do
sleep 3
done

View file

@ -0,0 +1,99 @@
repo=root/example-$example
#
# delete the repository
#
api=$url/api/v1
if forgejo-curl.sh api_json -X GET $api/repos/root/example-$example; then
forgejo-curl.sh api_json -X DELETE $api/repos/root/example-$example
fi
#
# push the repository
#
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
#
# get the run id of the workflow that just started
#
getScheduleRun() {
rm -f $DIR/forgejo-work-path/forgejo.copy.db
cp $DIR/forgejo-work-path/forgejo.db $DIR/forgejo-work-path/forgejo.copy.db
sqlite3 $DIR/forgejo-work-path/forgejo.copy.db \
"pragma busy_timeout = 5000; \
select action_run.id \
from action_run \
inner join action_schedule on action_run.schedule_id = action_schedule.id \
inner join repository on action_schedule.repo_id = repository.id \
where repository.name = 'example-schedule-noncancel' \
order by action_run.created desc limit 1" | sed '2q;d'
}
run_id=$(getScheduleRun)
while [ -z $run_id ]; do
echo waiting 5...
sleep 5
run_id=$(getScheduleRun)
done
echo Schedule run id: $run_id
#
# Wait for it to be started
#
checkStarted() {
rm -f $DIR/forgejo-work-path/forgejo.copy.db
cp $DIR/forgejo-work-path/forgejo.db $DIR/forgejo-work-path/forgejo.copy.db
sqlite3 $DIR/forgejo-work-path/forgejo.copy.db \
"pragma busy_timeout = 5000; \
select id \
from action_run \
where id = $run_id \
and started is not null" | sed '2q;d'
}
started_check=$(checkStarted)
while [ -z $started_check ]; do
echo waiting 2...
sleep 2
started_check=$(checkStarted)
done
echo Run has started
echo Push to repo again
#
# Push to the repo again
#
forgejo-test-helper.sh push_workflow actions/example-echo $url root example-$example setup-forgejo $token
echo Signal to the workflow that the push has happened
mkdir -p /srv/example/schedule-noncancel
touch /srv/example/schedule-noncancel/PUSHED
#
# Wait for the workflow to finish anyway
#
echo Wait for workflow to finish
checkFinished() {
rm -f $DIR/forgejo-work-path/forgejo.copy.db
cp $DIR/forgejo-work-path/forgejo.db $DIR/forgejo-work-path/forgejo.copy.db
sqlite3 $DIR/forgejo-work-path/forgejo.copy.db \
"pragma busy_timeout = 5000; \
select status \
from action_run \
where id = $run_id \
and (status != 6 and status != 5)" | sed '2q;d'
}
finished_status=$(checkFinished)
while [ -z $finished_status ]; do
echo waiting 5...
sleep 5
finished_status=$(checkFinished)
done
echo Workflow finished.
rm -f $DIR/forgejo-work-path/forgejo.copy.db
test $finished_status = 1

View file

@ -0,0 +1,4 @@
#
# this will effectively discard any linger workflow so they do not interfere with other tests
#
forgejo-runner.sh reload

View file

@ -2,7 +2,23 @@ on: [push]
jobs:
#
# No volume involved
# No volume involved & the container is implicit
#
simple-no-container:
runs-on: docker
services:
pgsql:
image: code.forgejo.org/oci/postgres:15
env:
POSTGRES_DB: test
POSTGRES_PASSWORD: postgres
steps:
- run: |
apt-get update -qq
apt-get install -y -qq postgresql-client
PGPASSWORD=postgres psql -h pgsql -U postgres -c '\dt' test
#
# No volume involved & the container is explicit
#
simple:
runs-on: docker

View file

@ -1,6 +1,6 @@
log:
level: info
level: debug
runner:
file: .runner
@ -10,7 +10,7 @@ runner:
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:16-bullseye"]
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: false

View file

@ -1,3 +1,3 @@
> /srv/example-service-volume-valid
> /srv/example-service-volume-invalid
>/srv/example-service-volume-valid
>/srv/example-service-volume-invalid
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -0,0 +1,21 @@
on:
push:
tags:
- 'v*'
jobs:
test:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
volumes:
- /srv/example:/srv/example
steps:
- name: save event
run: |
d=/srv/example/tag/contexts/$GITHUB_EVENT_NAME
mkdir -p $d
cat > $d/github <<'EOF'
${{ toJSON(github) }}
EOF

19
actions/example-tag/run.sh Executable file
View file

@ -0,0 +1,19 @@
export d=/srv/example/tag
function main() {
mkdir -p $d
local repo=root/example-$example
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
local sha=$(forgejo-test-helper.sh branch_tip $url $repo main)
local api=$url/api/v1
forgejo-curl.sh api_json --data-raw '{"tag_name":"v1.1","target":"'$sha'"}' $api/repos/$repo/tags
forgejo-test-helper.sh wait_success $url $repo $sha
test -f /srv/example/tag/contexts/push/github
}
main

View file

@ -0,0 +1,10 @@
on: [push]
jobs:
build:
runs-on: docker
container:
image: code.forgejo.org/oci/docker:cli
steps:
- run: ls -l /var/run/docker.sock
- run: docker ps

View file

@ -0,0 +1,30 @@
log:
level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: true
dir: "/srv/example/cache"
host: ""
port: 0
container:
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example"]
docker_host: "unix:///var/run/docker.sock"
host:
workdir_parent:

View file

@ -0,0 +1 @@
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -0,0 +1 @@
forgejo-runner.sh reload

View file

@ -0,0 +1,10 @@
on: [push]
jobs:
build:
runs-on: docker
container:
image: code.forgejo.org/oci/docker:cli
steps:
- run: ls -l /var/run/docker.sock
- run: docker ps

View file

@ -0,0 +1,30 @@
log:
level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: true
dir: "/srv/example/cache"
host: ""
port: 0
container:
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example"]
docker_host: "automount"
host:
workdir_parent:

View file

@ -0,0 +1 @@
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -0,0 +1 @@
forgejo-runner.sh reload

View file

@ -0,0 +1,11 @@
on: [push]
jobs:
build:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
steps:
- run: |
! test -e /var/run/docker.sock
! env | grep DOCKER_HOST

View file

@ -0,0 +1,30 @@
log:
level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: true
dir: "/srv/example/cache"
host: ""
port: 0
container:
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example"]
docker_host: "tcp://127.0.0.1:2375"
host:
workdir_parent:

View file

@ -0,0 +1 @@
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -0,0 +1 @@
forgejo-runner.sh reload

View file

@ -0,0 +1,6 @@
on: [push]
jobs:
test:
runs-on: docker
steps:
- run: "! test -e /var/run/docker.sock"

View file

@ -0,0 +1,57 @@
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log Level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
boolean_default_true:
description: 'Test scenario tags'
required: true
type: boolean
default: true
boolean_default_false:
description: 'Test scenario tags'
required: false
type: boolean
default: false
number1_default:
description: 'Number w. default'
default: '100'
type: number
number2:
description: 'Number w/o. default'
type: number
string1_default:
description: 'String w. default'
default: 'Hello world'
type: string
string2:
description: 'String w/o. default'
required: true
type: string
jobs:
test:
runs-on: docker
container:
image: code.forgejo.org/oci/debian:bookworm
options: "--volume /srv/example:/srv/example"
steps:
- name: save and display context
run: |
d=/srv/example/workflow-dispatch/contexts/$GITHUB_EVENT_NAME
mkdir -p $d
tee $d/github <<'EOF'
${{ toJSON(github) }}
EOF

View file

@ -0,0 +1,62 @@
TMPDIR=$(mktemp -d)
trap "rm -fr $TMPDIR" EXIT
source $EXAMPLE_DIR/../../lib/lib.sh
export d=/srv/example/tag
context=/srv/example/workflow-dispatch/contexts/workflow_dispatch/github
api=$url/api/v1
repo=root/example-$example
function context_wait() {
if ! forgejo.sh retry test -f $context; then
cat "$FORGEJO_RUNNER_LOGS"
false
fi
}
function verify_required() {
local actual=$(forgejo-curl.sh api_json -w '%{http_code}' --data '{"ref":"main","inputs":{}}' $api/repos/$repo/actions/workflows/test.yml/dispatches)
local expected=400
if test "$actual" != $expected; then
log_info "dispatch is expected to fail with status $expected because of string2 is a required value but got status $actual instead"
return 1
fi
}
function verify_inputs() {
local inputs='{"string2":"value2"}'
forgejo-curl.sh api_json --data '{"ref":"main","inputs":'$inputs'}' $api/repos/$repo/actions/workflows/test.yml/dispatches
cat >$TMPDIR/expected <<'EOF'
{
"boolean_default_false": "false",
"boolean_default_true": "true",
"logLevel": "warning",
"number1_default": "100",
"string1_default": "Hello world",
"string2": "value2"
}
EOF
}
function run_tests() {
verify_required
npm --silent install json-diff
verify_inputs
context_wait
node_modules/.bin/json-diff <(jq .event.inputs <$context) $TMPDIR/expected
}
function main() {
mkdir -p $d
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
run_tests
test "workflow_dispatch" = "$(jq -r .event_name <$context)"
}
main

View file

@ -0,0 +1 @@
mkdir -p /srv/example/workflow-dispatch

View file

@ -1,96 +0,0 @@
#!/bin/bash
set -e
function run() {
local example=$1
export example
export EXAMPLE_DIR=$(pwd)/actions/example-$example
if test -f $EXAMPLE_DIR/setup.sh ; then
echo "============================ SETUP example-$example ==================="
bash -ex $EXAMPLE_DIR/setup.sh || return 1
fi
if test -f $EXAMPLE_DIR/run.sh ; then
echo "============================ RUN example-$example ==================="
bash -ex $EXAMPLE_DIR/run.sh || return 1
else
forgejo-test-helper.sh run_workflow actions/example-$example $url root example-$example setup-forgejo $token || return 1
fi
if test -f $EXAMPLE_DIR/teardown.sh ; then
echo "============================ TEARDOWN example-$example ==================="
bash -ex $EXAMPLE_DIR/teardown.sh || return 1
fi
}
function examples_v1_20() {
echo 'echo checkout service container expression local-action docker-action if if-fail'
}
function examples_v1_21() {
# keep "cron" last otherwise it will linger and pollute the following runs
echo 'echo push-cancel artifacts service checkout pull-request container expression local-action docker-action if if-fail cron'
}
function examples_v1_22() {
examples_v1_21
}
function setup() {
local binary=$1
forgejo-binary.sh setup root admin1234 $binary
forgejo-runner.sh setup
}
function teardown() {
forgejo-curl.sh logout
forgejo-runner.sh teardown
forgejo-binary.sh teardown
}
function main() {
local binary="$1"
shift
export version="$1"
shift
export DOT=$DIR/forgejo-curl
teardown
if test "$#" = 0 ; then
examples=$(examples_$version)
else
examples="$@"
fi
if test "$examples" = "none" ; then
exit 0
fi
setup $binary
if ! test -f "$DIR/forgejo-auth-url" ; then
echo "DIR=$DIR must be a directory with a forgejo-auth-url file"
fi
export FORGEJO_RUNNER_LOGS=$DIR/forgejo-runner.log
export url=$(cat $DIR/forgejo-auth-url)
export token=$(cat $DIR/forgejo-token)
for example in $examples ; do
echo "======================== BEGIN example-$example ==================="
if ! time run $example >& /tmp/run.out ; then
cat /tmp/run.out
echo "======================== FAIL example-$example ==================="
sleep 5 # hack for Forgejo v1.21 to workaround a bug by which the last lines of the output are moved to the next step
false
fi
echo "======================== END example-$example ==================="
done
}
main "$@"

View file

@ -1,6 +1,5 @@
log:
level: info
level: debug
runner:
file: .runner
@ -23,7 +22,7 @@ container:
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example-pull-request"]
valid_volumes: ["/srv/example"]
docker_host: ""
host:

View file

@ -1 +0,0 @@
asfdsdfgsdfgdsg

15
end-to-end.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
# SPDX-License-Identifier: MIT
SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SELF="${BASH_SOURCE[0]}"
source $SELF_DIR/lib/lib.sh
source $SELF_DIR/federation/federation.sh
source $SELF_DIR/actions/actions.sh
source $SELF_DIR/forgejo/fixtures.sh
source $SELF_DIR/storage/storage.sh
source $SELF_DIR/upgrade/upgrade.sh
source $SELF_DIR/packages/packages.sh
"$@"

33
federation/ONE-app.ini Normal file
View file

@ -0,0 +1,33 @@
RUN_MODE = prod
WORK_PATH = forgejo-ONE
[server]
APP_DATA_PATH = ${WORK_PATH}/data
DOMAIN = ${IP}
HTTP_PORT = 3001
SSH_LISTEN_PORT = 2201
[queue]
TYPE = immediate
[database]
DB_TYPE = sqlite3
PATH = ${WORK_PATH}/forgejo.db
[log]
MODE = file
LEVEL = trace
ROUTER = file
[log.file]
FILE_NAME = forgejo.log
[security]
INSTALL_LOCK = true
[repository]
ENABLE_PUSH_CREATE_USER = true
DEFAULT_PUSH_CREATE_PRIVATE = false
[federation]
ENABLED = true

33
federation/TWO-app.ini Normal file
View file

@ -0,0 +1,33 @@
RUN_MODE = prod
WORK_PATH = forgejo-TWO
[server]
APP_DATA_PATH = ${WORK_PATH}/data
DOMAIN = ${IP}
HTTP_PORT = 3002
SSH_LISTEN_PORT = 2202
[queue]
TYPE = immediate
[database]
DB_TYPE = sqlite3
PATH = ${WORK_PATH}/forgejo.db
[log]
MODE = file
LEVEL = trace
ROUTER = file
[log.file]
FILE_NAME = forgejo.log
[security]
INSTALL_LOCK = true
[repository]
ENABLE_PUSH_CREATE_USER = true
DEFAULT_PUSH_CREATE_PRIVATE = false
[federation]
ENABLED = true

86
federation/federation.sh Executable file
View file

@ -0,0 +1,86 @@
# Copyright 2024 The Forgejo Authors
# SPDX-License-Identifier: MIT
FEDERATION_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export FEDERATION_INSTANCES="ONE TWO"
export FEDERATION_CONFIGS
function federation_setup_variables() {
if test "$FEDERATION_CONFIGS"; then
return
fi
for instance in $FEDERATION_INSTANCES; do
local config=$FEDERATION_DIR/$instance-app.ini
FEDERATION_CONFIGS="$FEDERATION_CONFIGS $config"
local base=$(work_path_base $config)
local work_path=$DIR/$base
local host_port=$(get_host_port $config)
eval export ${instance}_CONFIG=$config
eval export ${instance}_CURL=$work_path/forgejo-curl.sh
eval export ${instance}_HOST_PORT=$host_port
done
}
function federation_verify_scenario() {
local scenario=$1
export scenario
export SCENARIO_DIR=$FEDERATION_DIR/scenario-$scenario
if test -f $SCENARIO_DIR/setup.sh; then
echo "============================ SETUP scenario-$scenario ==================="
bash -ex $SCENARIO_DIR/setup.sh || return 1
fi
echo "============================ RUN scenario-$scenario ==================="
bash -ex $SCENARIO_DIR/run.sh || return 1
if test -f $SCENARIO_DIR/teardown.sh; then
echo "============================ TEARDOWN scenario-$scenario ==================="
bash -ex $SCENARIO_DIR/teardown.sh || return 1
fi
}
function federation_setup() {
federation_setup_variables
local version=$1
federation_teardown
local config
for config in $FEDERATION_CONFIGS; do
reset_forgejo $config
start_forgejo $version $config
done
}
function federation_teardown() {
federation_setup_variables
local config
for config in $FEDERATION_CONFIGS; do
stop_forgejo $config
done
}
function test_federation() {
# start_gitlab octobus/heptapod:1.5.3
federation_setup_variables
local versions="${1:-$RELEASE_NUMBERS}"
for version in $versions; do
if dpkg --compare-versions $version lt 7.1; then
continue
fi
federation_setup $version
for scenario in star; do
run federation_verify_scenario $scenario
done
done
}

View file

@ -0,0 +1,47 @@
TMPDIR=$(mktemp -d)
trap "rm -fr $TMPDIR" EXIT
source $SCENARIO_DIR/../../lib/lib.sh
function star_count() {
local curl=$1
local host_port=$2
local count=$3
$curl api_json http://$host_port/api/v1/repos/root/test >$TMPDIR/count.json
if test $count != $(jq -r .stars_count <$TMPDIR/count.json); then
jq . <$TMPDIR/count.json
return 1
fi
}
#
# create a repo on each instance
#
$ONE_CURL api_json --data '{"name":"test","auto_init":true}' $ONE_HOST_PORT/api/v1/user/repos >$TMPDIR/one-repo.json
one_repo_id=$(jq -r .id <$TMPDIR/one-repo.json)
$TWO_CURL api_json --data '{"name":"test","auto_init":true}' $TWO_HOST_PORT/api/v1/user/repos >$TMPDIR/two-repo.json
two_repo_id=$(jq -r .id <$TMPDIR/two-repo.json)
#
# the repo in instance two is federated with the repo in instance one
#
$ONE_CURL web --form action=federation --form following_repos=http://$TWO_HOST_PORT/api/v1/activitypub/repository-id/$two_repo_id http://$ONE_HOST_PORT/root/test/settings
#
# check that both repo have 0 star
#
star_count $ONE_CURL $ONE_HOST_PORT 0
star_count $TWO_CURL $TWO_HOST_PORT 0
#
# star the repo on instance one and expect the star to show on instance two
#
$ONE_CURL api_json -X PUT $ONE_HOST_PORT/api/v1/user/starred/root/test
#
# check that both repo have 1 star
#
star_count $ONE_CURL $ONE_HOST_PORT 1
retry star_count $TWO_CURL $TWO_HOST_PORT 1

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -1,30 +0,0 @@
#!/bin/bash
set -ex
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
version=$1
DIR=$2
v=$(echo $version | sed -E -e 's/([0-9]+\.[0-9]+).*/\1/')
read url ref semver < $SELF_DIR/sources/$v
rm -fr $DIR/src
if [[ "$ref" =~ ^refs/ ]] ; then
git clone --depth 1 $url $DIR/src
cd $DIR/src
git fetch origin +$ref:$ref
git checkout -b $v $ref
else
git clone --depth 1 -b $ref $url $DIR/src
cd $DIR/src
fi
export TAGS="bindata sqlite sqlite_unlock_notify"
make deps-backend backend
#
# use the gitea target here so that branches that do not contain the commit that adds
# the `forgejo` target to the Makefile can build successfully
#
make VERSION=v$version GITEA_VERSION=v$version FORGEJO_VERSION=$semver generate gitea
mv gitea $DIR/forgejo-$version

6
forgejo/fixtures.sh Normal file
View file

@ -0,0 +1,6 @@
# SPDX-License-Identifier: MIT
FIXTURES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source $FIXTURES_DIR/fixtures/storage.sh
source $FIXTURES_DIR/fixtures/doctor.sh

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: MIT
function doctor_run() {
local config=$1
local base=$(work_path_base $config)
local work_path=$DIR/$base
$work_path/forgejocli doctor check --all # --log-file -
}

View file

@ -1,4 +1,3 @@
#!/bin/bash
# SPDX-License-Identifier: MIT
#ONEPIXEL="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
@ -8,20 +7,44 @@
#
ONEPIXEL="iVBORw0KGgoAAAANSUhEUgAAASIAAAEiCAYAAABdvt+2AAADrElEQVR4nOzUMRHAMADEsL9eeQd6AsOLhMCT/7udAYS+OgDAiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDOiICcEQE5IwJyRgTkjAjIGRGQMyIgZ0RAzoiAnBEBOSMCckYE5IwIyBkRkDMiIGdEQM6IgJwRATkjAnJGBOSMCMgZEZAzIiBnREDuBQAA//+4jAPFe1H1tgAAAABJRU5ErkJggg=="
STORAGE_FUN="attachments avatars lfs packages repo_archive repo_avatars"
: ${FORGEJO_REPO:=fixture}
function fixture_get_paths_s3() {
local path=$1
(
echo -n $path/
mc ls --quiet --recursive testS3/$path | sed -e 's/.* //'
) > $DIR/path
mc ls --quiet --recursive testS3/$path | sed -e "s|.* |$path/|"
) >$DIR/path
}
function fixture_content_search_s3() {
local path="$1"
local expected="$2"
fixture_get_paths_s3 $path
if test $(wc -l <$DIR/path) -lt 1; then
echo expected at least one but got "'$(cat $DIR/path)'"
return 1
fi
for filename in $(cat $DIR/path); do
local content=$(mc cat testS3/$filename | base64 -w0)
if test "$content" = "$expected"; then
return 0
fi
done
echo nothing in $path found with the expected content "$expected"
return 1
}
function fixture_get_paths_local() {
local path=$1
local work_path=$DIR/forgejo-work-path
( cd $work_path ; find $path -type f) > $DIR/path
(
cd $work_path
find $path -type f
) >$DIR/path
}
function fixture_get_one_path() {
@ -30,7 +53,7 @@ function fixture_get_one_path() {
fixture_get_paths_$storage $path
if test $(wc -l < $DIR/path) != 1 ; then
if test $(wc -l <$DIR/path) != 1; then
echo expected one path but got
cat $DIR/path
return 1
@ -57,13 +80,25 @@ function fixture_lfs_create() {
(
cd $DIR/fixture
git lfs track "*.txt"
echo CONTENT > file.txt
echo CONTENT >file.txt
git add .
git commit -m 'lfs files'
git push
)
}
function fixture_lfs_assert() {
local d=$(mktemp -d)
(
git clone http://${FORGEJO_USER}:${FORGEJO_PASSWORD}@${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO} $d/${FORGEJO_REPO}
cd $d/${FORGEJO_REPO}
rm file.txt
git-lfs checkout file.txt
test -f file.txt
)
rm -fr $d
}
function fixture_lfs_assert_s3() {
local content=$(mc cat testS3/forgejo/lfs/d6/1e/5fa787e50330288923bd0c9866b44643925965144262288447cf52f9f9b7)
test "$content" = CONTENT
@ -78,9 +113,9 @@ function fixture_lfs_assert_local() {
}
function fixture_packages_create() {
echo PACKAGE_CONTENT > $DIR/fixture/package
$work_path/forgejo-api -X DELETE http://${HOST_PORT}/api/packages/${FORGEJO_USER}/generic/test_package/1.0.0/file.txt || true
$work_path/forgejo-api --upload-file $DIR/fixture/package http://${HOST_PORT}/api/packages/${FORGEJO_USER}/generic/test_package/1.0.0/file.txt
echo PACKAGE_CONTENT >$DIR/fixture/package
forgejo-curl.sh api_json -X DELETE http://${HOST_PORT}/api/packages/${FORGEJO_USER}/generic/test_package/1.0.0/file.txt || true
forgejo-curl.sh api_json --upload-file $DIR/fixture/package http://${HOST_PORT}/api/packages/${FORGEJO_USER}/generic/test_package/1.0.0/file.txt
}
function fixture_packages_assert_s3() {
@ -96,14 +131,12 @@ function fixture_packages_assert_local() {
}
function fixture_avatars_create() {
echo -n $ONEPIXEL | base64 --decode > $DIR/avatar.png
$work_path/forgejo-client --form avatar=@$DIR/avatar.png http://${HOST_PORT}/user/settings/avatar
echo -n $ONEPIXEL | base64 --decode >$DIR/avatar.png
forgejo-curl.sh web --form avatar=@$DIR/avatar.png http://${HOST_PORT}/user/settings/avatar
}
function fixture_avatars_assert_s3() {
local filename=$(fixture_get_one_path s3 forgejo/avatars)
local content=$(mc cat testS3/$filename | base64 -w0)
test "$content" = "$ONEPIXEL"
fixture_content_search_s3 forgejo/avatars "$ONEPIXEL"
}
function fixture_avatars_assert_local() {
@ -115,10 +148,8 @@ function fixture_avatars_assert_local() {
}
function fixture_repo_avatars_create() {
echo -n $ONEPIXEL | base64 --decode > $DIR/repo-avatar.png
$work_path/forgejo-client --form avatar=@$DIR/repo-avatar.png http://${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}/settings/avatar
# v1.21 only
#$work_path/forgejo-api -X POST --data-raw '{"body":"'$avatar'"}' http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/avatar
echo -n $ONEPIXEL | base64 --decode >$DIR/repo-avatar.png
forgejo-curl.sh web --form avatar=@$DIR/repo-avatar.png http://${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}/settings/avatar
}
function fixture_repo_avatars_assert_s3() {
@ -136,18 +167,18 @@ function fixture_repo_avatars_assert_local() {
}
function fixture_attachments_create_1_18() {
echo -n $ONEPIXEL | base64 --decode > $DIR/attachment.png
$work_path/forgejo-client --trace-ascii - --form file=@$DIR/attachment.png http://${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}/issues/attachments
echo -n $ONEPIXEL | base64 --decode >$DIR/attachment.png
forgejo-curl.sh web --trace-ascii - --form file=@$DIR/attachment.png http://${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}/issues/attachments
}
function fixture_attachments_create() {
if $work_path/forgejo-api http://${HOST_PORT}/api/v1/version | grep --quiet --fixed-strings 1.18. ; then
if forgejo-curl.sh api_json http://${HOST_PORT}/api/v1/version | grep --quiet --fixed-strings 1.18.; then
fixture_attachments_create_1_18
return
fi
id=$($work_path/forgejo-api --data-raw '{"title":"TITLE"}' http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/issues | jq .id)
echo -n $ONEPIXEL | base64 --decode > $DIR/attachment.png
$work_path/forgejo-client -H @$DIR/forgejo-work-path/forgejo-header --form name=attachment.png --form attachment=@$DIR/attachment.png http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/issues/$id/assets
id=$(forgejo-curl.sh api_json --data-raw '{"title":"TITLE"}' http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/issues | jq .id)
echo -n $ONEPIXEL | base64 --decode >$DIR/attachment.png
forgejo-curl.sh api --form name=attachment.png --form attachment=@$DIR/attachment.png http://${HOST_PORT}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}/issues/$id/assets
}
function fixture_attachments_assert_s3() {
@ -176,12 +207,18 @@ function fixture_create() {
git remote add origin http://${FORGEJO_USER}:${FORGEJO_PASSWORD}@${HOST_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}
git config user.email root@example.com
git config user.name username
echo SOMETHING > README
echo SOMETHING >README
git add README
git commit -m 'initial commit'
git push --set-upstream --force origin main
)
for fun in ${STORAGE_FUN} ; do
for fun in ${STORAGE_FUN}; do
fixture_${fun}_create
done
}
function fixture_assert() {
for fun in lfs; do
fixture_${fun}_assert
done
}

View file

@ -1 +0,0 @@
https://codeberg.org/forgejo/forgejo v1.20/forgejo 5.0.0+0-gitea-1.20.0

View file

@ -1 +0,0 @@
https://codeberg.org/forgejo/forgejo v1.21/forgejo 6.0.0+0-gitea-1.21.0

View file

@ -1 +0,0 @@
https://codeberg.org/forgejo/forgejo forgejo 7.0.0+0-gitea-1.22.0

1
forgejo/sources/10.0 Normal file
View file

@ -0,0 +1 @@
https://codeberg.org/forgejo/forgejo forgejo 10.0.0+gitea-1.22

1
forgejo/sources/11.0 Normal file
View file

@ -0,0 +1 @@
https://codeberg.org/forgejo/forgejo forgejo 11.0.0

1
forgejo/sources/7.0 Normal file
View file

@ -0,0 +1 @@
https://codeberg.org/forgejo/forgejo v7.0/forgejo 7.0.0+gitea-1.21.0

1
forgejo/sources/8.0 Normal file
View file

@ -0,0 +1 @@
https://codeberg.org/forgejo/forgejo v8.0/forgejo 8.0.0+gitea-1.22.0

1
forgejo/sources/9.0 Normal file
View file

@ -0,0 +1 @@
https://codeberg.org/forgejo/forgejo forgejo 9.0.0+gitea-1.22.0

View file

@ -1,59 +0,0 @@
RUN_MODE = prod
WORK_PATH = ${WORK_PATH}
[server]
APP_DATA_PATH = ${WORK_PATH}/elsewhere
HTTP_PORT = 3000
SSH_LISTEN_PORT = 2222
LFS_START_SERVER = true
[database]
DB_TYPE = sqlite3
[log]
MODE = file
LEVEL = debug
ROUTER = file
[log.file]
FILE_NAME = forgejo.log
[security]
INSTALL_LOCK = true
[repository]
ENABLE_PUSH_CREATE_USER = true
DEFAULT_PUSH_CREATE_PRIVATE = false
[actions]
ENABLED = true
[attachment]
[storage.attachments]
PATH = ${WORK_PATH}/data/attachments
[lfs]
[storage.lfs]
PATH = ${WORK_PATH}/data/lfs
[avatar]
[storage.avatars]
PATH = ${WORK_PATH}/data/avatars
[repo-avatar]
[storage.repo-avatars]
PATH = ${WORK_PATH}/data/repo-avatars
[repo-archive]
[storage.repo-archive]
PATH = ${WORK_PATH}/data/repo-archive
[packages]
[storage.packages]
PATH = ${WORK_PATH}/data/packages

View file

@ -1,89 +0,0 @@
RUN_MODE = prod
WORK_PATH = ${WORK_PATH}
[server]
APP_DATA_PATH = ${WORK_PATH}/elsewhere
HTTP_PORT = 3000
SSH_LISTEN_PORT = 2222
LFS_START_SERVER = true
[database]
DB_TYPE = sqlite3
[log]
MODE = file
LEVEL = debug
ROUTER = file
[log.file]
FILE_NAME = forgejo.log
[security]
INSTALL_LOCK = true
[repository]
ENABLE_PUSH_CREATE_USER = true
DEFAULT_PUSH_CREATE_PRIVATE = false
[actions]
ENABLED = true
[attachment]
STORAGE_TYPE = minio
SERVE_DIRECT = false
MINIO_ENDPOINT = 127.0.0.1:9000
MINIO_ACCESS_KEY_ID = 123456
MINIO_SECRET_ACCESS_KEY = 12345678
MINIO_BUCKET = forgejo
MINIO_LOCATION = us-east-1
MINIO_USE_SSL = false
[lfs]
STORAGE_TYPE = minio
SERVE_DIRECT = false
MINIO_ENDPOINT = 127.0.0.1:9000
MINIO_ACCESS_KEY_ID = 123456
MINIO_SECRET_ACCESS_KEY = 12345678
MINIO_BUCKET = forgejo
MINIO_LOCATION = us-east-1
MINIO_USE_SSL = false
[repo-avatar]
STORAGE_TYPE = minio
SERVE_DIRECT = false
MINIO_ENDPOINT = 127.0.0.1:9000
MINIO_ACCESS_KEY_ID = 123456
MINIO_SECRET_ACCESS_KEY = 12345678
MINIO_BUCKET = forgejo
MINIO_LOCATION = us-east-1
MINIO_USE_SSL = false
[avatar]
STORAGE_TYPE = minio
SERVE_DIRECT = false
MINIO_ENDPOINT = 127.0.0.1:9000
MINIO_ACCESS_KEY_ID = 123456
MINIO_SECRET_ACCESS_KEY = 12345678
MINIO_BUCKET = forgejo
MINIO_LOCATION = us-east-1
MINIO_USE_SSL = false
[repo-archive]
STORAGE_TYPE = minio
SERVE_DIRECT = false
MINIO_ENDPOINT = 127.0.0.1:9000
MINIO_ACCESS_KEY_ID = 123456
MINIO_SECRET_ACCESS_KEY = 12345678
MINIO_BUCKET = forgejo
MINIO_LOCATION = us-east-1
MINIO_USE_SSL = false
[packages]
STORAGE_TYPE = minio
SERVE_DIRECT = false
MINIO_ENDPOINT = 127.0.0.1:9000
MINIO_ACCESS_KEY_ID = 123456
MINIO_SECRET_ACCESS_KEY = 12345678
MINIO_BUCKET = forgejo
MINIO_LOCATION = us-east-1
MINIO_USE_SSL = false

Some files were not shown because too many files have changed in this diff Show more