From a181c3ec3aa7d5c1915349082d9e6d2d0b451422 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 17 Oct 2026 10:43:56 +0200 Subject: [PATCH 1/5] Stop uploading test coverage to Codacy Codacy hasn't analysed this repository since April 2026, because status checks are disabled for it in Codacy's settings. The uploads from CI still succeed, but the commits never show up in Codacy, and the coverage badge in the README shows 0%. On Dependabot PRs the upload fails outright. These runs don't get the CODACY_PROJECT_TOKEN secret. We decided not to revive the integration. Remove the upload job and the two Codacy badges. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/ci.yml | 37 ------------------------------------- README.md | 2 +- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 666ca7b78..aa33374c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -196,43 +196,6 @@ jobs: with: # If you change this, make sure to also update scripts/golangci-lint-shim.sh version: v2.15.0 - upload-coverage: - # List all jobs that produce coverage files - needs: [unit-tests, integration-tests] - if: github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v7 - - - name: Setup Go - uses: actions/setup-go@v7 - with: - go-version: ${{ env.GO_VERSION }} - - - name: Download all coverage artifacts - uses: actions/download-artifact@v8 - with: - path: /tmp/code_coverage - - - name: Combine coverage files - run: | - # Find all directories in /tmp/code_coverage and create a comma-separated list - COVERAGE_DIRS=$(find /tmp/code_coverage -mindepth 1 -maxdepth 1 -type d -printf '/tmp/code_coverage/%f,' | sed 's/,$//') - echo "Coverage directories: $COVERAGE_DIRS" - # Run the combine command with the generated list - go tool covdata textfmt -i=$COVERAGE_DIRS -o coverage.out - echo "Combined coverage:" - go tool cover -func coverage.out | tail -1 | awk '{print $3}' - - - name: Upload to Codacy - run: | - CODACY_PROJECT_TOKEN="${CODACY_PROJECT_TOKEN}" \ - bash <(curl -Ls https://coverage.codacy.com/get.sh) report \ - --force-coverage-parser go -r coverage.out - - env: - CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} check-for-fixups: runs-on: ubuntu-latest if: github.ref != 'refs/heads/master' diff --git a/README.md b/README.md index 8e2bf8a46..c6e1c762d 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ A simple terminal UI for git commands
-[![GitHub Releases](https://img.shields.io/github/downloads/jesseduffield/lazygit/total)](https://github.com/jesseduffield/lazygit/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/jesseduffield/lazygit)](https://goreportcard.com/report/github.com/jesseduffield/lazygit) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/f46416b715d74622895657935fcada21)](https://app.codacy.com/gh/jesseduffield/lazygit/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/f46416b715d74622895657935fcada21)](https://app.codacy.com/gh/jesseduffield/lazygit/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage) [![golangci-lint](https://img.shields.io/badge/linted%20by-golangci--lint-brightgreen)](https://golangci-lint.run/) [![GitHub tag](https://img.shields.io/github/v/tag/jesseduffield/lazygit?color=blue)](https://github.com/jesseduffield/lazygit/releases/latest) [![homebrew](https://img.shields.io/homebrew/v/lazygit?color=blue)](https://formulae.brew.sh/formula/lazygit) +[![GitHub Releases](https://img.shields.io/github/downloads/jesseduffield/lazygit/total)](https://github.com/jesseduffield/lazygit/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/jesseduffield/lazygit)](https://goreportcard.com/report/github.com/jesseduffield/lazygit) [![golangci-lint](https://img.shields.io/badge/linted%20by-golangci--lint-brightgreen)](https://golangci-lint.run/) [![GitHub tag](https://img.shields.io/github/v/tag/jesseduffield/lazygit?color=blue)](https://github.com/jesseduffield/lazygit/releases/latest) [![homebrew](https://img.shields.io/homebrew/v/lazygit?color=blue)](https://formulae.brew.sh/formula/lazygit) From 6d46f2c0f4b7908b57dfbfd647d98d99223f2777 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 17 Oct 2026 10:46:28 +0200 Subject: [PATCH 2/5] 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=$? From 5b212e184b4d8908088f11f6117cdc0d6082626d Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 17 Oct 2026 10:46:36 +0200 Subject: [PATCH 3/5] Remove the Go Report Card badge Go Report Card has shut down. The badge now reads "go report: retired", and the report page only shows a farewell note. That note recommends golangci-lint as the replacement, and we already show a badge for it. Co-Authored-By: Claude Opus 5.5 (1M context) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c6e1c762d..e40b06b6c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ A simple terminal UI for git commands
-[![GitHub Releases](https://img.shields.io/github/downloads/jesseduffield/lazygit/total)](https://github.com/jesseduffield/lazygit/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/jesseduffield/lazygit)](https://goreportcard.com/report/github.com/jesseduffield/lazygit) [![golangci-lint](https://img.shields.io/badge/linted%20by-golangci--lint-brightgreen)](https://golangci-lint.run/) [![GitHub tag](https://img.shields.io/github/v/tag/jesseduffield/lazygit?color=blue)](https://github.com/jesseduffield/lazygit/releases/latest) [![homebrew](https://img.shields.io/homebrew/v/lazygit?color=blue)](https://formulae.brew.sh/formula/lazygit) +[![GitHub Releases](https://img.shields.io/github/downloads/jesseduffield/lazygit/total)](https://github.com/jesseduffield/lazygit/releases) [![golangci-lint](https://img.shields.io/badge/linted%20by-golangci--lint-brightgreen)](https://golangci-lint.run/) [![GitHub tag](https://img.shields.io/github/v/tag/jesseduffield/lazygit?color=blue)](https://github.com/jesseduffield/lazygit/releases/latest) [![homebrew](https://img.shields.io/homebrew/v/lazygit?color=blue)](https://formulae.brew.sh/formula/lazygit) From 232b3c5e08d0f3f2235a7f24bbba45cd2d81354b Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 17 Oct 2026 11:52:13 +0200 Subject: [PATCH 4/5] Fix a typo in a comment in run_integration_tests.sh Co-Authored-By: Claude Opus 5.5 (1M context) --- scripts/run_integration_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 1b7234d02..1fa572988 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -7,7 +7,7 @@ if [ -n "$LAZYGIT_GOCOVERDIR" ]; then # Go expects us to either be running the test binary directly or running `go test`, but because # we're doing both and because we want to combine coverage data for both, we need to be a little # hacky. To capture the coverage data for the test runner we pass the test.gocoverdir positional - # arg, but if we do that then the GOCOVERDIR env var (which you typically pass to the test binary) will be overwritten by the test runner. So we're passing LAZYGIT_COCOVERDIR instead + # arg, but if we do that then the GOCOVERDIR env var (which you typically pass to the test binary) will be overwritten by the test runner. So we're passing LAZYGIT_GOCOVERDIR instead # 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=$? From cb5c127b55f3c9bcf3b2290ed4fb1c0fe1758fd9 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 17 Oct 2026 11:53:31 +0200 Subject: [PATCH 5/5] Write all integration test coverage to LAZYGIT_GOCOVERDIR If LAZYGIT_GOCOVERDIR is set, run_integration_tests.sh collects the coverage of the integration tests. Only the lazygit binary writes its data to that directory, though. The test runner always writes to /tmp/code_coverage, so the data ends up in two places unless the variable points there. On CI it always did. Also, the run fails if the directory doesn't exist yet. With a relative path, the binary's data goes missing, because the binary runs in the directory of the test's repo. Pass the directory to the test runner too, create it if needed, and turn it into an absolute path. Co-Authored-By: Claude Opus 5.5 (1M context) --- scripts/run_integration_tests.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 1fa572988..1d6dcbaa4 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -9,7 +9,13 @@ if [ -n "$LAZYGIT_GOCOVERDIR" ]; then # hacky. To capture the coverage data for the test runner we pass the test.gocoverdir positional # arg, but if we do that then the GOCOVERDIR env var (which you typically pass to the test binary) will be overwritten by the test runner. So we're passing LAZYGIT_GOCOVERDIR instead # 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" + # + # Go doesn't create the coverage directory itself. The lazygit binary runs in + # the directory of the test's repo, so it also needs an absolute path. + mkdir -p "$LAZYGIT_GOCOVERDIR" + LAZYGIT_GOCOVERDIR=$(cd "$LAZYGIT_GOCOVERDIR" && pwd) + export LAZYGIT_GOCOVERDIR + go test -timeout 30m -cover -coverpkg=github.com/jesseduffield/lazygit/pkg/... pkg/integration/clients/*.go -args -test.gocoverdir="$LAZYGIT_GOCOVERDIR" EXITCODE=$? else go test -timeout 30m pkg/integration/clients/*.go