From 48068e1da4ed74204a8a28c7be6d6271a95fd895 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 09:56:28 +0500 Subject: [PATCH 01/17] Add badge through tj-actions/coverage-badge-go@v2 --- .github/workflows/ci.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9fa6f6a..067a623 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -173,6 +173,32 @@ jobs: coverage.out coverage.html + - name: Go Coverage Badge # Pass the `coverage.out` output to this action + uses: tj-actions/coverage-badge-go@v2 + with: + filename: coverage.out + + - name: Verify Changed files + uses: tj-actions/verify-changed-files@v16 + id: verify-changed-files + with: + files: README.md + + - name: Commit changes + if: matrix.module == 'v2' && steps.verify-changed-files.outputs.files_changed == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add README.md + git commit -m "chore: Updated coverage badge." + + - name: Push changes + if: matrix.module == 'v2' && steps.verify-changed-files.outputs.files_changed == 'true' + uses: ad-m/github-push-action@master + with: + github_token: ${{ github.token }} + branch: ${{ github.head_ref }} + - name: Add coverage to PR comment if: github.event_name == 'pull_request' run: | From f5b974e9696c23cbb5aeb34692f1329adbf1b75c Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 09:58:08 +0500 Subject: [PATCH 02/17] Use v2 --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 067a623..04d10ea 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -176,7 +176,7 @@ jobs: - name: Go Coverage Badge # Pass the `coverage.out` output to this action uses: tj-actions/coverage-badge-go@v2 with: - filename: coverage.out + filename: ${{matrix.path}}/coverage.out - name: Verify Changed files uses: tj-actions/verify-changed-files@v16 From da8b62845fef516be18dba8b0c91beb876d4da31 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:00:38 +0500 Subject: [PATCH 03/17] Fix path --- .github/workflows/ci.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 04d10ea..95e2fe8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -174,22 +174,24 @@ jobs: coverage.html - name: Go Coverage Badge # Pass the `coverage.out` output to this action + if: matrix.module == 'v2' uses: tj-actions/coverage-badge-go@v2 with: - filename: ${{matrix.path}}/coverage.out + filename: v2/coverage.out - name: Verify Changed files + if: matrix.module == 'v2' uses: tj-actions/verify-changed-files@v16 id: verify-changed-files with: - files: README.md + files: ../README.md - name: Commit changes if: matrix.module == 'v2' && steps.verify-changed-files.outputs.files_changed == 'true' run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git add README.md + git add ../README.md git commit -m "chore: Updated coverage badge." - name: Push changes From 5e256b0a3ec340b68223fb6eb9b3e4d45afeb693 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:02:45 +0500 Subject: [PATCH 04/17] Fix path --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 95e2fe8..cdb2324 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -184,7 +184,7 @@ jobs: uses: tj-actions/verify-changed-files@v16 id: verify-changed-files with: - files: ../README.md + files: README.md - name: Commit changes if: matrix.module == 'v2' && steps.verify-changed-files.outputs.files_changed == 'true' From ce3b39955ada676c172b3378da0a04a0a1edd318 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:11:16 +0500 Subject: [PATCH 05/17] Fix path --- .github/workflows/ci.yaml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cdb2324..3073e33 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -117,10 +117,6 @@ jobs: - module: v2 path: v2 - defaults: - run: - working-directory: ${{ matrix.path }} - steps: - name: Checkout code uses: actions/checkout@v4 @@ -147,6 +143,7 @@ jobs: run: go test -coverprofile=coverage.out ./... - name: Calculate coverage + working-directory: ${{ matrix.path }} run: | COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}') echo "Coverage: $COVERAGE%" @@ -163,6 +160,7 @@ jobs: fi - name: Generate coverage report + working-directory: ${{ matrix.path }} run: go tool cover -html=coverage.out -o coverage.html - name: Upload coverage report @@ -170,8 +168,8 @@ jobs: with: name: coverage-report path: | - coverage.out - coverage.html + ${{ matrix.path }}/coverage.out + ${{ matrix.path }}/coverage.html - name: Go Coverage Badge # Pass the `coverage.out` output to this action if: matrix.module == 'v2' @@ -191,7 +189,7 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git add ../README.md + git add README.md git commit -m "chore: Updated coverage badge." - name: Push changes From 7d78ec5410a86e67d79550df80491c9710ac6d87 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:14:05 +0500 Subject: [PATCH 06/17] Fix path --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3073e33..43422c8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -137,9 +137,11 @@ jobs: ubuntu-latest-go-1.24- - name: Download dependencies + working-directory: ${{ matrix.path }} run: go mod download - name: Run tests with coverage + working-directory: ${{ matrix.path }} run: go test -coverprofile=coverage.out ./... - name: Calculate coverage From ffef4f2c66f54a01b4b6ab133744c895026756d3 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:21:39 +0500 Subject: [PATCH 07/17] Fix push --- .github/workflows/ci.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 43422c8..78cc9f2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -186,20 +186,14 @@ jobs: with: files: README.md - - name: Commit changes + - name: Commit and push changes if: matrix.module == 'v2' && steps.verify-changed-files.outputs.files_changed == 'true' run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add README.md git commit -m "chore: Updated coverage badge." - - - name: Push changes - if: matrix.module == 'v2' && steps.verify-changed-files.outputs.files_changed == 'true' - uses: ad-m/github-push-action@master - with: - github_token: ${{ github.token }} - branch: ${{ github.head_ref }} + git push - name: Add coverage to PR comment if: github.event_name == 'pull_request' From f7721f3e8ef9c56da03f525816df0fd352b7b805 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:22:08 +0500 Subject: [PATCH 08/17] Fix push --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 78cc9f2..55535ec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -120,6 +120,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} - name: Set up Go uses: actions/setup-go@v4 From 998fce49baa9d45d7f27a8d742572f12be5fb163 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:23:18 +0500 Subject: [PATCH 09/17] Fix upload --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 55535ec..8a0f2d7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -170,7 +170,7 @@ jobs: - name: Upload coverage report uses: actions/upload-artifact@v4 with: - name: coverage-report + name: coverage-report-${{ matrix.module }} path: | ${{ matrix.path }}/coverage.out ${{ matrix.path }}/coverage.html From f6ff6047ebbbcaecf8e4e5f829bc3dc32891006f Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 17 Jun 2025 05:23:57 +0000 Subject: [PATCH 10/17] chore: Updated coverage badge. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b6c90db..5da8685 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Debounce +![Coverage](https://img.shields.io/badge/Coverage-1-red) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) [![CI](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml/badge.svg)](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml) From 2f94e182787e598ee66480a9441c5cc7e8538c6a Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:24:48 +0500 Subject: [PATCH 11/17] Fix comment generation --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8a0f2d7..a508139 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -189,6 +189,7 @@ jobs: files: README.md - name: Commit and push changes + working-directory: ${{ matrix.path }} if: matrix.module == 'v2' && steps.verify-changed-files.outputs.files_changed == 'true' run: | git config --local user.email "action@github.com" From 0addbaf84a9dc62446834e2785a5a7af1f241ac6 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:26:05 +0500 Subject: [PATCH 12/17] Fix badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5da8685..68cbe55 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Debounce -![Coverage](https://img.shields.io/badge/Coverage-1-red) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) [![CI](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml/badge.svg)](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml) +[Coverage](https://img.shields.io/badge/Coverage-1-red) [![Go Report Card](https://goreportcard.com/badge/github.com/floatdrop/debounce)](https://goreportcard.com/report/github.com/floatdrop/debounce) [![Go Reference](https://pkg.go.dev/badge/github.com/floatdrop/debounce/v2.svg)](https://pkg.go.dev/github.com/floatdrop/debounce/v2) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) From c2bd6cb3f35ea64082ee50ef7a1bafced29f18ec Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:27:20 +0500 Subject: [PATCH 13/17] Fix commit --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a508139..8a0f2d7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -189,7 +189,6 @@ jobs: files: README.md - name: Commit and push changes - working-directory: ${{ matrix.path }} if: matrix.module == 'v2' && steps.verify-changed-files.outputs.files_changed == 'true' run: | git config --local user.email "action@github.com" From bb3dd08048015c28f75a17df2f14617992744f4a Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 17 Jun 2025 05:27:50 +0000 Subject: [PATCH 14/17] chore: Updated coverage badge. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 68cbe55..2dfcdf2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Debounce +![Coverage](https://img.shields.io/badge/Coverage-1-red) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) [![CI](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml/badge.svg)](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml) From 83731f3e81d486f4d6212413e6f7b74cbf7dad0c Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:30:18 +0500 Subject: [PATCH 15/17] Fix value --- .github/workflows/ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8a0f2d7..d682b34 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -179,7 +179,7 @@ jobs: if: matrix.module == 'v2' uses: tj-actions/coverage-badge-go@v2 with: - filename: v2/coverage.out + value: $COVERAGE - name: Verify Changed files if: matrix.module == 'v2' @@ -198,6 +198,7 @@ jobs: git push - name: Add coverage to PR comment + working-directory: ${{ matrix.path }} if: github.event_name == 'pull_request' run: | COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}') From 09b121d708197e285808127c662922029de72033 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 17 Jun 2025 05:31:10 +0000 Subject: [PATCH 16/17] chore: Updated coverage badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2dfcdf2..84117fc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Debounce -![Coverage](https://img.shields.io/badge/Coverage-1-red) +![Coverage](https://img.shields.io/badge/Coverage-100.0-brightgreen) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) [![CI](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml/badge.svg)](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml) From 7b0a66d287ff90282e7240aac4abc864bb672c79 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 17 Jun 2025 10:33:53 +0500 Subject: [PATCH 17/17] 100 --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 84117fc..ae9ee85 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # Debounce -![Coverage](https://img.shields.io/badge/Coverage-100.0-brightgreen) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) [![CI](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml/badge.svg)](https://github.com/floatdrop/debounce/actions/workflows/ci.yaml) -[Coverage](https://img.shields.io/badge/Coverage-1-red) +![Coverage](https://img.shields.io/badge/Coverage-100.0-brightgreen) [![Go Report Card](https://goreportcard.com/badge/github.com/floatdrop/debounce)](https://goreportcard.com/report/github.com/floatdrop/debounce) [![Go Reference](https://pkg.go.dev/badge/github.com/floatdrop/debounce/v2.svg)](https://pkg.go.dev/github.com/floatdrop/debounce/v2) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)