Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move IIS tests to github actions #2040

Merged
merged 40 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f88f1c2
Do not remove projects from build. SLN should work across OS's
Mpdreamz Feb 23, 2023
990ab23
no longer add default nuget package and relative testpath
Mpdreamz Feb 23, 2023
4ae8af6
reinstate nuget clear --locals
Mpdreamz Feb 24, 2023
e325a38
remove ElasticApmAgent.NetCore.sln
Mpdreamz Feb 27, 2023
af752aa
move IIS tests over to github actions
Mpdreamz Apr 1, 2023
43c569e
Include failed tests if ELASTIC_..._FULL_FRAMEWORK_ENABLED set to tru…
Mpdreamz Apr 1, 2023
5f8a119
Include mmore information in test failure
Mpdreamz Apr 1, 2023
939a655
update test yaml
Mpdreamz Apr 1, 2023
d10c889
fix test output path
Mpdreamz Apr 3, 2023
ec7bc30
Remove 'Windows .NET Full Framework stage from Jenkins
Mpdreamz Apr 3, 2023
c214a6c
Split into separate steps
Mpdreamz Apr 3, 2023
5a31d4f
update tests again to ensure variables are set prior
Mpdreamz Apr 3, 2023
d9e62b7
Merge branch 'main' into fix/remove-fullframework-jenkins
Mpdreamz Apr 26, 2023
8c795dc
Ensure DateTimeOffset to timestamp rounds the same way as DateTime
Mpdreamz May 11, 2023
67bd370
Merge branch 'main' into fix/remove-fullframework-jenkins
Mpdreamz May 11, 2023
974ff3c
attempt to correct drift
Mpdreamz May 12, 2023
9b49800
Merge branch 'main' into fix/remove-fullframework-jenkins
Mpdreamz May 12, 2023
ed6bb27
increase wait for
Mpdreamz May 15, 2023
aa0fd9b
Merge remote-tracking branch 'origin/main' into fix/remove-fullframew…
Mpdreamz May 23, 2023
7fa39f8
Revert timestamp refactorings, focus on that in different PR
Mpdreamz May 23, 2023
f1da711
Remove 'Windows .NET Full Framework stage from Jenkins
Mpdreamz May 23, 2023
0ea71bd
Merge branch 'main' into fix/remove-fullframework-jenkins
Mpdreamz May 23, 2023
0cf4362
attempt to fix CS8032 error
Mpdreamz May 23, 2023
b19ed9f
Merge branch 'fix/remove-fullframework-jenkins' of github.com:elastic…
Mpdreamz May 23, 2023
dbece15
move to net462
Mpdreamz May 23, 2023
d1ebfd3
disable vs dev env steps
Mpdreamz May 23, 2023
949a5bf
reenabble setup-msbuild
Mpdreamz May 23, 2023
787a79a
ensure minimum sdk in global.json matches know good version
Mpdreamz May 23, 2023
eb02bf1
use implicit restore
Mpdreamz May 23, 2023
85e8cec
add /restore flag
Mpdreamz May 23, 2023
3040fc3
_SkipUpgradeNetAnalyzersNuGetWarning
Mpdreamz May 23, 2023
cc7dee9
EnableNETAnalyzers=false
Mpdreamz May 23, 2023
01ecb51
whitespace
Mpdreamz May 23, 2023
41621b9
attempt 4 at multiline cmd
Mpdreamz May 23, 2023
3c7e26c
minimal logging in msbuild
Mpdreamz May 23, 2023
810f0cd
win2019
Mpdreamz May 23, 2023
a05965a
win-latest
Mpdreamz May 23, 2023
ba0367f
7.0.100
Mpdreamz May 23, 2023
aae4ae2
Run a single IIS test for now
Mpdreamz May 23, 2023
24ccc7a
ensure logging line is part of dotnet test command
Mpdreamz May 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/windows/testnet461.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
:: This script runs the tests and stored them in an xml file defined in the
:: LogFilePath property
::
dotnet publish -c Release test\Elastic.Apm.Tests --framework net461 --property:PublishDir=..\..\outtestnet461
dotnet publish -c Release test\Elastic.Apm.Tests --framework net462 --property:PublishDir=..\..\outtestnet462

dotnet test outtestnet461\Elastic.Apm.Tests.dll ^
dotnet test outtestnet462\Elastic.Apm.Tests.dll ^
--logger:"junit;LogFilePath=test\junit-{framework}-{assembly}.xml;MethodFormat=Class;FailureBodyFormat=Verbose" ^
--blame-hang ^
--blame-hang-timeout 10m
7 changes: 7 additions & 0 deletions .github/.github.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<IsPackable>False</IsPackable>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ The version of the `Elastic.Apm` nuget package used

