-
Notifications
You must be signed in to change notification settings - Fork 206
186 lines (155 loc) · 5.86 KB
/
test-windows.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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: test-windows
on:
push:
branches:
- main
paths-ignore:
- '*.md'
- '*.asciidoc'
- 'docs/**'
pull_request:
paths-ignore:
- '*.md'
- '*.asciidoc'
- 'docs/**'
permissions:
contents: read
concurrency:
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
defaults:
run:
shell: cmd
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
# 'tests' is a required check in this workflow.
# To not burn unneeded CI cycles:
# - Our required checks will always succeed if doc only changes are detected.
# - all jobs depend on 'format' to not waste cycles on quickly fixable errors.
jobs:
format:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
- name: Format
run: ./build.bat format
# Skipping due to this failing consistently - See https://github.com/elastic/apm-agent-dotnet/issues/2524
# TODO - Re-enable when possible.
#required step
# tests:
# runs-on: windows-2022
# needs: [ 'format' ]
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v4
# - name: Bootstrap Action Workspace
# uses: ./.github/workflows/bootstrap
# with:
# tc-cloud: ${{ secrets.TC_CLOUD_TOKEN }}
# - name: 'Tests: Unit'
# run: ./build.bat test --test-suite unit
integrations-tests:
runs-on: windows-2022
#needs: [ 'format', 'tests' ]
needs: [ 'tests' ]
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
- name: 'Tests: Integrations'
run: ./build.bat test --test-suite integrations
- name: Store crash dumps
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: hang-dumps
retention-days: 3
path: |
build/output/**/*.dmp
build/output/**/*.xml
startup-hook-tests:
runs-on: windows-2022
#needs: [ 'format', 'tests' ]
needs: [ 'tests' ]
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
- name: 'Tests: StartupHooks'
run: ./build.bat test --test-suite startuphooks
profiler-tests:
runs-on: windows-2022
#needs: [ 'format', 'tests' ]
needs: [ 'tests' ]
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
with:
rust: 'true'
tc-cloud: ${{ secrets.TC_CLOUD_TOKEN }}
- name: 'Tests: Profiler'
run: ./build.bat test --test-suite profiler
test-iis:
runs-on: windows-latest
#needs: [ 'format', 'tests' ]
needs: [ 'tests' ]
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: "${{ runner.os }}-nuget-${{ hashFiles('**/*.[cf]sproj*') }}"
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
- name: Clean the application
run: msbuild /t:Clean /p:Configuration=Release
- name: Restore the application
run: msbuild /t:Restore /p:Configuration=Release
- name: Build the application
run: |
set INCLUDE_CSHARP_TARGETS=true
msbuild ^
/p:EnforceCodeStyleInBuild=false /p:_SkipUpgradeNetAnalyzersNuGetWarning=true /p:EnableNETAnalyzers=false ^
-clp:ForceConsoleColor -clp:Summary -verbosity:minimal ^
/t:Build /p:Configuration=Release /restore
#- name: Discover Windows Features
# run: |
# DISM /online /get-features /format:table
# TODO See if this really needed
- name: Enable Windows Features
run: |
DISM /online /enable-feature /featurename:IIS-HttpErrors
DISM /online /enable-feature /featurename:IIS-HttpRedirect
- name: Ensure AppPool Permissions
run: |
REM enable permissions for the Application Pool Identity group
icacls C:\Windows\Temp /grant "IIS_IUSRS:(OI)(CI)F" /T
icacls "c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files" /grant "IIS_IUSRS:(OI)(CI)F" /T
icacls %cd% /t /q /grant "IIS_IUSRS:(OI)(CI)(IO)(RX)"
REM enable permissions for the anonymous access group
icacls %cd% /t /q /grant "IUSR:(OI)(CI)(IO)(RX)"
icacls C:\Windows\Temp /grant "IUSR:(OI)(CI)F" /T
icacls "c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files" /grant "IUSR:(OI)(CI)F" /T
- name: Run tests
run: |
set ELASTIC_APM_TESTS_FULL_FRAMEWORK_ENABLED=true
set sample_app_log_dir=C:\Elastic_APM_TEMP
if not exist "%sample_app_log_dir%" mkdir "%sample_app_log_dir%"
icacls %sample_app_log_dir% /t /q /grant Everyone:F
set ELASTIC_APM_ASP_NET_FULL_FRAMEWORK_SAMPLE_APP_LOG_FILE=%sample_app_log_dir%\Elastic.Apm.AspNetFullFramework.Tests.SampleApp.log
dotnet test -c Release test\iis\Elastic.Apm.AspNetFullFramework.Tests --no-build ^
--verbosity normal ^
--results-directory build/output ^
--diag build/output/diag-iis.log ^
--filter "FullyQualifiedName=Elastic.Apm.AspNetFullFramework.Tests.CustomServiceNodeNameSetViaSettings.Test" ^
--logger:"junit;LogFilePath=%cd%\build\output\junit-{framework}-{assembly}.xml;MethodFormat=Class;FailureBodyFormat=Verbose"
- name: Store test results
uses: actions/upload-artifact@v4
with:
name: test-results-iis
path: build/output/junit-*.xml