-
-
Notifications
You must be signed in to change notification settings - Fork 13
61 lines (58 loc) · 2.09 KB
/
build.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
name: build
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
dotnet: 7.0.101
version: 1.11.0
key: dein:toolbox
organization: dein
name: ToolBox
jobs:
build:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
name: build on ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: setup .Net
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnet }}
- name: restore
run: dotnet restore ToolBox/ToolBox.csproj
- name: build
run: dotnet build ToolBox/ToolBox.csproj --no-restore
test:
runs-on: ubuntu-latest
name: test
steps:
- uses: actions/checkout@v2
- name: setup .Net
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnet }}
- name: install sonar-scanner
run: dotnet tool install --global dotnet-sonarscanner
- name: restore
run: dotnet restore ToolBox/ToolBox.csproj
- name: build
run: dotnet build ToolBox/ToolBox.csproj --no-restore
- name: restore test
run: dotnet restore ToolBox.Tests/ToolBox.Tests.csproj
- name: build test
run: dotnet build ToolBox.Tests/ToolBox.Tests.csproj --no-restore
- name: scanner begin
run: dotnet sonarscanner begin /k:"${{ env.key }}" /n:"${{ env.name }}" /v:"${{ env.version }}" /o:"${{ env.organization }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.language="cs" /d:sonar.exclusions="**/bin/**/*,**/obj/**/*" /d:sonar.cs.opencover.reportsPaths="lcov.opencover.xml"
- name: scanner build
run: dotnet build ToolBox/ToolBox.csproj
- name: scanner test
run: dotnet test ToolBox.Tests/ToolBox.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov
- name: scanner end
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}