Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5ab0a31
LAPP-19 updating minicover tool and excluding Test.NetStandard20 from…
cgalan-applaudo Feb 13, 2020
5fe1554
Downgrade of minicover to make it compatible with netcore 2.0
cgalan-applaudo Feb 13, 2020
7735bf8
Blank commit to re-trigger CircleCI
cgalan-applaudo Feb 13, 2020
72e3234
LAPP-19 updating minicover and using new available options
cgalan-applaudo Feb 14, 2020
569906d
LAPP-19 updating coverage_report.sh
cgalan-applaudo Feb 14, 2020
fc3cf2c
LAPP-19 adding dotnet tool path to CircleCi config file
cgalan-applaudo Feb 14, 2020
dfb128d
LAPP-19 fixing circle config
cgalan-applaudo Feb 14, 2020
3d1f727
LAPP-19 fixing circle config
cgalan-applaudo Feb 14, 2020
25a71f0
LAPP-19 upgrading netcore to 2.2 on coverage job
cgalan-applaudo Feb 14, 2020
43862b0
LAPP-19 Creating steps for code coverage on Net35 and Net45
cgalan-applaudo Feb 18, 2020
16cad7b
LAPP-19 adding nuget package: OpenCover
cgalan-applaudo Feb 18, 2020
cde3cc1
LAPP-19 using bash to send code coverage report to codecov
cgalan-applaudo Feb 18, 2020
3f3167f
LAPP-19 fixing indentation
cgalan-applaudo Feb 18, 2020
3d5df88
LAPP-19 Adding coverage validation step on CircleCi
cgalan-applaudo Feb 19, 2020
ddc94c3
LAPP-19 reduced threshold to pass the IC controls
cgalan-applaudo Feb 19, 2020
88dc080
Merge branch 'master' into feature/LAPP-19
cgalan-applaudo Mar 4, 2020
d68a244
LAPP-19 Excluding async flush hander and blocking queue files from th…
cgalan-applaudo Mar 4, 2020
4a57e1c
blank commit
cgalan-applaudo Mar 4, 2020
1e18d21
blank commit
cgalan-applaudo Mar 4, 2020
d44d9c0
blank commit
cgalan-applaudo Mar 4, 2020
90b074f
blank commit
cgalan-applaudo Mar 4, 2020
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
58 changes: 56 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2
version: 2.1

_run:
notify_on_fail: &notify_on_fail
Expand All @@ -7,6 +7,9 @@ _run:
wget https://raw.githubusercontent.com/segmentio/circleci-notifications/master/slack-notify-branch.sh
chmod u+x slack-notify-branch.sh
BUILD_STATUS="Failed" NOTIFY_BRANCH="master scheduled_e2e_testing" ./slack-notify-branch.sh
orbs:
win: circleci/windows@2.2.0


