1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-10-23 05:08:55 +03:00

Stop collecting test coverage on CI

CI collected coverage data from the unit and integration tests only for
the Codacy upload. Nothing else reads it.

Remove the coverage flags, the LAZYGIT_GOCOVERDIR env var and the
artifact uploads from the CI workflow. Keep the support for
LAZYGIT_GOCOVERDIR in run_integration_tests.sh and in the integration
test runner, so that we can still measure the coverage of the
integration tests locally.

Remove the step in run_integration_tests.sh that merges the coverage
files, though. It only existed to reduce the number of artifacts to
upload.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-10-17 10:46:28 +02:00
parent a181c3ec3a
commit 6d46f2c0f4
2 changed files with 2 additions and 29 deletions

View File

@@ -35,14 +35,7 @@ jobs:
go-version: ${{ env.GO_VERSION }}
- name: Test code
# we're passing -short so that we skip the integration tests, which will be run in parallel below
run: |
mkdir -p /tmp/code_coverage
go test ./... -short -cover -args "-test.gocoverdir=/tmp/code_coverage"
- name: Upload code coverage artifacts
uses: actions/upload-artifact@v7
with:
name: coverage-unit-${{ matrix.os }}-${{ github.run_id }}
path: /tmp/code_coverage
run: go test ./... -short
integration-tests:
strategy:
@@ -100,11 +93,6 @@ jobs:
run: git --version
- name: Test code
env:
# See https://go.dev/blog/integration-test-coverage. The race variant
# skips coverage: it's redundant with the non-race latest job and
# would only slow the -race build down further. Leaving the dir unset
# makes run_integration_tests.sh take its non-coverage path.
LAZYGIT_GOCOVERDIR: ${{ !matrix.race && '/tmp/code_coverage' || '' }}
# Only set for the race variant. The race detector needs cgo; it's on
# by default on the Linux runner, but we set it explicitly to be safe.
LAZYGIT_RACE_DETECTOR: ${{ matrix.race && '1' || '' }}
@@ -112,15 +100,7 @@ jobs:
# Append each test's duration to this file; run_integration_tests.sh
# prints the slowest at the end, to spot slow/anomalous tests.
LAZYGIT_TEST_TIMING: /tmp/test_timings.txt
run: |
mkdir -p /tmp/code_coverage
./scripts/run_integration_tests.sh
- name: Upload code coverage artifacts
if: ${{ !matrix.race }}
uses: actions/upload-artifact@v7
with:
name: coverage-integration-${{ matrix.git-version }}-${{ github.run_id }}
path: /tmp/code_coverage
run: ./scripts/run_integration_tests.sh
build:
runs-on: ubuntu-latest
env:

View File

@@ -11,13 +11,6 @@ if [ -n "$LAZYGIT_GOCOVERDIR" ]; then
# and then internally passing that to the test binary as GOCOVERDIR.
go test -timeout 30m -cover -coverpkg=github.com/jesseduffield/lazygit/pkg/... pkg/integration/clients/*.go -args -test.gocoverdir="/tmp/code_coverage"
EXITCODE=$?
# We're merging the coverage data for the sake of having fewer artefacts to upload.
# We can't merge inline so we're merging to a tmp dir then moving back to the original.
mkdir -p /tmp/code_coverage_merged
go tool covdata merge -i=/tmp/code_coverage -o=/tmp/code_coverage_merged
rm -rf /tmp/code_coverage
mv /tmp/code_coverage_merged /tmp/code_coverage
else
go test -timeout 30m pkg/integration/clients/*.go
EXITCODE=$?