Skip to content

feat(methods): add pointers receivers code and tests #150

feat(methods): add pointers receivers code and tests

feat(methods): add pointers receivers code and tests #150

Workflow file for this run

name: test
on:
push:
workflow_dispatch:
permissions:
contents: write
actions: write
pull-requests: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
with:
go-version-file: 'go.mod'
- name: Run tests
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: Download coverage breakdown
id: download-main-breakdown
uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
with:
branch: main
workflow_conclusion: success
name: main.breakdown
if_no_artifact_found: warn
- name: Check test coverage
id: coverage
uses: vladopajic/go-test-coverage@d9ec07b8799c458a7bc1f9b36d14261746d63529 # v2
continue-on-error: true
with:
config: ./.testcoverage.yml
git-branch: badges
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
breakdown-file-name: ${{ github.ref_name == 'main' && 'main.breakdown' || '' }}
diff-base-breakdown-file-name: ${{ steps.download-main-breakdown.outputs.found_artifact == 'true' && 'main.breakdown' || '' }}
- name: Upload coverage breakdown
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
if: github.ref_name == 'main'
with:
name: main.breakdown
path: main.breakdown
if-no-files-found: error
- name: Find pull request ID
run: |
PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ github.ref_name }}&state=open")
PR_ID=$(echo "$PR_DATA" | jq -r '.[0].number')
if [ "$PR_ID" != "null" ]; then
echo "pull_request_id=$PR_ID" >> $GITHUB_ENV
else
echo "No open pull request found for this branch."
fi
- name: Post coverage report
if: env.pull_request_id
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-tag: coverage-report
pr-number: ${{ env.pull_request_id }}
message: |
go-test-coverage report:
```
${{ fromJSON(steps.coverage.outputs.report) }}```
- name: Fail if coverage check failed
if: steps.coverage.outcome == 'failure'
shell: bash
run: echo "coverage check failed" && exit 1