Skip to content

Commit 1422b02

Browse files
authored
Merge pull request #49 from danilolutz/feature/ci-coverage
ci: added coverage
2 parents e71dc7a + 6e35a15 commit 1422b02

5 files changed

Lines changed: 46 additions & 44 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
name: Upload dotnet package
1+
name: Build & Test
22

33
on:
4-
release:
5-
types: [created]
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
68

79
jobs:
8-
deploy:
10+
build:
911
runs-on: ubuntu-latest
10-
permissions:
11-
packages: write
12-
contents: read
1312
steps:
1413
- uses: actions/checkout@v3
15-
- uses: actions/setup-dotnet@v2
14+
- name: Setup .NET
15+
uses: actions/setup-dotnet@v2
1616
with:
1717
dotnet-version: 6.0.x
18-
source-url: https://nuget.pkg.github.com/CoreZipCode/index.json
19-
env:
20-
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
21-
- run: dotnet build --configuration Release CoreZipCode.sln
22-
- name: Create the package
23-
run: dotnet pack --configuration Release CoreZipCode.sln --include-symbols -p:PackageVersion=${{github.ref_name}} -v normal
24-
- name: Publish the package to GPR
25-
run: dotnet nuget push CoreZipCode/bin/Release/*.nupkg
18+
- name: Restore dependencies
19+
run: dotnet restore
20+
- name: Build
21+
run: dotnet build --no-restore
22+
- name: Test
23+
run: dotnet test --no-build --verbosity normal -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:CoverletOutput=./coverage/lcov.info
24+
- name: Coveralls
25+
uses: coverallsapp/github-action@master
26+
with:
27+
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
path-to-lcov: ./CoreZipCode.Tests/coverage/lcov.info

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Upload dotnet package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
packages: write
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-dotnet@v2
16+
with:
17+
dotnet-version: 6.0.x
18+
source-url: https://nuget.pkg.github.com/CoreZipCode/index.json
19+
env:
20+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
21+
- run: dotnet build --configuration Release CoreZipCode.sln
22+
- name: Create the package
23+
run: dotnet pack --configuration Release CoreZipCode.sln --include-symbols -p:PackageVersion=${{github.ref_name}} -v normal
24+
- name: Publish the package to GPR
25+
run: dotnet nuget push CoreZipCode/bin/Release/*.nupkg

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ healthchecksdb
550550

551551
.coverageCoreZipCode.deps.json
552552
.coverage
553+
coverage
553554
coverage.json
554555
coverage.cobertura.xml
555556

CoreZipCode.Tests/CoreZipCode.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="coverlet.msbuild" Version="3.1.2">
12-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
12+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
<PrivateAssets>all</PrivateAssets>
1414
</PackageReference>
1515
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />

0 commit comments

Comments
 (0)