Skip to content

Commit b4078d1

Browse files
committed
Introduce coverlet DevContainer
- Added `devcontainer.json` for .NET 8.0 development environment with VS Code customizations. - Introduced `build-all.sh` script to automate the build process for Coverlet, including cleanup, building projects, and running tests with coverage reporting.
1 parent 47cdd27 commit b4078d1

File tree

5 files changed

+131
-3
lines changed

5 files changed

+131
-3
lines changed

.devcontainer/devcontainer.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
3+
{
4+
"name": "coverlet .NET 8.0)",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",
7+
"features": {
8+
"ghcr.io/devcontainers/features/dotnet:2": {
9+
"version": "8.0.114",
10+
"additionalVersions": "6.0.428"
11+
}
12+
},
13+
14+
// Features to add to the dev container. More info: https://containers.dev/features.
15+
// "features": {},
16+
17+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
18+
// "forwardPorts": [5000, 5001],
19+
// "portsAttributes": {
20+
// "5001": {
21+
// "protocol": "https"
22+
// }
23+
// }
24+
25+
// Use 'postCreateCommand' to run commands after the container is created.
26+
// "postCreateCommand": "dotnet restore",
27+
28+
// Configure tool-specific properties.
29+
"customizations": {
30+
"vscode": {
31+
"extensions": [
32+
"ms-dotnettools.vscode-dotnet-runtime",
33+
"visualstudioexptteam.vscodeintellicode",
34+
"GitHub.vscode-pull-request-github",
35+
"ms-dotnettools.csharp",
36+
"ms-dotnettools.dotnet-interactive-vscode",
37+
"ms-dotnettools.csdevkit",
38+
"ms-vscode.powershell",
39+
"ms-azure-devops.azure-pipelines",
40+
"streetsidesoftware.code-spell-checker",
41+
"streetsidesoftware.code-spell-checker-german",
42+
"streetsidesoftware.code-spell-checker-english",
43+
"fernandoescolar.vscode-solution-explorer"]
44+
}
45+
},
46+
47+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
48+
// "remoteUser": "root"
49+
}

eng/azure-pipelines-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ steps:
1010
- task: UseDotNet@2
1111
inputs:
1212
useGlobalJson: true
13-
displayName: Install .NET Core SDK 8.0.113
13+
displayName: Install .NET Core SDK 8.0.114
1414

1515
- task: NuGetAuthenticate@1
1616
displayName: Authenticate with NuGet feeds

