-
Notifications
You must be signed in to change notification settings - Fork 30
45 lines (36 loc) · 1.57 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Build, test and package
on: push
jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cd src && dotnet build
- name: Test
run: |
cd tests && dotnet test --configuration Debug --verbosity normal --collect:'XPlat Code Coverage' --settings coverlet.runsettings
- name: Move test results to accessible directory
run: |
mkdir -p TestResults
find tests/TestResults -type f -name "*.xml" -exec mv -v --backup=numbered {} TestResults/ \;
- name: Create Test Coverage Badge
uses: simon-k/[email protected]
id: create_coverage_badge
with:
label: Unit Test Coverage
color: brightgreen
path: TestResults/coverage.opencover.xml
gist-filename: code-coverage.json
# https://gist.github.com/tznind/2a31eee1c9151917aa8d17b59bc86633
gist-id: 2a31eee1c9151917aa8d17b59bc86633
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
- name: Print Code Coverage
run: |
echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"
- name: Pack
run: cd src && dotnet pack --configuration Debug --output ./nupkg
- name: Publish to NuGet
if: contains(github.ref, 'refs/tags/v')
run: dotnet nuget push ./src/nupkg/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate