Skip to content

Commit

Permalink
Fix coverage call and check total
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerad committed Apr 1, 2024
1 parent 8e6d0c8 commit dfbb9fc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 48 deletions.
31 changes: 31 additions & 0 deletions .github/actions/test/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and Test Source

runs:
using: composite
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 lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55

- name: Go run examples
shell: bash
run: ./.github/workflows/scripts/examples.sh

- name: Run Test
shell: bash
run: |
go test -v . -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.out
grep total < coverage.out | grep '100.0%'
25 changes: 1 addition & 24 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,7 @@ jobs:
test:
runs-on: ubuntu-latest
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 lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55

- name: Go run examples
shell: bash
run: ./.github/workflows/scripts/examples.sh

- name: Run Test
run: |
go test -v . -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.ougo tool cover -func=coverage.out -o=coverage.outt
- uses: ./.github/actions/test

- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v2
Expand Down
25 changes: 1 addition & 24 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,4 @@ jobs:
test:
runs-on: ubuntu-latest
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 lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55

- name: Go run examples
shell: bash
run: ./.github/workflows/scripts/examples.sh

- name: Run Test
run: |
go test -v . -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out -o=coverage.ougo tool cover -func=coverage.out -o=coverage.outt
- uses: ./.github/actions/test

0 comments on commit dfbb9fc

Please sign in to comment.