Skip to content

Commit ed47b99

Browse files
authored
Improve dotnet test output in pipelines (#550)
* ci: test * test: let test fail * ci: add missing quote * ci: correct path * chore: install logger in all test projects * chore: set default formatter for xml * ci: use logger in all dotnet test calls * ci: remove test pipeline * test: install logger in remaining projects * test: install logger in remaining projects * test: remove duplicated references to GitHubActionsTestLogger * ci: convert test script to sh * ci: convert checkFormatting script to sh * ci: fix checkFormatting script name * test: remove intentionally failing test * ci: try to not use logger for postgres integration tests * ci: try to not include passed and skipped tests for sql server integration tests * ci: make scripts executable * chore: try to remove everything regarding SpecflowCucumberExporter * chore: remove redundant backtick * Revert "ci: try to not include passed and skipped tests for sql server integration tests" This reverts commit 85dadf7. * Revert "ci: try to not use logger for postgres integration tests" This reverts commit 5b350c5. * ci: set DOTNET_CONSOLE_ANSI_COLOR for all dotnet test actions * ci: use github action to run transport tests * chore: add "--no-build" flag to `dotnet publish` command in AdminCli's Dockerfile * chore: remove "/property:WarningLevel=0" from all commands * ci: let test fail * chore: remove publish stage from Admin CLI Dockerfile * chore: remove dotnet build from Admin CLI Dockerfile * chore: fix compiler warnings * Revert "ci: let test fail" This reverts commit b25a129. * Revert "ci: use github action to run transport tests" This reverts commit fae8312. * chore: remove unnecessary using directive
1 parent 08bddb1 commit ed47b99

File tree

41 files changed

+158
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+158
-50
lines changed

.ci/checkFormatting.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

.ci/checkFormatting.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
dotnet format --verify-no-changes

.ci/integrationTest.postgres.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dockerCompose down
99
dockerCompose build
1010
dockerCompose up -d
1111
dotnet restore "Backbone.sln"
12-
dotnet build /property:WarningLevel=0 --no-restore "Backbone.sln"
12+
dotnet build --no-restore "Backbone.sln"
1313
export CONSUMER_API_BASE_ADDRESS="http://localhost:5000"
1414
export ADMIN_API_BASE_ADDRESS="http://localhost:5173"
15-
dotnet test --no-restore --no-build --filter "Category=Integration&TestCategory!~ignore" "Backbone.sln"
15+
dotnet test --no-restore --no-build --filter "Category=Integration&TestCategory!~ignore" --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" "Backbone.sln"

.ci/integrationTest.sqlserver.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dockerCompose down
99
dockerCompose build
1010
dockerCompose up -d
1111
dotnet restore "Backbone.sln"
12-
dotnet build /property:WarningLevel=0 --no-restore "Backbone.sln"
12+
dotnet build --no-restore "Backbone.sln"
1313
export CONSUMER_API_BASE_ADDRESS="http://localhost:5000"
1414
export ADMIN_API_BASE_ADDRESS="http://localhost:5173"
15-
dotnet test --no-restore --no-build --filter "Category=Integration&TestCategory!~ignore" "Backbone.sln"
15+
dotnet test --no-restore --no-build --filter "Category=Integration&TestCategory!~ignore" --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" "Backbone.sln"

.ci/test.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

.ci/test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
dotnet restore "Backbone.sln"
4+
dotnet build --no-restore "Backbone.sln"
5+
dotnet test --no-restore --no-build --filter "Category!=Integration" --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" "Backbone.sln"

.github/workflows/test.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ jobs:
3030
with:
3131
dotnet-version: "8.0.x"
3232
- name: Check formatting
33-
run: ./.ci/checkFormatting.js
33+
run: ./.ci/checkFormatting.sh
3434

3535
test:
3636
runs-on: ubuntu-latest
3737
name: Run Tests
3838
steps:
3939
- name: Checkout
4040
uses: actions/checkout@v4
41-
- name: Install script dependencies
42-
run: npm install --prefix ./.ci
4341
- name: Setup dotnet
4442
uses: actions/setup-dotnet@v4
4543
with:
4644
dotnet-version: "8.0.x"
4745
- name: Run tests
48-
run: ./.ci/test.js
46+
run: ./.ci/test.sh
47+
env:
48+
DOTNET_CONSOLE_ANSI_COLOR: true
4949

5050
integration-test-sqlserver:
5151
name: Run Integration Tests (on SQL Server)
@@ -66,6 +66,8 @@ jobs:
6666
with:
6767
name: integration-test-sqlserver-docker-logs
6868
path: docker-log.txt
69+
env:
70+
DOTNET_CONSOLE_ANSI_COLOR: true
6971

7072
integration-test-postgres:
7173
name: Run Integration Tests (on Postgres)
@@ -86,6 +88,8 @@ jobs:
8688
with:
8789
name: integration-test-postgres-docker-logs
8890
path: docker-log.txt
91+
env:
92+
DOTNET_CONSOLE_ANSI_COLOR: true
8993

9094
transport-test-sqlserver:
9195
name: Run transport Tests (on SQL Server)

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
"[html]": {
2121
"editor.defaultFormatter": "esbenp.prettier-vscode"
2222
},
23+
"[xml]": {
24+
"editor.defaultFormatter": "DotJoshJohnson.xml"
25+
},
2326
"editor.formatOnSave": true,
2427
"editor.formatOnPaste": true,
2528
"files.autoSave": "off",

AdminApi/src/AdminApi/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ RUN dotnet restore "AdminApi/src/AdminApi/AdminApi.csproj"
8989

9090
COPY . .
9191

92-
RUN dotnet publish /property:WarningLevel=0 /p:UseAppHost=false --no-restore --configuration Release --output /app/publish "/src/AdminApi/src/AdminApi/AdminApi.csproj"
92+
RUN dotnet publish /p:UseAppHost=false --no-restore --configuration Release --output /app/publish "/src/AdminApi/src/AdminApi/AdminApi.csproj"
9393
RUN dotnet publish --configuration Release --output /app/publish/health "HealthCheck/HealthCheck.csproj"
9494

9595
### Final ####

AdminApi/src/AdminApi/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static void ConfigureServices(IServiceCollection services, IConfiguration config
9494
.ConfigureAndValidate<AdminConfiguration>(configuration.Bind)
9595
.ConfigureAndValidate<ApplicationOptions>(options => configuration.GetSection("Modules:Devices:Application").Bind(options));
9696

97-
#pragma warning disable ASP0000 We retrieve the Configuration via IOptions here so that it is validated
97+
#pragma warning disable ASP0000 // We retrieve the Configuration via IOptions here so that it is validated
9898
var parsedConfiguration = services.BuildServiceProvider().GetRequiredService<IOptions<AdminConfiguration>>().Value;
9999

100100
#pragma warning restore ASP0000

0 commit comments

Comments
 (0)