chore: move backend-checks CI checks to Makefile: make pr-go (#11053)

This is to have a simple and consistent make target for developers to locally run the checks which the CI will also run. The goal is to avoid wasting review cycles on CI failures.

To have a single source of truth, the CI is adjusted to call the same make target. Additional checks should no longer be added to the CI workflow, but rather to the makefile.

The pull request template is adjusted to remind of running this make target.

CI output is improved by using a simple bash script which uses sed to add `##[group]` tags to "make --debug=b" output and filter out messages which usually do not contribute to understanding. While this approach has limits and depends on the specific debug output format of GNU make, it avoids adjusting the makefile itself for additional CI beautification, contributing to maintainability.

- no tests needed (this is purely a build change)
- docs: hint added to PR template
- no release notes needed

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11053
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Nils Goroll <nils.goroll@uplex.de>
Co-committed-by: Nils Goroll <nils.goroll@uplex.de>
This commit is contained in:
Nils Goroll 2026-02-17 02:41:40 +01:00 committed by Gusted
parent d4de6a4e5c
commit a81fc2a290
4 changed files with 38 additions and 3 deletions

View file

@ -12,11 +12,20 @@ labels:
The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).
### Tests
### Tests for Go changes
(can be removed for JavaScript changes)
- I added test coverage for Go changes...
- [ ] in their respective `*_test.go` for unit tests.
- [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
- [ ] `make pr-go` before pushing
### Tests for JavaScript changes
(can be removed for Go changes)
- I added test coverage for JavaScript changes...
- [ ] in `web_src/js/*.test.js` if it can be unit tested.
- [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

View file

@ -24,8 +24,10 @@ jobs:
EOF
- uses: https://data.forgejo.org/actions/checkout@v6
- uses: ./.forgejo/workflows-composite/setup-env
- run: su forgejo -c 'make deps-backend deps-tools'
- run: su forgejo -c 'make --always-make -j$(nproc) lint-backend tidy-check swagger-check lint-swagger fmt-check swagger-validate' # ensure the "go-licenses" make target runs
# DO NOT add checks here, but rather in the makefile
- run: su forgejo -c './tools/cimake.sh pr-go'
# this will re-run the backend target also contained in pr-go, but
# a re-build is insignificant
- uses: ./.forgejo/workflows-composite/build-backend
frontend-checks:
if: vars.ROLE == 'forgejo-coding' || vars.ROLE == 'forgejo-testing'

View file

@ -520,6 +520,11 @@ security-check:
tsc: node_modules
npx tsc --noEmit
# target for PRs to be pushed. Mandatory to succeed in CI
.PHONY: pr-go
pr-go: deps-backend deps-tools lint-backend tidy-check swagger-check lint-swagger fmt-check swagger-validate
TAGS=bindata $(MAKE) backend
###
# Development and testing targets
###

19
tools/cimake.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
# GNU make wrapper for invocation from ci to generate grouping of output
# pipefail: fail if make fails, because sed will not
set -euo pipefail
script='
/^ *Prerequisite .* is newer than target /d;
/^ * File .* does not exist/d;
/^ *Must remake target/ s:^ *Must remake target:\#\#[group]:;
/^ *Successfully remade target/ s:^ *Successfully remade target file:\#\#[endgroup]:;
'
echo 'NOTICE: This is post-processed make output with some messages suppressed'
echo
# -O is important to not mix up output for parallel makes
exec make --debug=b -O -j$(nproc) "$@" 2>&1 | sed -u -e "${script}"