Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a step for Codecov to GitHub Actions workflow. #111

Merged
merged 5 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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