diff --git a/.forgejo/pull_request_template.md b/.forgejo/pull_request_template.md index a0f74ae31d..44c28e333e 100644 --- a/.forgejo/pull_request_template.md +++ b/.forgejo/pull_request_template.md @@ -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)). diff --git a/.forgejo/workflows/testing.yml b/.forgejo/workflows/testing.yml index 709ab71e18..f9cce74258 100644 --- a/.forgejo/workflows/testing.yml +++ b/.forgejo/workflows/testing.yml @@ -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' diff --git a/Makefile b/Makefile index aa96922bf5..99670829bb 100644 --- a/Makefile +++ b/Makefile @@ -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 ### diff --git a/tools/cimake.sh b/tools/cimake.sh new file mode 100755 index 0000000000..438745e32e --- /dev/null +++ b/tools/cimake.sh @@ -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}"