Skip to content

Commit 6fafc4e

Browse files
Merge pull request #1 from A9G-Data-Droid/pipeline
Add code coverage report and badge
2 parents 7272e85 + e790b8f commit 6fafc4e

File tree

3 files changed

+106
-2
lines changed

3 files changed

+106
-2
lines changed

.github/workflows/publish.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: publish
4+
on:
5+
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
6+
push:
7+
branches: # This action will run on PR to these branches
8+
- main
9+
- next
10+
pull_request:
11+
branches:
12+
- '*' # Run the workflow for all pull requests
13+
release:
14+
types:
15+
- published # Run the workflow when a new GitHub release is published
16+
17+
env:
18+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
19+
DOTNET_NOLOGO: true
20+
NuGetDirectory: ${{github.workspace}}/nuget
21+
22+
defaults:
23+
run:
24+
shell: pwsh
25+
26+
jobs:
27+
pack:
28+
runs-on: windows-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
34+
35+
- name: Install .NET Core
36+
uses: actions/setup-dotnet@v4
37+
with:
38+
dotnet-version: 9.0.x
39+
40+
- name: Restore dependencies
41+
run: dotnet restore
42+
43+
- name: Build
44+
run: dotnet build --configuration Release --no-restore
45+
46+
- name: Execute unit tests
47+
run: dotnet test --configuration Release -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover --no-build --verbosity normal
48+
49+
- name: Create Test Coverage Badge
50+
uses: simon-k/dotnet-code-coverage-badge@v1.0.0
51+
id: create_coverage_badge
52+
with:
53+
label: Unit Test Coverage
54+
color: brightgreen
55+
path: mermaid-graphTests/TestResults/coverage.opencover.xml
56+
gist-filename: MermaidGraph.NET.code-coverage.json
57+
gist-id: 24afd0c237dc4c9b56453dce09b24687
58+
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
59+
60+
- name: Print code coverage
61+
run: echo "Code coverage percentage ${{steps.create_coverage_badge.outputs.percentage}}%"
62+
63+
# Create the NuGet package in the folder from the environment variable NuGetDirectory
64+
- run: dotnet pack --configuration Release --no-build --output ${{env.NuGetDirectory}}
65+
66+
# Publish the NuGet package as an artifact, so they can be used in following jobs
67+
- uses: actions/upload-artifact@v4
68+
with:
69+
name: nuget
70+
if-no-files-found: error
71+
retention-days: 7
72+
path: ${{env.NuGetDirectory}}/*.nupkg
73+
74+
# deploy:
75+
# # Publish only when creating a GitHub Release
76+
# # https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
77+
# # You can update this logic if you want to manage releases differently
78+
# if: github.event_name == 'release'
79+
# runs-on: windows-latest
80+
# needs: [ pack ]
81+
# steps:
82+
# # Download the NuGet package created in the previous job
83+
# - uses: actions/download-artifact@v3
84+
# with:
85+
# name: nuget
86+
# path: ${{env.NuGetDirectory}}
87+
88+
# # Install the .NET SDK indicated in the global.json file
89+
# - name: Setup .NET Core
90+
# uses: actions/setup-dotnet@v4
91+
92+
# # Publish all NuGet packages to NuGet.org
93+
# # Use --skip-duplicate to prevent errors if a package with the same version already exists.
94+
# # If you retry a failed workflow, already published packages will be skipped without error.
95+
# - name: Publish NuGet package
96+
# run: |
97+
# foreach($file in (Get-ChildItem "${{env.NuGetDirectory}}" -Recurse -Include *.nupkg)) {
98+
# dotnet nuget push $file --api-key "${{secrets.NUGET_APIKEY}}" --source https://api.nuget.org/v3/index.json --skip-duplicate
99+
# }

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
![MermaidGraph.NET](mermaid-graph.png "MermaidGraph.NET")
22

3-
# MermaidGraph.NET
3+
# MermaidGraph.NET ![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/A9G-Data-Droid/24afd0c237dc4c9b56453dce09b24687/raw/MermaidGraph.NET.code-coverage.json)
4+
45
Create a mermaid graph of the dependency diagram for a project, or whole solution.
56

67
## Dotnet tool [![NuGet version (mermaid-graph)](https://img.shields.io/nuget/v/mermaid-graph.svg?style=flat-square)](https://www.nuget.org/packages/mermaid-graph/)

mermaid-graph/mermaid-graph.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@
2626
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
2727
<PackageIcon>mermaid-graph.png</PackageIcon>
2828
<ApplicationIcon>mermaid-graph.ico</ApplicationIcon>
29-
<Version>1.0.0-alpha</Version>
29+
<Version>1.0.0-beta</Version>
3030
<PackageLicenseFile>LICENSE</PackageLicenseFile>
31+
<EnablePackageValidation>true</EnablePackageValidation>
32+
33+
<!-- TODO: Enable after first release. Detect breaking changes from a previous stable version. -->
34+
<!-- <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion> -->
3135
</PropertyGroup>
3236

3337
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

0 commit comments

Comments
 (0)