jobs:
build:
Expand Down Expand Up @@ -37,15 +40,64 @@ jobs:
coverage:
working_directory: /coverage
docker:
- image: microsoft/dotnet:2.0-sdk
- image: microsoft/dotnet:2.2-sdk
environment:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OUTPUT: 1
steps:
- run:
name: Install minicover tool
command: |
echo 'export PATH=$HOME/.dotnet/tools:$PATH' >> $BASH_ENV
dotnet tool install -g minicover --version 3.0.6
- checkout
- run: chmod +x Test.NetStandard20/coverage_report.sh
- run: cd Test.NetStandard20 && ./coverage_report.sh
- run: bash <(curl -s https://codecov.io/bash)
coverage_net35:
working_directory: /coverage_net35
executor:
name: win/default
steps:
- run:
name: Install code coverage tools
command: |
choco install opencover.portable
dotnet tool install -g dotnet-reportgenerator-globaltool --version 4.4.7
- checkout
- run: nuget restore Test.Net35/Test.Net35.csproj -SolutionDirectory ./
- run: msbuild Test.Net35/Test.Net35.csproj /t:restore
- run: msbuild Test.Net35/Test.Net35.csproj /p:Configuration=Debug
- run: OpenCover.Console.exe "-target:./packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe" "-register:user" "-output:opencover.xml" "-targetargs:.\Test.Net35\bin\Debug\Test.Net35.dll" -filter:"+[Analytics*]* -[Test*]*"
- run:
name: "Validating coverage"
command: |
& .\ValidateCoverage.ps1 -threshold 70
- run:
command: bash <(curl -s https://codecov.io/bash) -f ./opencover.xml
shell: bash.exe
coverage_net45:
working_directory: /coverage_net45
executor:
name: win/default
steps:
- run:
name: Install code coverage tools
command: |
choco install opencover.portable
dotnet tool install -g dotnet-reportgenerator-globaltool --version 4.4.7
- checkout
- run: nuget restore Test.Net45/Test.Net45.csproj -SolutionDirectory ./
- run: msbuild Test.Net45/Test.Net45.csproj /t:restore
- run: msbuild Test.Net45/Test.Net45.csproj /p:Configuration=Debug
- run: OpenCover.Console.exe "-target:./packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe" "-register" "-output:opencover.xml" "-targetargs:.\Test.Net45\bin\Debug\Test.Net45.dll" -filter:"+[Analytics*]* -[Test*]*"
- run:
name: "Validating coverage"
command: |
& .\ValidateCoverage.ps1 -threshold 70
- run:
command: bash <(curl -s https://codecov.io/bash) -f ./opencover.xml
shell: bash.exe
test:
working_directory: /test
docker:
Expand Down Expand Up @@ -114,6 +166,8 @@ workflows:
jobs:
- build
- coverage
- coverage_net35
- coverage_net45
- test
- test_20
- test_35
Expand Down
4 changes: 4 additions & 0 deletions Analytics.Net45/Analytics.Net45.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<Compile Include="../Analytics/**/*.cs" Exclude="../Analytics/obj/**/*.cs">
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Remove="..\Analytics\Flush\AsyncFlushHandler.cs" />
<Compile Remove="..\Analytics\Flush\BlockingQueue.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
Expand Down
3 changes: 1 addition & 2 deletions Analytics/Request/BlockingRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ public async Task MakeRequest(Batch batch)
#else
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", BasicAuthHeader(batch.WriteKey, string.Empty));
#endif

// Prepare request data;
var requestData = Encoding.UTF8.GetBytes(json);

Expand Down Expand Up @@ -238,7 +237,7 @@ public async Task MakeRequest(Batch batch)
var response = await _httpClient.PostAsync(uri, content).ConfigureAwait(false);

watch.Stop();
statusCode = (int)response.StatusCode;
statusCode = (int)response.StatusCode;

if (statusCode == (int)HttpStatusCode.OK)
{
Expand Down
4 changes: 0 additions & 4 deletions Test.NetStandard20/Test.NetStandard20.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<ProjectReference Include="../Analytics.NetStandard20/Analytics.NetStandard20.csproj" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="MiniCover" Version="2.0.0-ci-20181108093139" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Test.NetStandard20/coverage_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -ex

dotnet restore
dotnet build
dotnet minicover instrument --workdir ../ --assemblies Test.NetStandard20/**/bin/**/*.dll --sources /**/*.cs
dotnet minicover reset
minicover instrument --workdir ../ --assemblies Test.NetStandard20/**/bin/**/*.dll --sources Analytics/**/*.cs --tests Test.NetStandard20/**/*.cs
minicover reset
dotnet test --no-build
dotnet minicover opencoverreport --workdir ../ --threshold 80
minicover opencoverreport --workdir ../ --threshold 80
1 change: 0 additions & 1 deletion Test/ClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using NUnit.Framework;

using System;
using System.Collections.Generic;

using Segment;
Expand Down
11 changes: 11 additions & 0 deletions ValidateCoverage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
param(
[Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)]
[decimal]
$threshold = 80
)

ReportGenerator.exe "-reports:opencover.xml" "-targetdir:./coverage" "-reporttypes:textSummary"
$fileContent = Get-Content -Path ./coverage/Summary.txt -TotalCount 11
$covStr = [regex]::match($fileContent,'Line coverage: (\d+\.?\d?)%').Groups[1].Value
$cov = [decimal]$covStr
if($cov -lt $threshold) {throw "coverage is not meeting expectations. Expected: $threshold, Actual: $cov"}