1- name : Build and Tests
1+ name : ' Build and Test '
22
33on :
44 push :
5- branches : [ main ]
65 pull_request :
76 branches : [ main ]
87
98jobs :
10- build :
9+ Build :
10+
11+ runs-on : ubuntu-latest
12+ env :
13+ VSTEST_CONNECTION_TIMEOUT : 900
1114
15+ strategy :
16+ matrix :
17+ dotnet-version : [ 'netcoreapp3.1', 'net5', 'net6' ]
18+
19+ steps :
20+ - uses : actions/checkout@v2
21+ - name : Setup .NET Core
22+ uses : actions/setup-dotnet@v1
23+ with :
24+ dotnet-version : ' 3.1.x'
25+ - name : Setup .NET Core
26+ uses : actions/setup-dotnet@v1
27+ with :
28+ dotnet-version : ' 5.0.x'
29+ - name : Setup .NET Core
30+ uses : actions/setup-dotnet@v1
31+ with :
32+ dotnet-version : ' 6.0.x'
33+ - name : Install dependencies
34+ run : dotnet restore ./src/
35+ - name : Build solution
36+ run : dotnet build ./src/ --no-restore --framework ${{matrix.dotnet-version}}
37+
38+ Test :
39+ needs : build
1240 runs-on : ubuntu-latest
1341 env :
1442 VSTEST_CONNECTION_TIMEOUT : 900
1543
44+ strategy :
45+ matrix :
46+ dotnet-version : [ 'netcoreapp3.1', 'net5', 'net6' ]
47+
48+ if : success()
1649 steps :
17- - uses : actions/checkout@v2
18- - name : Setup .NET Core
19- uses : actions/setup-dotnet@v1
20- with :
21- dotnet-version : ' 6.0.x'
22- - name : Install dependencies
23- run : dotnet restore
24- - name : Build
25- run : dotnet build --configuration Release --no-restore
26- - name : Test
27- run : dotnet test --no-restore --verbosity normal
50+ - uses : actions/checkout@v2
51+ - name : Setup .NET Core
52+ uses : actions/setup-dotnet@v1
53+ with :
54+ dotnet-version : ' 3.1.x'
55+ - name : Setup .NET Core
56+ uses : actions/setup-dotnet@v1
57+ with :
58+ dotnet-version : ' 5.0.x'
59+ - name : Setup .NET Core
60+ uses : actions/setup-dotnet@v1
61+ with :
62+ dotnet-version : ' 6.0.x'
63+ - name : Install dependencies
64+ run : dotnet restore ./src/
65+ - name : Test with dotnet
66+ run : dotnet test ./src/ --framework ${{matrix.dotnet-version}} --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
67+ - name : Upload dotnet test results
68+ uses : actions/upload-artifact@v2
69+ with :
70+ name : dotnet-results-${{ matrix.dotnet-version }}
71+ path : TestResults-${{ matrix.dotnet-version }}
72+ # Use always() to always run this step to publish test results when there are test failures
73+ if : ${{ always() }}
0 commit comments