-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (110 loc) · 3.8 KB
/
buildAndTest.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build and Test
on:
pull_request:
branches: [ main, dev ]
jobs:
build_and_pack:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore Dependencies
run: dotnet restore
- name: Build src projects and test runner
run: |
dotnet build -c Debug ./src/MockMe/
dotnet build -c Debug ./tests/MockMe.Tests.Runner/
- name: Test And Collect CodeCov
run: |
dotnet tool install --global dotnet-coverage
dotnet-coverage collect "dotnet run --project ./tests/MockMe.Tests.Runner/" -f cobertura -s ./CodeCoverage.runsettings
- name: Generate report
uses: danielpalme/ReportGenerator-GitHub-Action@5.3.11
with:
reports: './output.cobertura.xml'
targetdir: './tests/TestResults'
reporttypes: 'lcov'
filefilters: '-*\*.g.cs'
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
path-to-lcov: ./tests/TestResults/lcov.info
- name: Pack NuGet Packages
# run: dotnet pack --configuration Release --no-build --output ./packages --version 0.0.1-dev.$GITHUB_RUN_ID
run: dotnet pack --configuration Release --output ./packages /p:Version=0.0.1-dev
- name: Upload NuGet Packages
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./packages
test_linux:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet:
- '6.0'
- '7.0'
- '8.0'
- '9.0'
env:
ContinuousIntegrationBuild: true
LATEST_DOTNET_VERSION: '9.0'
needs: build_and_pack
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Download NuGet Packages
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./packages
- name: Create local package feed
run: dotnet nuget add source ${{ github.workspace }}/packages --name localNuGet
- name: Print NuGet Sources
run: dotnet nuget list source
- name: Restore dependencies
run: dotnet restore /p:MockMeNugetPackageVersion="0.0.1-dev"
- name: Build
run: dotnet build ./tests/MockMe.Tests.slnf --no-restore -c Release /p:MockMeNugetPackageVersion="0.0.1-dev"
- name: Test
run: dotnet test ./tests/MockMe.Tests.slnf --no-build -c Release --verbosity normal
# test-windows:
# runs-on: windows-latest
# strategy:
# matrix:
# dotnet:
# - '6.0'
# - '7.0'
# - '8.0'
# - '9.0'
# needs: build_and_pack
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# - name: Setup .NET ${{ matrix.dotnet }}
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: ${{ matrix.dotnet }}
# - name: Download NuGet Packages
# uses: actions/download-artifact@v4
# with:
# name: nuget-packages
# path: ./packages
# - name: Create local package feed
# run: dotnet nuget add source ${{ github.workspace }}/packages --name localNuGet
# - name: Print NuGet Sources
# run: dotnet nuget list source
# - name: Restore dependencies
# run: dotnet restore /p:MockMeNugetPackageVersion="0.0.1-dev"
# - name: Build
# run: dotnet build ./tests/MockMe.Tests.slnf --no-restore -c Release /p:MockMeNugetPackageVersion="0.0.1-dev"
# - name: Test
# run: dotnet test ./tests/MockMe.Tests.slnf --no-build -c Release --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=openCover