-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (59 loc) · 2.44 KB
/
ci-cd.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: CI/CD
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]
jobs:
build:
strategy:
matrix:
configuration: [Debug, Release]
runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
env:
Solution_Name: FamilyShow.sln
steps:
- name: Checkout
uses: actions/checkout@v4
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
# cache: true
# cache-dependency-path: '**/package-lock.json'
# Dotnet matcher
- name: Enable problem matchers
run: echo "::add-matcher::.github/matchers/dotnet.json"
# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: dotnet restore $env:Solution_Name
# Build the application
- name: Build the application
run: dotnet build $env:Solution_Name --configuration $env:Configuration --no-restore
env:
Configuration: ${{ matrix.configuration }}
# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test --configuration $env:Configuration --no-build --logger GitHubActions '/p:CollectCoverage=true;CoverletOutputFormat=\"json,lcov,cobertura,opencover\";MergeWith=${{github.workspace}}/coverage.json;CoverletOutput=${{github.workspace}}/coverage' -- RunConfiguration.CollectSourceInformation=true
env:
Configuration: ${{ matrix.configuration }}
# Create coverage badges
- name: OpenCover Badge Generator
uses: danpetitt/[email protected]
with:
path-to-opencover-xml: ${{github.workspace}}/coverage.opencover.xml
path-to-badges: ./
minimum-coverage: 75
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Archive the package
- name: Create archive
run: Compress-Archive -Path FamilyShow/bin/Release/* -DestinationPath FamilyShow/bin/Release/Family.Show-${{ github.ref_name }}.zip
if: startsWith(github.ref, 'refs/tags/')
# Release: https://github.com/softprops/action-gh-release
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: FamilyShow/bin/Release/Family.Show-${{ github.ref_name }}.zip