Skip to content

Commit

Permalink
Fix typo and add badge for go report
Browse files Browse the repository at this point in the history
  • Loading branch information
Sovietaced committed Dec 21, 2023
1 parent 555ba2f commit 9876bea
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Generate code coverage badge

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
name: Update coverage badge
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- 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@v16
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 "[email protected]"
git config --local user.name "GitHub Action"
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:
github_token: ${{ github.token }}
branch: ${{ github.head_ref }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Test](https://github.com/sovietaced/go-redisson/actions/workflows/ci.yml/badge.svg)](https://github.com/sovietaced/go-redisson/actions/workflows/ci.yml)
[![GoDoc](https://godoc.org/github.com/sovietaced/go-redisson?status.png)](http://godoc.org/github.com/sovietaced/go-redisson)
[![Go Report](https://goreportcard.com/badge/github.com/sovietaced/go-redisson)](https://goreportcard.com/report/github.com/sovietaced/go-redisson)


Distributed data structures backed by Redis. Heavily inspired by [Redisson](https://github.com/redisson/redisson).
Expand Down
2 changes: 1 addition & 1 deletion mutex/mutex.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (m *Mutex) Lock(ctx context.Context) error {
}
}

// TryLock attempts to acquire the lock but does not block. Returns whether the lock was aquired.
// TryLock attempts to acquire the lock but does not block. Returns whether the lock was acquired.
func (m *Mutex) TryLock(ctx context.Context) (bool, error) {
ttl, err := m.doTryLock(ctx)
if err != nil {
Expand Down

0 comments on commit 9876bea

Please sign in to comment.