Skip to content

Commit b0df7ed

Browse files
committed
Pass "--configuration Release" explicitly (instead of through env var)
Because of microsoft/testfx#7121
1 parent 40e3e06 commit b0df7ed

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Continuous Integration
33
on: push
44

55
env:
6-
Configuration: Release
76
ContinuousIntegrationBuild: true
87
DOTNET_CLI_TELEMETRY_OPTOUT: true
98
DOTNET_NOLOGO: true
@@ -48,9 +47,9 @@ jobs:
4847
- name: ⚙️ Restore NuGet packages
4948
run: dotnet restore
5049
- name: 🏗 Build solution
51-
run: dotnet build --no-restore
50+
run: dotnet build --no-restore --configuration Release
5251
- name: 🧪 Run tests
53-
run: dotnet test --no-build
52+
run: dotnet test --no-build --configuration Release
5453
- name: 📤 Upload received files from failing tests
5554
uses: actions/upload-artifact@v5
5655
if: failure()

tests/Chisel.Tests/Support/TestApp.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ namespace Chisel.Tests;
1717

1818
public sealed class TestApp : IAsyncLifetime
1919
{
20+
private static readonly bool IsContinuousIntegrationBuild = Environment.GetEnvironmentVariable("ContinuousIntegrationBuild") == "true";
21+
2022
private readonly DirectoryInfo _workingDirectory;
2123
private readonly Dictionary<PublishMode, FileInfo> _executables;
2224
private string _packageVersion = "N/A";
@@ -40,7 +42,7 @@ async ValueTask IAsyncLifetime.InitializeAsync()
4042

4143
ValueTask IAsyncDisposable.DisposeAsync()
4244
{
43-
if (Environment.GetEnvironmentVariable("ContinuousIntegrationBuild") == "true")
45+
if (IsContinuousIntegrationBuild)
4446
{
4547
// The NuGet package was already built as part of the tests (PackAsync),
4648
// so move it to the root of the repository for the "Upload NuGet package artifact" step to pick it.
@@ -83,13 +85,18 @@ private async Task CreateTestAppAsync()
8385
private async Task PackAsync()
8486
{
8587
var projectFile = GetFile("src", "Chisel", "Chisel.csproj");
86-
var packArgs = new[] {
88+
var packArgs = new List<string> {
8789
"pack", projectFile.FullName,
8890
"--no-build",
8991
"--output", _workingDirectory.FullName,
9092
"--getProperty:PackageVersion",
9193
};
92-
var packageVersion = await RunDotnetAsync(_workingDirectory, packArgs);
94+
if (IsContinuousIntegrationBuild)
95+
{
96+
packArgs.Add("--configuration");
97+
packArgs.Add("Release");
98+
}
99+
var packageVersion = await RunDotnetAsync(_workingDirectory, packArgs.ToArray());
93100
_packageVersion = packageVersion.TrimEnd();
94101
}
95102

0 commit comments

Comments
 (0)