**Operating system and version:**

**.NET Framework/Core name and version** (e.g. .NET 4.6.1, NET Core 3.1.100) :
**.NET Framework/Core name and version** (e.g. .NET 4.6.2, NET Core 3.1.100) :

**Application Target Framework(s)** (e.g. net461, netcoreapp3.1):
**Application Target Framework(s)** (e.g. net462, netcoreapp3.1):

### Describe the bug
A clear and concise description of what the bug is.
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/bootstrap/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bootstrap Checkout
description: Ensures an action that needs to build has access to git tags

runs:
using: "composite"
steps:
# Ensure we fetch all tags
- shell: bash
run: |
git fetch --prune --unshallow --tags
git tag --list

# Install .NET version as mandated by global.json
#- uses: actions/setup-dotnet@v3
# with:
# global-json-file: global.json

- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.100
5.0.100
6.0.100
7.0.100
- shell: bash
run: |
dotnet --list-sdks


# Setup git config
- uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
101 changes: 101 additions & 0 deletions .github/workflows/test-iis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: test-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'

jobs:

test-iis:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- name: Bootstrap Action Workspace
uses: ./.github/workflows/bootstrap

- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3.1

#- name: Setup VS Dev Environment
# uses: seanmiddleditch/gha-setup-vsdevenv@v4

#- name: Restore NuGet Packages
# run: msbuild /t:Restore

- name: Build the application
shell: cmd
run: |
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 %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)"