eng/build-all.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
3+
# Build Script for Coverlet
4+
# ------------------------
5+
# This script provides a complete build environment setup and cleanup for Coverlet development.
6+
# It's designed to support fast branch switching by:
7+
# - Cleaning all temporary build artifacts
8+
# - Removing cached NuGet packages
9+
# - Rebuilding all projects and tests
10+
# - Generating new binlogs for debugging
11+
#
12+
# Key features:
13+
# - Cleans TestResults, bin, obj folders for clean builds
14+
# - Removes cached NuGet packages to prevent version conflicts
15+
# - Builds and packs all Coverlet projects
16+
# - Generates binlogs for build diagnostics
17+
# - Supports CI builds with ContinuousIntegrationBuild=true
18+
#
19+
# Usage: ./scripts/build-all.sh
20+
#
21+
# Note: Run this script after switching branches to ensure a clean development environment
22+
23+
# Cleanup temp folders and files
24+
echo "Please cleanup temp folder!"
25+
dotnet build-server shutdown
26+
rm -f coverage.cobertura.xml
27+
rm -f coverage.json
28+
rm -f coverage.net8.0.json
29+
rm -f test/coverlet.integration.determisticbuild/*.binlog
30+
rm -rf artifacts
31+
32+
# Clean nuget packages
33+
rm -rf ~/.nuget/packages/coverlet.msbuild/V1.0.0
34+
rm -rf ~/.nuget/packages/coverlet.collector/V1.0.0
35+
find . -type d \( -name "TestResults" -o -name "bin" -o -name "obj" \) -exec rm -rf {} +
36+
find ~/.nuget/packages -type d \( -name "coverlet.msbuild" -o -name "coverlet.collector" -o -name "coverlet.console" \) -name "8.0.0-preview*" -exec rm -rf {} +
37+
38+
# Build and pack projects
39+
dotnet pack -c Debug src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj /p:ContinuousIntegrationBuild=true
40+
dotnet pack -c Debug src/coverlet.collector/coverlet.collector.csproj /p:ContinuousIntegrationBuild=true
41+
dotnet build -bl:build.binlog /p:ContinuousIntegrationBuild=true
42+
43+
# Create binlog for tests
44+
dotnet build test/coverlet.collector.tests/coverlet.collector.tests.csproj -bl:build.collector.tests.binlog /p:ContinuousIntegrationBuild=true
45+
dotnet build test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj -bl:build.core.coverage.tests.binlog /p:ContinuousIntegrationBuild=true
46+
dotnet build test/coverlet.core.tests/coverlet.core.tests.csproj -bl:build.coverlet.core.tests.binlog /p:ContinuousIntegrationBuild=true
47+
48+
# Create nuget packages
49+
dotnet pack -c Debug src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj /p:ContinuousIntegrationBuild=true
50+
dotnet pack -c Debug src/coverlet.collector/coverlet.collector.csproj /p:ContinuousIntegrationBuild=true
51+
dotnet pack -c Debug src/coverlet.console/coverlet.console.csproj /p:ContinuousIntegrationBuild=true
52+
dotnet pack -c Debug src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj /p:ContinuousIntegrationBuild=true
53+
dotnet pack src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj /p:ContinuousIntegrationBuild=true
54+
dotnet pack src/coverlet.collector/coverlet.collector.csproj /p:ContinuousIntegrationBuild=true
55+
dotnet pack src/coverlet.console/coverlet.console.csproj /p:ContinuousIntegrationBuild=true
56+
dotnet pack src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj /p:ContinuousIntegrationBuild=true
57+
58+
dotnet build-server shutdown
59+
60+
# Commented out sections converted to shell script comments
61+
: <<'END_COMMENT'
62+
dotnet publish tool/Microsoft.DotNet.RemoteExecutor/tests/Microsoft.DotNet.RemoteExecutor.Tests.csproj
63+
64+
dotnet test test/coverlet.collector.tests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*" --results-directory:"./artifacts/Reports"
65+
dotnet test test/coverlet.core.tests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*" --results-directory:"./artifacts/Reports"
66+
dotnet test test/coverlet.integration.tests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*" --results-directory:"./artifacts/Reports"
67+
dotnet test test/coverlet.msbuild.tasks.tests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*" --results-directory:"./artifacts/Reports"
68+
69+
dotnet test test/coverlet.core.tests/coverlet.core.tests.csproj /p:CollectCoverage=true -c Debug --no-build -bl:test.core.binlog --diag:"artifacts/log/debug/coverlet.core.test.diag.log;tracelevel=verbose"
70+
dotnet test test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj /p:CollectCoverage=true -c Debug --no-build -bl:test.core.coverage.binlog --diag:"artifacts/log/debug/coverlet.core.coverage.test.diag.log;tracelevel=verbose"
71+
dotnet test test/coverlet.msbuild.tasks.tests/coverlet.msbuild.tasks.tests.csproj /p:CollectCoverage=true -c Debug --no-build -bl:test.msbuild.binlog --diag:"artifacts/log/debug/coverlet.msbuild.test.diag.log;tracelevel=verbose"
72+
73+
dotnet test --no-build -bl:test.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*,\[coverlet.tests.xunit.extensions]*,\[coverlet.tests.projectsample]*,\[testgen_]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"artifacts/log/Debug/coverlet.test.diag.log;tracelevel=verbose"
74+
75+
dotnet test -c Debug --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
76+
reportgenerator -reports:"**/*.opencover.xml" -targetdir:"artifacts/reports" -reporttypes:"HtmlInline_AzurePipelines_Dark;Cobertura" -assemblyfilters:"-xunit;-coverlet.testsubject;-Coverlet.Tests.ProjectSample.*;-coverlet.core.tests.samples.netstandard;-coverlet.tests.utils;-coverlet.tests.xunit.extensions;-coverletsamplelib.integration.template;-testgen_*"
77+
78+
dotnet test test/coverlet.core.remote.tests/coverlet.core.remote.tests.csproj -c Debug /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --diag:"artifacts/log/debug/coverlet.core.remote.test.diag.log;tracelevel=verbose"
79+
END_COMMENT

eng/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ steps:
77
- task: UseDotNet@2
88
inputs:
99
useGlobalJson: true
10-
displayName: Install .NET Core SDK 8.0.113
10+
displayName: Install .NET Core SDK 8.0.114
1111

1212
# create artifact/package folder
1313
- pwsh: |

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "8.0.113"
3+
"version": "8.0.114"
44
}
55
}

0 commit comments

Comments
 (0)