Skip to content

Commit

Permalink
Merge pull request #53 from Code-Hex/update/actions
Browse files Browse the repository at this point in the history
updated github actions
  • Loading branch information
Code-Hex authored Apr 14, 2024
2 parents 4505cb1 + 9da5717 commit aac4f47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@ jobs:
- '^1.18'
- '^1.19'
- '^1.20'
- '^1.21'
- '^1.22'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- uses: actions/setup-go@v3
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true
- name: Declare some variables
id: vars
run: |
echo "::set-output name=coverage_txt::${RUNNER_TEMP}/coverage.txt"
- name: Test Coverage (pkg)
run: go test ./... -race -coverprofile=${{ steps.vars.outputs.coverage_txt }}
run: go test ./... -race -coverprofile="coverage.txt"
- name: Upload coverage
if: ${{ matrix.go == '^1.20' }}
uses: codecov/codecov-action@v2
if: ${{ matrix.go == '^1.22' }}
uses: codecov/codecov-action@v4
with:
files: ${{ steps.vars.outputs.coverage_txt }}
file: "coverage.txt"
token: ${{ secrets.CODECOV_TOKEN }}

11 changes: 11 additions & 0 deletions policy/simple/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ func ExampleCache_Keys() {
// baz
}

func ExampleCache_Len() {
c := simple.NewCache[string, int]()
c.Set("foo", 1)
c.Set("bar", 2)
c.Set("baz", 3)
len := c.Len()
fmt.Println(len)
// Output:
// 3
}

func BenchmarkLenWithKeys(b *testing.B) {
c := simple.NewCache[string, int]()
c.Set("foo", 1)
Expand Down

0 comments on commit aac4f47

Please sign in to comment.