mirror of
https://github.com/irongut/CodeCoverageSummary.git
synced 2026-05-14 14:10:14 +02:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71c6f23d2f | |||
| 162def6e89 | |||
| e07628e8aa | |||
| fc71f6831f | |||
| c4d24d5996 | |||
| f5bcfce861 | |||
| a97b5158b3 | |||
| e67bf0d2d1 | |||
| 1c05e17f24 |
@@ -0,0 +1,63 @@
|
|||||||
|
name: Build + Deploy to GHCR
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Test Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup .Net
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: 5.0.x
|
||||||
|
|
||||||
|
- name: Restore Dependencies
|
||||||
|
run: dotnet restore src/CodeCoverageSummary.sln
|
||||||
|
|
||||||
|
- name: Build CodeCoverageSummary
|
||||||
|
run: dotnet build src/CodeCoverageSummary.sln --configuration Release --no-restore
|
||||||
|
|
||||||
|
- name: Test with sample file
|
||||||
|
run: dotnet src/CodeCoverageSummary/bin/Release/net5.0/CodeCoverageSummary.dll src/coverage.cobertura.xml --badge true
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy to GHCR
|
||||||
|
needs: [build]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
|
- name: Build + Push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# Code Coverage Summary
|
# Code Coverage Summary
|
||||||
|
|
||||||
A GitHub Action that reads Cobertura format code coverage files and outputs a text or markdown summary. Other Actions can then post the summary as a pull request comment, include it in release notes, etc.
|
A GitHub Action that reads Cobertura format code coverage files from your test suite and outputs a text or markdown summary. This summary can then be posted as a Pull Request comment, included in Release Notes, etc by another action to give you an immediate insight into the health of your code without using a third-party site.
|
||||||
|
|
||||||
Written for use with [Coverlet](https://github.com/coverlet-coverage/coverlet) and .Net but it should work with any tests that output coverage in Cobertura format.
|
Code Coverage Summary was designed for use with [Coverlet](https://github.com/coverlet-coverage/coverlet) and .Net but it should work with any test framework that outputs coverage in Cobertura format.
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ Company.Example.Library: Line Rate = 27%, Branch Rate = 100%, Complexity = 11
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Code Coverage Summary Report
|
name: Code Coverage Summary Report
|
||||||
uses: irongut/CodeCoverageSummary@v1
|
uses: irongut/CodeCoverageSummary@v1.0.2
|
||||||
with:
|
with:
|
||||||
filename: coverage/coverage.cobertura.xml
|
filename: coverage/coverage.cobertura.xml
|
||||||
```
|
```
|
||||||
@@ -94,7 +94,7 @@ jobs:
|
|||||||
run: cp coverage/**/coverage.cobertura.xml coverage/coverage.cobertura.xml
|
run: cp coverage/**/coverage.cobertura.xml coverage/coverage.cobertura.xml
|
||||||
|
|
||||||
- name: Code Coverage Summary Report
|
- name: Code Coverage Summary Report
|
||||||
uses: irongut/CodeCoverageSummary@v1
|
uses: irongut/CodeCoverageSummary@v1.0.2
|
||||||
with:
|
with:
|
||||||
filename: coverage/coverage.cobertura.xml
|
filename: coverage/coverage.cobertura.xml
|
||||||
badge: true
|
badge: true
|
||||||
@@ -115,7 +115,7 @@ jobs:
|
|||||||
|
|
||||||
Please make sure the bug is not already reported by searching existing [issues].
|
Please make sure the bug is not already reported by searching existing [issues].
|
||||||
|
|
||||||
If you're unable to find an existing issue addressing the problem [open a new one][new-issue]. Be sure to include a title and clear description, as much relevant information as possible, a workflow sample and any logs demonstrating the problem.
|
If you're unable to find an existing issue addressing the problem please [open a new one][new-issue]. Be sure to include a title and clear description, as much relevant information as possible, a workflow sample and any logs demonstrating the problem.
|
||||||
|
|
||||||
### Suggest an Enhancement
|
### Suggest an Enhancement
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ inputs:
|
|||||||
default: 'console'
|
default: 'console'
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'docker://ghcr.io/irongut/codecoveragesummary:v1.0.2'
|
||||||
args:
|
args:
|
||||||
- ${{ inputs.filename }}
|
- ${{ inputs.filename }}
|
||||||
- '--badge'
|
- '--badge'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommandLineParser" Version="2.8.0" />
|
<PackageReference Include="CommandLineParser" Version="2.8.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.11.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ namespace CodeCoverageSummary
|
|||||||
if (!string.IsNullOrWhiteSpace(badgeUrl))
|
if (!string.IsNullOrWhiteSpace(badgeUrl))
|
||||||
{
|
{
|
||||||
markdownOutput.AppendLine($"");
|
markdownOutput.AppendLine($"");
|
||||||
|
markdownOutput.AppendLine("");
|
||||||
}
|
}
|
||||||
|
|
||||||
markdownOutput.AppendLine("Package | Line Rate | Branch Rate | Complexity")
|
markdownOutput.AppendLine("Package | Line Rate | Branch Rate | Complexity")
|
||||||
|
|||||||
Reference in New Issue
Block a user