-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add coverage badge * Fix coverage badge action * Fix coverage badge action * Fix coverage badge action * Fix coverage badge action * Fix coverage badge action * chore: Updated coverage badge. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
eef900b
commit 2133247
Showing
3 changed files
with
60 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
name: Update coverage badge | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run Test | ||
run: | | ||
go test -v ./... -covermode=count -coverprofile=coverage.out | ||
go tool cover -func=coverage.out -o=coverage.out | ||
- 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@v12 | ||
id: verify-changed-files | ||
with: | ||
files: README.md | ||
|
||
- name: Commit changes | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add README.md | ||
git commit -m "chore: Updated coverage badge." | ||
- name: Push changes | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
uses: ad-m/github-push-action@master | ||
with: | ||
branch: ${{ github.head_ref }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters