Add coverage (#914)

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/914
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-08-21 04:54:52 +00:00 committed by earl-warren
parent fea037d403
commit 8f920b4b7a
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201
4 changed files with 31 additions and 2 deletions

View file

@ -0,0 +1,11 @@
inputs:
scope:
description: 'Scope of the coverage'
runs:
using: "composite"
steps:
- uses: actions/upload-artifact@v3
with:
name: coverage-${{ inputs.scope }}
path: /tmp/forgejo-end-to-end/coverage

View file

@ -86,6 +86,10 @@ jobs:
with:
built: ${{ needs.build.outputs.built }}
- run: su forgejo -c "./end-to-end.sh test_packages"
- if: ${{ needs.build.outputs.built == 'yes' }}
uses: ./.forgejo/upload-coverage
with:
scope: packages
- name: full logs
if: always()
run: su forgejo -c "./end-to-end.sh show_logs"
@ -100,6 +104,10 @@ jobs:
built: ${{ needs.build.outputs.built }}
- run: ./end-to-end.sh prepare_dockerd
- run: su forgejo -c "./end-to-end.sh test_actions"
- if: ${{ needs.build.outputs.built == 'yes' }}
uses: ./.forgejo/upload-coverage
with:
scope: actions
- name: full logs
if: always()
run: su forgejo -c "./end-to-end.sh show_logs"
@ -124,6 +132,10 @@ jobs:
key: gitlab
- run: |
su forgejo -c "./end-to-end.sh test_federation"
- if: ${{ needs.build.outputs.built == 'yes' }}
uses: ./.forgejo/upload-coverage
with:
scope: federation
- name: full logs
if: always()
run: su forgejo -c "./end-to-end.sh show_logs"
@ -187,6 +199,10 @@ jobs:
built: ${{ needs.build.outputs.built }}
- run: su forgejo -c "./end-to-end.sh test_upgrades"
- run: su forgejo -c "./end-to-end.sh test_storage"
- if: ${{ needs.build.outputs.built == 'yes' }}
uses: ./.forgejo/upload-coverage
with:
scope: upgrade
- name: full logs
if: always()
run: su forgejo -c "./end-to-end.sh show_logs"

View file

@ -36,7 +36,7 @@ done
git fetch --update-head-ok origin +$ref:$ref
git switch --force-create $v $ref
export TAGS="bindata sqlite sqlite_unlock_notify" FORGEJO_VERSION=$semver
export TAGS="bindata sqlite sqlite_unlock_notify" FORGEJO_VERSION=$semver EXTRA_GOFLAGS="-cover"
make deps-backend backend
make generate forgejo
cp -a forgejo $dir_binaries/forgejo-$v-dev

View file

@ -31,6 +31,7 @@ RELEASE_NUMBERS="11.0 12.0 13.0"
PREFIX===============
export DIR=/tmp/forgejo-end-to-end
DIR_BINARIES=/srv/forgejo-binaries
COVERAGE_DIR="$DIR/coverage"
export DOT_FORGEJO_CURL=$DIR/forgejo-curl
export DOT=$DOT_FORGEJO_CURL # for backward compatibility with forgejo-curl.sh 1.0.0
: ${FORGEJO_USER:=root}
@ -262,7 +263,8 @@ function start_forgejo_daemon() {
local base=$(work_path_base $config)
local work_path=$DIR/$base
daemon --chdir=$DIR --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --pidfile=$DIR/$base-pid --errlog=$DIR/$base-err.log --output=$DIR/$base-out.log -- $binary --config $work_path/app.ini --work-path $work_path
mkdir -p $COVERAGE_DIR
daemon --chdir=$DIR --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --env="GOCOVERDIR=$COVERAGE_DIR" --pidfile=$DIR/$base-pid --errlog=$DIR/$base-err.log --output=$DIR/$base-out.log -- $binary --config $work_path/app.ini --work-path $work_path
if ! retry grep --no-messages --quiet 'Starting server on' $work_path/log/forgejo.log; then
grep '' $DIR/$base*.log
grep '' $work_path/log/*.log 2>/dev/null