fix: github actions to move code coverage to PR check #111
Workflow file for this run
This file contains 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: PR Workflow | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
container: golang:1.23.3-alpine3.20 | |
continue-on-error: false | |
name: checks | |
steps: | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v3 | |
- name: install prerequisites | |
run: | | |
apk add --update --no-cache --repository https://dl-4.alpinelinux.org/alpine/latest-stable/community/ build-base gcc make git librdkafka-dev pkgconf curl | |
- name: generate proto | |
run: | | |
make proto-generate | |
- name: golint-check | |
run: | | |
make golint-check | |
- name: goimports-check | |
run: | | |
make goimports-check | |
- name: Run Tests | |
run: | | |
make test | |
- name: Go Coverage Badge # Pass the `coverage.out` output to this action | |
uses: tj-actions/coverage-badge-go@v2 | |
with: | |
filename: coverage-summary.out | |
target: Readme.md | |
- name: Check for README Changes | |
uses: tj-actions/verify-changed-files@v17 | |
id: verify-changed-files | |
with: | |
files: Readme.md | |
- name: Commit changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add Readme.md | |
git commit -m "chore: Updated coverage badge." | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ github.token }} | |
branch: ${{ github.ref_name }} | |
- name: Upload Coverage Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: coverage-summary.out |