-
-
Notifications
You must be signed in to change notification settings - Fork 50
89 lines (82 loc) · 2.81 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
name: .NET
# This workflow should trigger in the following cases:
# - The commit is any push in any branch in the repo
# - The commit is a published PR from anyone else
#
# This setup is done to avoid duplicate runs for the same exact commits, for cases when
# the PR is done from a branch in this repo, which would already trigger the "push"
# condition. This way, only PRs from forks will actually trigger the workflow.
#
# Because we can't really check these conditions from the global triggers here, they are
# added to the two root jobs below instead. If canceled, the whole workflow will stop.
on: [push, pull_request]
env:
EXCLUDE_RUN_ID_FROM_PACKAGE: false
EXCLUDE_SUFFIX_FROM_VERSION: false
jobs:
# Build the whole PolySharp solution
build-solution:
if: >-
github.event_name == 'push' ||
github.event.pull_request.user.login != github.repository_owner
strategy:
matrix:
configuration: [Debug, Release]
runs-on: windows-2022
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Build
run: dotnet build -c ${{matrix.configuration}} /bl
- name: Upload MSBuild binary log
uses: actions/upload-artifact@v4
with:
name: msbuild_log_${{matrix.configuration}}
path: msbuild.binlog
if-no-files-found: error
# Run unit tests
run-tests:
if: success()
needs: [build-solution]
runs-on: windows-2022
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Run unit tests
run: dotnet test -c Release
# Build the .msbuildproj projects to generate all the NuGet packages
build-packages:
if: >-
github.event_name == 'push' ||
github.event.pull_request.user.login != github.repository_owner
runs-on: windows-2022
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Build PolySharp package
run: dotnet build src\PolySharp.Package\PolySharp.Package.msbuildproj -c Release
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: nuget_packages
path: artifacts\*.nupkg
if-no-files-found: error
# Download the NuGet packages generated in the previous job and use them
# to build and run the sample project referencing them. This is used as
# a test to ensure the NuGet packages work in a consuming project.
verify-packages:
if: success()
needs: [build-packages]
runs-on: windows-2022
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Create local NuGet feed
run: mkdir artifacts
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: nuget_packages
path: artifacts
- name: Build PolySharp.NuGet
run: dotnet build tests\PolySharp.NuGet\PolySharp.NuGet.csproj -c Release