-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (41 loc) · 1.86 KB
/
dotnetCourseStreamTests.yml
File metadata and controls
52 lines (41 loc) · 1.86 KB
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
name: .NET
on:
push:
branches: [ "main" ]
paths:
- 'CourseStream/**'
- 'AcademicHub.Common/**'
pull_request:
branches: [ "main" ]
paths:
- 'CourseStream/**'
- 'AcademicHub.Common/**'
jobs:
build-and-test-courseStream:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore CustomExceptions dependencies
run: dotnet restore ./AcademicHub.Common/AcademicHub.Common.sln
- name: Build CustomExceptions
run: dotnet build ./AcademicHub.Common/AcademicHub.Common.sln --no-restore
- name: Restore CourseStream dependencies
run: dotnet restore ./CourseStream/CourseStream.sln
- name: Build CourseStream
run: dotnet build ./CourseStream/CourseStream.sln --no-restore
# Run unit tests with coverage
- name: Run unit tests with coverage
run: dotnet test ./CourseStream/CourseStream.UnitTests/CourseStream.UnitTests.csproj --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput='./CourseStream/CourseStream.UnitTests/TestResults/'
# Install ReportGenerator
- name: Install ReportGenerator
run: dotnet tool install -g dotnet-reportgenerator-globaltool
# Generate coverage report
- name: Generate coverage report
run: reportgenerator -reports:'**/TestResults/coverage.cobertura.xml' -targetdir:'coveragereport' -reporttypes:'HtmlInline_AzurePipelines;Cobertura'
# Check code coverage threshold
- name: Check code coverage threshold
run: bash ./scripts/coverage-check.sh ${{ github.workspace }}/CourseStream/CourseStream.UnitTests/CourseStream/CourseStream.UnitTests/TestResults/coverage.cobertura.xml CourseStream.Core branch 95