Skip to content

Switch to jshufro coverage fork #188

Switch to jshufro coverage fork

Switch to jshufro coverage fork #188

Workflow file for this run

name: Rescue Node Proxy
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
# Needed to leave comments
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.1
- uses: arduino/setup-protoc@v3
- run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
- run: |
make
# run the tests and create a coverage report
- run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
# upload the plaintext coverage report
- name: Upload txt coverage report
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: ./cover.out
# convert the plaintext coverage report to html
- run: go tool cover -html cover.out -o cover.html
# upload the html coverage report
- name: Upload html coverage report
uses: actions/upload-artifact@v4
with:
name: code-coverage-html
path: ./cover.html
id: html-upload-step
outputs:
artifact-url: ${{ steps.html-upload-step.outputs.artifact-url }}
coverage:
name: "Analyze coverage report"
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: build # only run if the previous job finished successfully
steps:
- name: Leave a comment with a link
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '[Coverage Report](${{ needs.build.outputs.artifact-url }})'
})
- uses: jshufro/go-coverage-report@bff1aedadc0eae16652c3d81d631043a35abc1f3
with:
coverage-artifact-name: "code-coverage"
coverage-file-name: "cover.out"
skip-comment: true
id: report-step
- run: echo ${{ steps.report-step.outputs.coverage_report }}