-
Notifications
You must be signed in to change notification settings - Fork 8
103 lines (87 loc) · 2.76 KB
/
commit.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
name: commit
on:
workflow_dispatch: # Allow running on-demand
push:
branches: [main]
paths:
- ".github/workflows/commit.yml"
- "src/**"
- "scripts/**"
- "whim-installer.iss"
- "Whim.sln"
- "Directory.Packages.props"
- ".csharpierrc"
- ".xamlstylerrc"
- ".config/dotnet-tools.json"
pull_request:
paths:
- ".github/workflows/commit.yml"
- "src/**"
- "scripts/**"
- "whim-installer.iss"
- "Whim.sln"
- "Directory.Packages.props"
- ".csharpierrc"
- ".xamlstylerrc"
- ".config/dotnet-tools.json"
env:
# We install the packages to the D:\ drive to avoid the slow IO on the C:\ drive.
# Based on https://github.com/actions/setup-dotnet/issues/260#issuecomment-1790162905
NUGET_PACKAGES: D:\a\.nuget\packages
jobs:
commit:
strategy:
matrix:
configuration: [Debug, Release]
platform: [x64, arm64]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ matrix.platform }}-nuget-${{ hashFiles('Directory.Packages.props') }}
restore-keys: |
${{ matrix.platform }}-nuget-${{ hashFiles('Directory.Packages.props') }}
${{ matrix.platform }}-nuget-
- name: Restore dependencies
run: |
dotnet restore Whim.sln -p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
- name: Install dotnet tools
run: |
dotnet tool restore
- name: Check C# formatting
run: |
dotnet tool run dotnet-csharpier . --check
- name: Check XAML formatting
run: |
dotnet tool run xstyler --recursive --d . --passive --config ./.xamlstylerrc
# - name: Check analyzers
# run: |
# dotnet format analyzers Whim.sln --verify-no-changes --no-restore
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2.0.0
- name: Build schema
run: |
.\scripts\Generate-SourceFromSchema.ps1
- name: Build
run: |
msbuild Whim.sln `
-p:Configuration=$env:Configuration `
-p:Platform=$env:Platform `
-p:BuildInParallel=true `
-maxCpuCount
env:
Configuration: ${{ matrix.configuration }}
Platform: ${{ matrix.platform }}
- name: Test
run: |
dotnet test Whim.sln --collect:"XPlat Code Coverage;Format=opencover"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.5.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}