-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (72 loc) · 2.5 KB
/
code-pr-check.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
name: Code PR Check
on:
pull_request:
branches: ["main", "Development"]
paths:
- "src/**"
- "tests/**"
- ".github/workflows/code-pr-check.yml"
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
env:
DOTNET_VERSION: '8.0.x'
jobs:
build-test-web-app:
name: Build and run unit tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
cache: false
- name: Install dotnet coverage
run: dotnet tool install --global dotnet-coverage --version 17.9.3
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Install SonarCloud scanners
run: dotnet tool install --global dotnet-sonarscanner
- name: Install latest JDK
uses: actions/setup-java@v4
with:
distribution: "microsoft"
java-version: "17"
# - name: Start SonarCloud scanner
# run: |
# dotnet-sonarscanner begin \
# /k:"DFE-Digital_sts-content-support" \
# /o:"dfe-digital" \
# /d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
# /d:sonar.host.url="https://sonarcloud.io" \
# /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml \
# /d:sonar.coverage.exclusions=**/Program.cs,**/wwwroot/** \
# /d:sonar.issue.ignore.multicriteria=e1 \
# /d:sonar.issue.ignore.multicriteria.e1.ruleKey=csharpsquid:S6602 \
# /d:sonar.issue.ignore.multicriteria.e1.resourceKey=src/**/*.cs
- name: Build web app
uses: ./.github/actions/build-dotnet-app
with:
dotnet_version: ${{ env.DOTNET_VERSION }}
solution_filename: sts-contentsupport.sln
- name: Run unit tests
uses: ./.github/actions/run-unit-tests
with:
solution_filename: sts-contentsupport.sln
# - name: Merge test results
# run: dotnet-coverage merge -f xml -o "coverage.xml" -s "coverage.settings.xml" -r coverage.cobertura.xml
#
# - name: End SonarCloud Scanner
# run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
#
# - name: Archive code coverage results
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report
# path: coverage.xml
#