-
Notifications
You must be signed in to change notification settings - Fork 0
231 lines (181 loc) · 8 KB
/
run-tests.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: "Tests"
on:
push:
branches:
- main
pull_request:
# The branches below must be a subset of the branches above
branches:
- main
jobs:
stoolball-web-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore npm dependencies
run: npm ci
- name: Restore NuGet dependencies
run: dotnet restore ./Stoolball.Web.UnitTests/Stoolball.Web.UnitTests.csproj
- name: Build unit tests
run: dotnet build --no-restore ./Stoolball.Web.UnitTests/Stoolball.Web.UnitTests.csproj
- name: Run Stoolball.Web.UnitTests
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.Web.UnitTests/coverlet.runsettings ./Stoolball.Web.UnitTests/Stoolball.Web.UnitTests.csproj
- name: Move coverage to root
shell: pwsh
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./web-unit-tests.cobertura.xml }
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: stoolball-web-unit-tests
path: web-unit-tests.cobertura.xml
stoolball-web-js-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Restore npm dependencies
run: npm ci
- name: Run Jest
run: npx jest --collect-coverage
- name: Move coverage to root
shell: pwsh
run: Get-ChildItem -Recurse cobertura-coverage.xml | ForEach-Object { Move-Item $_.FullName ./web-js-tests.cobertura.xml }
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: stoolball-web-js-tests
path: web-js-tests.cobertura.xml
stoolball-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore ./Stoolball.UnitTests/Stoolball.UnitTests.csproj
- name: Build unit tests
run: dotnet build --no-restore ./Stoolball.UnitTests/Stoolball.UnitTests.csproj
- name: Run Stoolball.UnitTests
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.UnitTests/coverlet.runsettings ./Stoolball.UnitTests/Stoolball.UnitTests.csproj
- name: Move coverage to root
shell: pwsh
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./unit-tests.cobertura.xml }
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: stoolball-unit-tests
path: unit-tests.cobertura.xml
stoolball-cache-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore ./Stoolball.Data.MemoryCache.UnitTests/Stoolball.Data.MemoryCache.UnitTests.csproj
- name: Build unit tests
run: dotnet build --no-restore ./Stoolball.Data.MemoryCache.UnitTests/Stoolball.Data.MemoryCache.UnitTests.csproj
- name: Run Stoolball.Data.MemoryCache.UnitTests
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.Data.MemoryCache.UnitTests/coverlet.runsettings ./Stoolball.Data.MemoryCache.UnitTests/Stoolball.Data.MemoryCache.UnitTests.csproj
- name: Move coverage to root
shell: pwsh
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./cache-unit-tests.cobertura.xml }
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: stoolball-cache-unit-tests
path: cache-unit-tests.cobertura.xml
stoolball-sql-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore ./Stoolball.Data.SqlServer.UnitTests/Stoolball.Data.SqlServer.UnitTests.csproj
- name: Build unit tests
run: dotnet build --no-restore ./Stoolball.Data.SqlServer.UnitTests/Stoolball.Data.SqlServer.UnitTests.csproj
- name: Run Stoolball.Data.SqlServer.UnitTests
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.Data.SqlServer.UnitTests/coverlet.runsettings ./Stoolball.Data.SqlServer.UnitTests/Stoolball.Data.SqlServer.UnitTests.csproj
- name: Move coverage to root
shell: pwsh
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./sql-unit-tests.cobertura.xml }
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: stoolball-sql-unit-tests
path: sql-unit-tests.cobertura.xml
stoolball-integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run SQL Server
env:
SA_PASSWORD: ${{ secrets.SQL_SERVER_PASSWORD }}
run: |
docker run --name "integration-tests-sql" -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=${{ env.SA_PASSWORD }}" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore ./Stoolball.Data.SqlServer.IntegrationTests/Stoolball.Data.SqlServer.IntegrationTests.csproj
- name: Build integration tests
run: dotnet build --no-restore ./Stoolball.Data.SqlServer.IntegrationTests/Stoolball.Data.SqlServer.IntegrationTests.csproj
- name: Run integration tests
env:
SQL_SERVER_USERNAME: ${{ secrets.SQL_SERVER_USERNAME }}
SQL_SERVER_PASSWORD: ${{ secrets.SQL_SERVER_PASSWORD }}
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.Data.SqlServer.IntegrationTests/coverlet.runsettings ./Stoolball.Data.SqlServer.IntegrationTests/Stoolball.Data.SqlServer.IntegrationTests.csproj
- name: Move coverage to root
shell: pwsh
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./integration-tests.cobertura.xml }
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: stoolball-integration-tests
path: integration-tests.cobertura.xml
publish-to-codacy:
runs-on: ubuntu-latest
needs: [stoolball-web-unit-tests, stoolball-unit-tests, stoolball-integration-tests, stoolball-web-js-tests, stoolball-sql-unit-tests]
steps:
- name: Download Stoolball.Web.UnitTests results
uses: actions/download-artifact@v2
with:
name: stoolball-web-unit-tests
- name: Download Stoolball.UnitTests results
uses: actions/download-artifact@v2
with:
name: stoolball-unit-tests
- name: Download Stoolball.Data.SqlServer.UnitTests results
uses: actions/download-artifact@v2
with:
name: stoolball-sql-unit-tests
- name: Download Stoolball.Data.MemoryCache.UnitTests results
uses: actions/download-artifact@v2
with:
name: stoolball-cache-unit-tests
- name: Download Stoolball.Data.SqlServer.IntegrationTests results
uses: actions/download-artifact@v2
with:
name: stoolball-integration-tests
- name: Download Jest results
uses: actions/download-artifact@v2
with:
name: stoolball-web-js-tests
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
with:
project-token: ${{ env.CODACY_PROJECT_TOKEN }}
coverage-reports: unit-tests.cobertura.xml,integration-tests.cobertura.xml,web-unit-tests.cobertura.xml,web-js-tests.cobertura.xml,sql-unit-tests.cobertura.xml,cache-unit-tests.cobertura.xml