Repository navigation
126 lines (113 loc) · 3.94 KB
/
Copy pathdotnet-test.yml
File metadata and controls
126 lines (113 loc) · 3.94 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: .NET Tests
on:
push:
branches: [ "main" ]
paths:
- 'global.json'
- '**.cs'
- '**.axaml'
- '**.csproj'
- '**.props'
- '**.targets'
- '**.sln'
- '**.slnx'
- 'src/.editorconfig'
- '.github/workflows/dotnet-test.yml'
pull_request:
branches: [ "main" ]
paths:
- 'global.json'
- '**.cs'
- '**.axaml'
- '**.csproj'
- '**.props'
- '**.targets'
- '**.sln'
- '**.slnx'
- 'src/.editorconfig'
- '.github/workflows/dotnet-test.yml'
workflow_dispatch:
env:
# NuGet's package and HTTP caches go in the workspace, on D: on Windows runners, instead of
# their default folders on C:, the runner's slow OS disk. Set here for every job and action.
NUGET_PACKAGES: ${{ github.workspace }}\.nuget\packages
NUGET_HTTP_CACHE_PATH: ${{ github.workspace }}\.nuget\http-cache
jobs:
test-codebase:
runs-on: windows-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Cache NuGet packages
uses: actions/cache@v6
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('global.json', 'src/**/*.csproj', 'src/**/*.props', 'src/**/*.targets', 'src/**/*.sln', 'src/**/*.slnx') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Install dependencies
working-directory: src
run: dotnet restore UniGetUI.Windows.slnx
- name: Check whitespace formatting
run: dotnet format whitespace src --folder --verify-no-changes --verbosity minimal
- name: Check code style formatting (Avalonia Windows solution)
working-directory: src
run: dotnet format style UniGetUI.Windows.slnx --no-restore --verify-no-changes --verbosity minimal
- name: Build Avalonia Windows solution
working-directory: src
run: |
dotnet build-server shutdown
dotnet build UniGetUI.Windows.slnx --no-restore --verbosity minimal /p:Platform=x64 /p:UseSharedCompilation=false /m:1
- name: Run Tests
working-directory: src
env:
GITHUB_TOKEN: ${{ github.token }}
run: dotnet test UniGetUI.Windows.slnx --no-restore --verbosity q --nologo /p:Platform=x64 /p:UseSharedCompilation=false /m:1
- name: Report full-trim publish warnings
working-directory: src
shell: pwsh
continue-on-error: true
run: |
dotnet build-server shutdown
dotnet publish UniGetUI.Avalonia/UniGetUI.Avalonia.csproj `
--no-restore `
--configuration Release `
--runtime win-x64 `
--self-contained true `
--output "${{ runner.temp }}\unigetui-full-trim-publish" `
/p:Platform=x64 `
/p:TrimMode=full `
/p:TrimmerSingleWarn=false `
/p:UseSharedCompilation=false `
--verbosity minimal
- name: Report NativeAOT publish warnings
working-directory: src
shell: pwsh
run: |
dotnet build-server shutdown
dotnet restore UniGetUI.Avalonia/UniGetUI.Avalonia.csproj `
--runtime win-x64 `
/p:Configuration=Release `
/p:PublishAot=true `
/p:SelfContained=true
dotnet publish UniGetUI.Avalonia/UniGetUI.Avalonia.csproj `
--no-restore `
--configuration Release `
--runtime win-x64 `
--self-contained true `
--output "${{ runner.temp }}\unigetui-nativeaot-publish" `
/m:1 `
/p:Platform=x64 `
/p:PublishProfile=Win-x64-NativeAot `
/p:TrimmerSingleWarn=false `
/p:UseSharedCompilation=false `
--verbosity minimal
if (-not (Test-Path "${{ runner.temp }}\unigetui-nativeaot-publish\UniGetUI.exe")) {
throw "NativeAOT publish did not produce UniGetUI.exe."
}