-
Notifications
You must be signed in to change notification settings - Fork 10
108 lines (91 loc) · 3.56 KB
/
dotnet.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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build and Test
on:
push:
branches: [ "main" ]
paths-ignore:
- 'doc/**'
- 'README.md'
pull_request:
branches: [ "main" ]
paths-ignore:
- 'doc/**'
- 'README.md'
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
include:
- os: windows-latest
artifact: windows.complog
slash: \
- os: ubuntu-latest
artifact: ubuntu.complog
slash: /
env:
TEST_ARTIFACTS_PATH: ${{ github.workspace }}${{ matrix.slash }}artifacts${{ matrix.slash }}test
TEST_RESULTS_PATH: ${{ github.workspace }}${{ matrix.slash }}artifacts${{ matrix.slash }}test-results
TEST_COVERAGE_PATH: ${{ github.workspace }}${{ matrix.slash }}artifacts${{ matrix.slash }}coverage
name: Build and Test ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
# Setup the output directories for usage
- name: Create directories
shell: pwsh
run: New-Item -Type Directory -Path @("${{ env.TEST_ARTIFACTS_PATH }}", "${{ env.TEST_RESULTS_PATH }}", "${{ env.TEST_COVERAGE_PATH }}")
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -bl
- name: Test Linux
run: >
dotnet test --no-build --framework net7.0
--logger "console;verbosity=detailed"
--logger "trx;LogFileName=${{ env.TEST_RESULTS_PATH }}/TestResults-Linux.trx"
-p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=${{ env.TEST_COVERAGE_PATH }}/coverage.linux.xml
if: matrix.os == 'ubuntu-latest'
- name: Test Windows .NET Core
run: >
dotnet test --no-build --framework net7.0
--logger "console;verbosity=detailed"
--logger "trx;LogFileName=${{ env.TEST_RESULTS_PATH}}/TestResults-Windows-Core.trx"
-p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=${{ env.TEST_COVERAGE_PATH }}/coverage.windows.core.xml
if: matrix.os == 'windows-latest'
- name: Test Windows .NET Framework
run: >
dotnet test --no-build --framework net7.0
--logger "console;verbosity=detailed"
--logger "trx;LogFileName=${{ env.TEST_RESULTS_PATH}}/TestResults-Windows-Framework.trx"
-p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=${{ env.TEST_COVERAGE_PATH }}/coverage.windows.framework.xml
if: matrix.os == 'windows-latest'
- name: Create Compiler Log
run: dotnet run --project src/Basic.CompilerLog/Basic.CompilerLog.csproj create msbuild.binlog
- name: Publish Compiler Log
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact }}
path: msbuild.complog
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ${{ env.TEST_COVERAGE_PATH }}
- name: Publish Test Results
uses: actions/upload-artifact@v3
if: always()
with:
name: test-results
path: ${{ env.TEST_RESULTS_PATH }}/*.trx
- name: Publish Test Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: Test Artifacts ${{ matrix.os }}
path: $ {{ env.TEST_ARTIFACTS_PATH }}