forked from MonoMod/MonoMod
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (111 loc) · 4.86 KB
/
test.yml
File metadata and controls
130 lines (111 loc) · 4.86 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
127
128
129
130
name: Test
on:
workflow_call:
inputs:
matrix:
required: true
type: string
defaults:
run:
shell: pwsh
env:
DOTNET_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
NUGET_PACKAGES: ${{github.workspace}}/artifacts/pkg
XunitVersion: "2.4.2"
jobs:
test:
name: Test
runs-on: ${{ fromJSON(inputs.matrix).os.runner }}
container: ${{ fromJSON(inputs.matrix).container }}
env:
LOG_FILE_NAME: testresults.${{ fromJSON(inputs.matrix).os.runner }}.${{ fromJSON(inputs.matrix).dotnet.id != '' && fromJSON(inputs.matrix).dotnet.id || fromJSON(inputs.matrix).dotnet.sdk }}.${{ fromJSON(inputs.matrix).arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
if: ${{ fromJSON(inputs.matrix).dotnet.needsRestore || fromJSON(inputs.matrix).dotnet.isMono }}
with:
lfs: true
submodules: recursive
# Note: All of the SDKs we install have to be for the target architecture. Otherwise, we get issues when the default != the target.
- name: Install global SDK
if: ${{ ! fromJSON(inputs.matrix).dotnet.needsRestore }}
uses: nike4613/install-dotnet@533307d1c90c37993c8ef1397388bc9783e7b87c
with:
architecture: ${{ fromJSON(inputs.matrix).arch }}
version: "9.0"
- name: Cache restored NuGet packages
uses: actions/cache@v4
if: ${{ fromJSON(inputs.matrix).dotnet.needsRestore }}
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-v1-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets', 'nuget.config', 'global.json') }}
restore-keys: ${{ runner.os }}-nuget-v1-
- name: Install restore SDK
if: ${{ fromJSON(inputs.matrix).dotnet.needsRestore }}
uses: nike4613/install-dotnet@533307d1c90c37993c8ef1397388bc9783e7b87c
with:
architecture: ${{ fromJSON(inputs.matrix).arch }}
global-json: global.json
- name: Restore packages
if: ${{ fromJSON(inputs.matrix).dotnet.needsRestore }}
run: dotnet restore -noAutoRsp
- name: Download test assets
uses: actions/download-artifact@v4
with:
name: test-assets
- name: Install test target runtime
if: ${{ fromJSON(inputs.matrix).dotnet.sdk != '' }}
uses: nike4613/install-dotnet@533307d1c90c37993c8ef1397388bc9783e7b87c
with:
version: ${{ fromJSON(inputs.matrix).dotnet.sdk }}
architecture: ${{ fromJSON(inputs.matrix).arch }}
runtime: dotnet
- name: Setup Mono
if: ${{ fromJSON(inputs.matrix).dotnet.isMono }}
id: setup_mono
env:
INPUT_JOB: ${{ inputs.matrix }}
run: |
#./.github/setup-mono.ps1 $env:INPUT_JOB $env:GITHUB_OUTPUT $env:GITHUB_ENV ${{ runner.os }}
dotnet run --project ./build/setup-mono/setup-mono.csproj -- $env:INPUT_JOB $env:GITHUB_OUTPUT $env:GITHUB_ENV ${{ runner.os }}
- name: Print SDK info
run: dotnet --info
- name: Fix runtimeconfig.json probing paths
if: ${{ fromJSON(inputs.matrix).dotnet.needsRestore }}
run: |
ConvertTo-Json @{runtimeOptions=@{additionalProbingPaths=@($env:NUGET_PACKAGES)}} > release_${{ fromJSON(inputs.matrix).dotnet.tfm }}/MonoMod.UnitTest.runtimeconfig.dev.json
- name: Run tests
if: ${{ ! fromJSON(inputs.matrix).dotnet.isMono && ! fromJSON(inputs.matrix).dotnet.pgo }}
run: |
dotnet test -f ${{ fromJSON(inputs.matrix).dotnet.tfm }} -a ${{ fromJSON(inputs.matrix).arch }} `
-l:"trx;LogFileName=$($env:LOG_FILE_NAME).trx" release_${{ fromJSON(inputs.matrix).dotnet.tfm }}/MonoMod.UnitTest.dll
- name: Run tests (PGO)
if: ${{ fromJSON(inputs.matrix).dotnet.pgo }}
env:
DOTNET_ReadyToRun: ${{ !fromJSON(inputs.matrix).usePgo && 1 || 0 }}
DOTNET_TC_QuicJitForLoops: ${{ fromJSON(inputs.matrix).usePgo && 1 || 0 }}
DOTNET_TieredPGO: ${{ fromJSON(inputs.matrix).usePgo && 1 || 0 }}
run: |
dotnet test -f ${{ fromJSON(inputs.matrix).dotnet.tfm }} -a ${{ fromJSON(inputs.matrix).arch }} `
-l:"trx;LogFileName=$($env:LOG_FILE_NAME).trx" release_${{ fromJSON(inputs.matrix).dotnet.tfm }}/MonoMod.UnitTest.dll
- name: Run tests (Mono)
if: ${{ fromJSON(inputs.matrix).dotnet.isMono }}
env:
TFM: ${{ fromJSON(inputs.matrix).dotnet.tfm }}
RUNNER_TFM: ${{ steps.setup_mono.outputs.runner_tfm }}
USE_MDH: ${{ steps.setup_mono.outputs.use_mdh }}
MDH: ${{ steps.setup_mono.outputs.mdh }}
MONO_DLL: ${{ steps.setup_mono.outputs.mono_dll }}
run: ./.github/workflows/run-mono-tests.ps1
# TODO: Non-system Mono
- name: Upload test results
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-results ${{ fromJSON(inputs.matrix).title }}
retention-days: 1
path: |
TestResults/*.trx
*.xml
diaglog.*