|
21 | 21 |
|
22 | 22 | - name: Unit tests
|
23 | 23 | run: |
|
24 | | - sudo go test ./... -coverprofile coverage.out -covermode count |
25 | | - sudo go tool cover -func coverage.out |
| 24 | + go test -v ./... -covermode=count -coverprofile=coverage.out |
| 25 | + go tool cover -func=coverage.out -o=coverage.out |
| 26 | + |
| 27 | + - name: Go Coverage Badge # Pass the `coverage.out` output to this action |
| 28 | + uses: tj-actions/coverage-badge-go@v2 |
| 29 | + with: |
| 30 | + filename: coverage.out |
| 31 | + |
| 32 | + - name: Verify Changed files |
| 33 | + uses: tj-actions/verify-changed-files@v9.1 |
| 34 | + id: verify-changed-files |
| 35 | + with: |
| 36 | + files: README.md |
| 37 | + |
| 38 | + - name: Commit changes |
| 39 | + if: steps.verify-changed-files.outputs.files_changed == 'true' |
| 40 | + run: | |
| 41 | + git config --local user.email "action@github.com" |
| 42 | + git config --local user.name "GitHub Action" |
| 43 | + git add README.md |
| 44 | + git commit -m "chore: Updated coverage badge." |
| 45 | + |
| 46 | + - name: Push changes |
| 47 | + if: steps.verify-changed-files.outputs.files_changed == 'true' |
| 48 | + uses: ad-m/github-push-action@master |
| 49 | + with: |
| 50 | + github_token: ${{ github.token }} |
| 51 | + branch: ${{ github.head_ref }} |
26 | 52 |
|
27 | 53 | - name: Quality Gate - Test coverage shall be above threshold
|
28 | 54 | env:
|
|
0 commit comments