refactor(manager): small refactors around the manager and token logic #144
This file contains hidden or 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
name: go test & coverage | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
branches: | |
- main | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Run tests with coverage | |
run: go test ./... -coverprofile=./cover.out -covermode=atomic -race -count 2 -timeout 5m | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage | |
path: cover.out # Make sure to use the same file name you chose for the "-coverprofile" in the "Test" step | |
- name: Check coverage | |
uses: vladopajic/go-test-coverage@v2 | |
with: | |
config: ./.testcoverage.yml | |
code_coverage: | |
name: "Code coverage report" | |
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch | |
runs-on: ubuntu-latest | |
needs: test # Depends on the artifact uploaded by the "unit_tests" job | |
permissions: | |
contents: read | |
actions: read # to download code coverage results from "test" job | |
pull-requests: write # write permission needed to comment on PR | |
steps: | |
- uses: fgrosse/[email protected] # Consider using a Git revision for maximum security | |
with: | |
coverage-artifact-name: "code-coverage" # can be omitted if you used this default value | |
coverage-file-name: "cover.out" # can be omitted if you used this default value |