Skip to content

Commit

Permalink
Work on code coverage report action
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrosse committed Mar 9, 2024
1 parent df11b20 commit 25be777
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 25 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches:
- '**'
pull_request:
types: [opened, reopened]
branches:
- '**'

jobs:
unit_tests:
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.22

- name: Test
run: go test -v -cover -coverprofile=coverage.txt -covermode=count ./...

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.txt

code_coverage:
name: "Code coverage report"
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: unit_tests
steps:
- name: Download code coverage results from source branch
run: 'echo "TODO: Download code coverage results from source branch"'

- name: Download code coverage results
uses: actions/download-artifact@v4
with:
name: code-coverage
path: source-coverage.txt

- name: Compare code coverage results
run: 'echo "## Coverage report" > coverage-comment.md'

- name: Comment on pull request
run: gh pr comment ${{ github.event.number }} --body-file coverage-comment.md
25 changes: 0 additions & 25 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit 25be777

Please sign in to comment.