Skip to content

Commit

Permalink
Merge pull request #111 from krymtkts:feature/coverage
Browse files Browse the repository at this point in the history
Add a step for Codecov to GitHub Actions workflow.
  • Loading branch information
krymtkts authored Jan 4, 2024
2 parents 11057c8 + e0bcdfa commit eff60ec
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Test
description: Setup .NET, install PowerShell modules and run all tests.

inputs:
codecov_token:
description: "Codecov token"
required: true

runs:
using: composite
steps:
Expand All @@ -16,3 +21,9 @@ runs:
- name: Execute All Tests
shell: pwsh
run: Invoke-Psake -taskList TestAll
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
file: ./src/pocof.Test/TestResults/coverage.cobertura.xml
env:
CODECOV_TOKEN: ${{ inputs.codecov_token }}
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ jobs:
uses: actions/checkout@v4
- name: Test
uses: ./.github/actions/test
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ jobs:
uses: actions/checkout@v4
- name: Test
uses: ./.github/actions/test
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Pocof

[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/pocof)](https://www.powershellgallery.com/packages/pocof)
![pull request workflow](https://github.com/krymtkts/pocof/actions/workflows/main.yml/badge.svg)
![Test main status](https://github.com/krymtkts/pocof/actions/workflows/main.yml/badge.svg)
[![codecov](https://codecov.io/gh/krymtkts/pocof/graph/badge.svg?token=7HA9NC8PHT)](https://codecov.io/gh/krymtkts/pocof)

An interactive pipeline filtering Cmdlet for PowerShell written in F#.

Expand Down
3 changes: 2 additions & 1 deletion psakefile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ Task UnitTest {
if (-not $?) {
throw 'dotnet test failed.'
}
Move-Item ./src/pocof.Test/TestResults/*/coverage.cobertura.xml ./src/pocof.Test/TestResults/coverage.cobertura.xml -Force
}

Task Coverage -depends UnitTest {
Remove-Item ./coverage/*
reportgenerator -reports:'./src/pocof.Test/TestResults/*/coverage.cobertura.xml' -targetdir:'coverage' -reporttypes:Html
reportgenerator -reports:'./src/pocof.Test/TestResults/coverage.cobertura.xml' -targetdir:'coverage' -reporttypes:Html
}

Task WorkflowTest {
Expand Down

0 comments on commit eff60ec

Please sign in to comment.