From 6d46f2c0f4b7908b57dfbfd647d98d99223f2777 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 17 Oct 2026 10:46:28 +0200 Subject: [PATCH] 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) --- .github/workflows/ci.yml | 24 ++---------------------- scripts/run_integration_tests.sh | 7 ------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa33374c7..5d8307574 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 0c659ebfa..1b7234d02 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -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=$?