- 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\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=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
path: build/output/junit-*.xml
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
<DelaySign>false</DelaySign>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.3" PrivateAssets="all"/>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net462" Version="1.0.3" PrivateAssets="all"/>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions ElasticApmAgent.sln
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Clients.Elasticsear
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "elastic_apm_profiler", "src\elastic_apm_profiler\elastic_apm_profiler.csproj", "{236B392A-53BE-46FD-9831-C66AE0A962F1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = ".github", ".github\.github.csproj", "{A880940E-31FC-4934-80FC-5A9E3DFED7CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.Microsoft.Data.SqlClient", "sample\Sample.Microsoft.Data.SqlClient\Sample.Microsoft.Data.SqlClient.csproj", "{BCE93684-0A40-4F5F-8FB5-94DE94B111E1}"
EndProject
Global
Expand Down Expand Up @@ -507,6 +509,10 @@ Global
{E6217549-8C21-4E95-BDF2-E782922CD104}.Release|Any CPU.Build.0 = Release|Any CPU
{236B392A-53BE-46FD-9831-C66AE0A962F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{236B392A-53BE-46FD-9831-C66AE0A962F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A880940E-31FC-4934-80FC-5A9E3DFED7CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A880940E-31FC-4934-80FC-5A9E3DFED7CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A880940E-31FC-4934-80FC-5A9E3DFED7CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A880940E-31FC-4934-80FC-5A9E3DFED7CA}.Release|Any CPU.Build.0 = Release|Any CPU
{BCE93684-0A40-4F5F-8FB5-94DE94B111E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCE93684-0A40-4F5F-8FB5-94DE94B111E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCE93684-0A40-4F5F-8FB5-94DE94B111E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
95 changes: 0 additions & 95 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,101 +67,6 @@ pipeline {
}
}
parallel{
stage('Windows .NET Framework'){
agent { label 'windows-2019 && immutable' }
options { skipDefaultCheckout() }
environment {
HOME = "${env.WORKSPACE}"
DOTNET_ROOT = "${env.WORKSPACE}\\dotnet"
PATH = "${env.DOTNET_ROOT};${env.DOTNET_ROOT}\\tools;${env.PATH};${env.HOME}\\bin"
MSBUILDDEBUGPATH = "${env.WORKSPACE}"
}
stages{
/**
Install the required tools
*/
stage('Install tools') {
steps {
cleanDir("${WORKSPACE}/*")
unstash 'source'
dir("${HOME}"){
powershell label: 'Install tools', script: "${BASE_DIR}\\.ci\\windows\\tools.ps1"
powershell label: 'Install msbuild tools', script: "${BASE_DIR}\\.ci\\windows\\msbuild-tools.ps1"
}
}
}
/**
Build the project from code..
*/
stage('Build - MSBuild') {
steps {
withGithubNotify(context: 'Build MSBuild - Windows') {
cleanDir("${WORKSPACE}/${BASE_DIR}")
unstash 'source'
dir("${BASE_DIR}"){
bat '.ci/windows/msbuild.bat'
}
}
}
post {
unsuccessful {
archiveArtifacts(allowEmptyArchive: true,
artifacts: "${MSBUILDDEBUGPATH}/**/MSBuild_*.failure.txt")
}
}
}
/**
Execute unit tests.
*/
stage('Test') {
steps {
withGithubNotify(context: 'Test MSBuild - Windows', tab: 'tests') {
cleanDir("${WORKSPACE}/${BASE_DIR}")
unstash 'source'
dir("${BASE_DIR}"){
powershell label: 'Install test tools', script: '.ci\\windows\\test-tools.ps1'
bat label: 'Test & coverage', script: '.ci/windows/testnet461.bat'
}
}
}
post {
always {
reportTests()
}
unsuccessful {
archiveArtifacts(allowEmptyArchive: true,
artifacts: "${MSBUILDDEBUGPATH}/**/MSBuild_*.failure.txt")
}
}
}
/**
Execute IIS tests.
*/
stage('IIS Tests') {
steps {
withGithubNotify(context: 'IIS Tests', tab: 'tests') {
cleanDir("${WORKSPACE}/${BASE_DIR}")
unstash 'source'
dir("${BASE_DIR}"){
powershell label: 'Install test tools', script: '.ci\\windows\\test-tools.ps1'
bat label: 'Build', script: '.ci/windows/msbuild.bat'
bat label: 'Test IIS', script: '.ci/windows/test-iis.bat'
}
}
}
post {
always {
reportTests()
}
}
}
}
post {
always {
cleanWs(disableDeferredWipeout: true, notFailBuild: true)
}
}
}
stage('Windows .NET Core'){
agent { label 'windows-2019 && immutable' }
options { skipDefaultCheckout() }
Expand Down
2 changes: 1 addition & 1 deletion sample/ApiSamples/ApiSamples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net461;net7.0</TargetFrameworks>
<TargetFrameworks>net462;net7.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<HasWebTargets Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets')" >true</HasWebTargets>
<BuildFullFrameworkAsp Condition="'$(OS)' != 'WINDOWS_NT'" >false</BuildFullFrameworkAsp>
<HasWebTargets Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets')">true</HasWebTargets>
<HasWebTargets Condition="Exists('$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets')">true</HasWebTargets>
<BuildFullFrameworkAsp Condition="'$(OS)' != 'WINDOWS_NT'">false</BuildFullFrameworkAsp>
<BuildFullFrameworkAsp Condition="'$(OS)' == 'WINDOWS_NT' AND '$(HasWebTargets)' != 'true'">false</BuildFullFrameworkAsp>
<BuildFullFrameworkAsp Condition="'$(OS)' == 'WINDOWS_NT' AND '$(HasWebTargets)' == 'true'">true</BuildFullFrameworkAsp>
</PropertyGroup>
<Target Name="Build" Condition="'$(BuildFullFrameworkAsp)' == 'false'">
</Target>
<!-- prevents NU1503 -->
<Target Name="_IsProjectRestoreSupported" Condition="'$(BuildFullFrameworkAsp)' == 'false'"
Returns="@(_ValidProjectsForRestore)">
<Target Name="_IsProjectRestoreSupported" Condition="'$(BuildFullFrameworkAsp)' == 'false'" Returns="@(_ValidProjectsForRestore)">
<ItemGroup>
<_ValidProjectsForRestore Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
</Target>
<Target Name="Restore" Condition="'$(BuildFullFrameworkAsp)' == 'false'"/>
<Target Name="Restore" Condition="'$(BuildFullFrameworkAsp)' == 'false'" />
<Target Name="Clean" Condition="'$(BuildFullFrameworkAsp)' == 'false'">
</Target>
<!-- dummy Pack target to allow dotnet pack to be called on solution file to package all <IsPackable>true</IsPackable> projects.
Expand All @@ -36,7 +36,8 @@
<OutputType>Library</OutputType>
<RootNamespace>AspNetFullFrameworkSampleApp</RootNamespace>
<AssemblyName>AspNetFullFrameworkSampleApp</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>

<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<RuntimeIdentifier>win</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildFullFrameworkAsp)' == 'true'">
Expand Down
2 changes: 1 addition & 1 deletion sample/Elastic.Apm.AdoNet/Elastic.Apm.AdoNet.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion sample/MySqlDataSample/MySqlDataSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<MySqlDataVersion Condition="'$(MySqlDataVersion)'==''">8.0.32.1</MySqlDataVersion>
<OutputType>Exe</OutputType>
<TargetFrameworks>net461;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion sample/NpgsqlSample/NpgsqlSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<NpgsqlVersion Condition="'$(NpgsqlVersion)'==''">5.0.7</NpgsqlVersion>
<OutputType>Exe</OutputType>
<TargetFrameworks>net461;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OracleManagedDataAccessVersion Condition="'$(OracleManagedDataAccessVersion)'==''">19.12.0</OracleManagedDataAccessVersion>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading
Loading