Skip to content

Merge pull request #676 from rocket-pool/v2-rewards-iterator-fix #677

Merge pull request #676 from rocket-pool/v2-rewards-iterator-fix

Merge pull request #676 from rocket-pool/v2-rewards-iterator-fix #677

Workflow file for this run

name: Smart Node Unit Tests
on:
push:
tags:
- v*
branches:
- master
- main
- v2*
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.22.5
- run: go test ./... -coverprofile=./cover.out -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' && github.event.pull_request.head.repo.full_name == 'rocket-pool/smartnode'
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: fgrosse/go-coverage-report@ff33f0f3f96d20ecb97198100852d2af288094ff
with:
coverage-artifact-name: "code-coverage"
coverage-file-name: "cover.out"
root-package: "github.com/rocket-pool/smartnode/v2"