Skip to content

Update workflow permissions #521

Update workflow permissions

Update workflow permissions #521

name: test-windows-iis
on:
push:
branches:
- main
- 1.*
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' }}
env:
ELASTIC_STACK_VERSION: '8.4.0'
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
test-iis:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.[cf]sproj*') }}
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Clean the application
shell: cmd
run: msbuild /t:Clean /p:Configuration=Release
- name: Restore the application
shell: cmd
run: msbuild /t:Restore /p:Configuration=Release
- name: Build the application
shell: cmd
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
# shell: cmd
# run: |
# DISM /online /get-features /format:table
# TODO See if this really needed
- name: Enable Windows Features
shell: cmd
run: |
DISM /online /enable-feature /featurename:IIS-HttpErrors
DISM /online /enable-feature /featurename:IIS-HttpRedirect
- name: Ensure AppPool Permissions
shell: cmd
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
shell: cmd
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
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: test-results-iis
path: build/output/junit-*.xml