Skip to content

Commit 8df49dd

Browse files
authored
Prepare for updating tests, small fixes (#1628)
* Bump GHA versions * Update R#, tweak code cleanup - Address breaking change: version is no longer printed - Build upfront - Do not check for updates - Skip NuGet vulnerability checks - Skip roslyn analyzers * Fix test isolation for memory dumps * Fixed: Redis security tests did not run on net10.0 * Reuse shared settings for ConfigurationSchemaGeneratorTests * Replace test categories for OS filter with xUnit attributes * Do not skip Redis test on macOS * Increase timeout for flaky test on Windows * Review feedback: remove extended timeout * Review feedback: rename skip attributes * Review feedback: remove skipFilter * Review feedback: rename skip attributes in comments
1 parent 1fffc2c commit 8df49dd

32 files changed

+186
-155
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"jetbrains.resharper.globaltools": {
6-
"version": "2025.3.0",
6+
"version": "2025.3.0.3",
77
"commands": [
88
"jb"
99
],

.github/workflows/Steeltoe.All.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- os: windows-latest
3939
skipFilter: Category!=Integration
4040
- os: macos-latest
41-
skipFilter: Category!=Integration&Category!=SkipOnMacOS
41+
skipFilter: Category!=Integration
4242
runs-on: ${{ matrix.os }}
4343
continue-on-error: true
4444

@@ -74,12 +74,12 @@ jobs:
7474
# When that happens, select 'Always Allow' to grant 'dotnet' access to the certificate key in the future.
7575
# and the test run fails, but without indicating which test caused it. By setting this, the causing test fails with the next message:
7676
# Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
77-
# To prevent the causing test from failing the test run, disable it on macOS by adding [Trait("Category", "SkipOnMacOS")].
77+
# To prevent the causing test from failing the test run, disable it on macOS using FactSkippedOnPlatform/TheorySkippedOnPlatform.
7878
shell: bash
7979
run: echo "DOTNET_GENERATE_ASPNET_CERTIFICATE=false" >> $GITHUB_ENV
8080

8181
- name: Git checkout
82-
uses: actions/checkout@v4
82+
uses: actions/checkout@v6
8383
with:
8484
persist-credentials: false
8585

@@ -115,7 +115,7 @@ jobs:
115115

116116
- name: Upload crash/hang dumps (on failure)
117117
if: ${{ failure() }}
118-
uses: actions/upload-artifact@v4
118+
uses: actions/upload-artifact@v5
119119
with:
120120
name: FailedTestOutput-${{ matrix.os }}
121121
path: |

.github/workflows/component-configuration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
with:
2626
component: Configuration
2727
OS: ubuntu
28-
runConfigServer: true
28+
runDockerContainers: true

.github/workflows/component-management.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
with:
3232
component: Management
3333
OS: macos
34-
skipFilter: Category!=SkipOnMacOS
3534

3635
windows:
3736
uses: ./.github/workflows/component-shared-workflow.yml

.github/workflows/component-shared-workflow.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ on:
99
OS:
1010
required: true
1111
type: string
12-
skipFilter:
13-
required: false
14-
type: string
15-
runConfigServer:
12+
runDockerContainers:
1613
required: false
1714
type: boolean
1815
default: false
@@ -24,14 +21,10 @@ permissions:
2421
env:
2522
DOTNET_CLI_TELEMETRY_OPTOUT: 1
2623
DOTNET_NOLOGO: true
27-
SOLUTION_FILE: src/Steeltoe.${{ inputs.component }}.slnf
24+
SOLUTION_FILE: 'src/Steeltoe.${{ inputs.component }}.slnf'
2825
COMMON_TEST_ARGS: >-
2926
--no-build --configuration Release --collect "XPlat Code Coverage" --logger trx --results-directory ${{ github.workspace }}/dumps
3027
--settings coverlet.runsettings --blame-crash --blame-hang-timeout 3m
31-
SKIP_FILTER_NO_MEMORY_DUMPS: >-
32-
${{ inputs.skipFilter && format('--filter "{0}&Category!=MemoryDumps"', inputs.skipFilter) || '--filter "Category!=MemoryDumps"' }}
33-
SKIP_FILTER_WITH_MEMORY_DUMPS: >-
34-
${{ inputs.skipFilter && format('--filter "{0}&Category=MemoryDumps"', inputs.skipFilter) || '--filter "Category=MemoryDumps"' }}
3528
3629
jobs:
3730
build:
@@ -41,11 +34,11 @@ jobs:
4134

4235
services:
4336
eurekaServer:
44-
image: ${{ inputs.runConfigServer && 'steeltoe.azurecr.io/eureka-server' || null }}
37+
image: ${{ inputs.runDockerContainers && 'steeltoe.azurecr.io/eureka-server' || null }}
4538
ports:
4639
- 8761:8761
4740
configServer:
48-
image: ${{ inputs.runConfigServer && 'steeltoe.azurecr.io/config-server' || null }}
41+
image: ${{ inputs.runDockerContainers && 'steeltoe.azurecr.io/config-server' || null }}
4942
env:
5043
eureka.client.enabled: true
5144
eureka.client.serviceUrl.defaultZone: http://eurekaServer:8761/eureka
@@ -71,12 +64,12 @@ jobs:
7164
# When that happens, select 'Always Allow' to grant 'dotnet' access to the certificate key in the future.
7265
# and the test run fails, but without indicating which test caused it. By setting this, the causing test fails with the next message:
7366
# Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
74-
# To prevent the causing test from failing the test run, disable it on macOS by adding [Trait("Category", "SkipOnMacOS")].
67+
# To prevent the causing test from failing the test run, disable it on macOS using FactSkippedOnPlatform/TheorySkippedOnPlatform.
7568
shell: bash
7669
run: echo "DOTNET_GENERATE_ASPNET_CERTIFICATE=false" >> $GITHUB_ENV
7770

7871
- name: Git checkout
79-
uses: actions/checkout@v4
72+
uses: actions/checkout@v6
8073
with:
8174
persist-credentials: false
8275

@@ -87,32 +80,31 @@ jobs:
8780
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal
8881

8982
- name: Test (net10.0)
90-
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net10.0 ${{ env.SKIP_FILTER_NO_MEMORY_DUMPS }} ${{ env.COMMON_TEST_ARGS }}
83+
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net10.0 --filter "Category!=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
9184

9285
- name: Test (net10.0) (memory dumps)
9386
if: ${{ inputs.component == 'Management' }}
94-
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net10.0 ${{ env.SKIP_FILTER_WITH_MEMORY_DUMPS }} ${{ env.COMMON_TEST_ARGS }}
87+
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net10.0 --filter "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
9588

9689
- name: Test (net9.0)
97-
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net9.0 ${{ env.SKIP_FILTER_NO_MEMORY_DUMPS }} ${{ env.COMMON_TEST_ARGS }}
90+
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net9.0 --filter "Category!=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
9891

9992
- name: Test (net9.0) (memory dumps)
10093
if: ${{ inputs.component == 'Management' }}
101-
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net9.0 ${{ env.SKIP_FILTER_WITH_MEMORY_DUMPS }} ${{ env.COMMON_TEST_ARGS }}
94+
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net9.0 --filter "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
10295

10396
- name: Test (net8.0)
104-
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net8.0 ${{ env.SKIP_FILTER_NO_MEMORY_DUMPS }} ${{ env.COMMON_TEST_ARGS }}
97+
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net8.0 --filter "Category!=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
10598

10699
- name: Test (net8.0) (memory dumps)
107100
if: ${{ inputs.component == 'Management' }}
108-
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net8.0 ${{ env.SKIP_FILTER_WITH_MEMORY_DUMPS }} ${{ env.COMMON_TEST_ARGS }}
109-
101+
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net8.0 --filter "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
110102

111103
- name: Upload crash/hang dumps (on failure)
112104
if: ${{ failure() }}
113-
uses: actions/upload-artifact@v4
105+
uses: actions/upload-artifact@v5
114106
with:
115-
name: FailedTestOutput-${{ inputs.OS }}
107+
name: FailedTestOutput-${{ inputs.OS }}-latest
116108
path: |
117109
${{ github.workspace }}/dumps/**/*.dmp
118110
${{ github.workspace }}/dumps/**/Sequence_*.xml
@@ -122,7 +114,7 @@ jobs:
122114
if: ${{ !cancelled() }}
123115
uses: dorny/test-reporter@v2
124116
with:
125-
name: ${{ inputs.OS }} test results
117+
name: ${{ inputs.OS }}-latest test results
126118
reporter: dotnet-trx
127119
path: '**/*.trx'
128120
fail-on-empty: 'true'

.github/workflows/package.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
10.0.*
4141
4242
- name: Git checkout
43-
uses: actions/checkout@v4
43+
uses: actions/checkout@v6
4444
with:
4545
persist-credentials: false
4646

@@ -123,7 +123,7 @@ jobs:
123123
run: dotnet pack ${{ env.SOLUTION_FILE }} --no-build --configuration Release --output ${{ github.workspace }}/packages /p:VersionSuffix=${{ env.PACKAGE_VERSION_SUFFIX }}
124124

125125
- name: Upload unsigned packages
126-
uses: actions/upload-artifact@v4
126+
uses: actions/upload-artifact@v5
127127
with:
128128
if-no-files-found: error
129129
name: unsigned-packages
@@ -174,7 +174,7 @@ jobs:
174174
--description-url 'https://steeltoe.io/'
175175
176176
- name: Upload signed packages
177-
uses: actions/upload-artifact@v4
177+
uses: actions/upload-artifact@v5
178178
with:
179179
if-no-files-found: error
180180
name: signed-packages
@@ -263,7 +263,7 @@ jobs:
263263

264264
steps:
265265
- name: Git checkout
266-
uses: actions/checkout@v4
266+
uses: actions/checkout@v6
267267
with:
268268
persist-credentials: true
269269

.github/workflows/scan-vulnerable-dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
10.0.*
3737
3838
- name: Git checkout
39-
uses: actions/checkout@v4
39+
uses: actions/checkout@v6
4040
with:
4141
persist-credentials: false
4242

.github/workflows/sonarcube.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: dotnet tool install --global dotnet-sonarscanner
6060

6161
- name: Git checkout
62-
uses: actions/checkout@v4
62+
uses: actions/checkout@v6
6363
with:
6464
persist-credentials: false
6565
# Sonar: Shallow clones should be disabled for a better relevancy of analysis.

.github/workflows/verify-code-style.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
10.0.*
3636
3737
- name: Git checkout
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@v6
3939
with:
4040
persist-credentials: false
4141
fetch-depth: 2
@@ -44,7 +44,10 @@ jobs:
4444
run: dotnet tool restore --verbosity minimal
4545

4646
- name: Restore packages
47-
run: dotnet restore ${{ env.SOLUTION_FILE }} /p:Configuration=Release --verbosity minimal
47+
run: dotnet restore ${{ env.SOLUTION_FILE }} /p:Configuration=Release /p:NuGetAudit=false --verbosity minimal
48+
49+
- name: Build
50+
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release /p:RunAnalyzers=false
4851

4952
- name: CleanupCode (on PR diff)
5053
if: ${{ github.event_name == 'pull_request' }}
@@ -56,11 +59,13 @@ jobs:
5659
$baseCommitHash = git rev-parse HEAD~1
5760
5861
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request."
59-
dotnet regitlint -s ${{ env.SOLUTION_FILE }} --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
62+
dotnet jb cleanupcode --version
63+
dotnet regitlint -s $env:SOLUTION_FILE --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
6064
6165
- name: CleanupCode (on branch)
62-
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' }}
66+
if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
6367
shell: pwsh
6468
run: |
65-
Write-Output "Running code cleanup on all files."
66-
dotnet regitlint -s ${{ env.SOLUTION_FILE }} --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN --fail-on-diff --print-diff
69+
Write-Output 'Running code cleanup on all files.'
70+
dotnet jb cleanupcode --version
71+
dotnet regitlint -s $env:SOLUTION_FILE --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN --fail-on-diff --print-diff

cleanupcode.ps1

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Version 7.0
1+
#Requires -Version 7.4
22

33
# This script reformats (part of) the codebase to make it compliant with our coding guidelines.
44

@@ -7,38 +7,31 @@ param(
77
[string] $revision
88
)
99

10-
function VerifySuccessExitCode {
11-
if ($LastExitCode -ne 0) {
12-
throw "Command failed with exit code $LastExitCode."
13-
}
14-
}
10+
$ErrorActionPreference = "Stop"
11+
$PSNativeCommandUseErrorActionPreference = $true
12+
$solutionFile = 'src/Steeltoe.All.sln'
1513

1614
dotnet tool restore
17-
VerifySuccessExitCode
18-
19-
dotnet restore src
20-
VerifySuccessExitCode
15+
dotnet restore $solutionFile /p:NuGetAudit=false
16+
dotnet build $solutionFile --no-restore --configuration Release /p:RunAnalyzers=false
2117

2218
if ($revision) {
2319
$headCommitHash = git rev-parse HEAD
24-
VerifySuccessExitCode
25-
2620
$baseCommitHash = git rev-parse $revision
27-
VerifySuccessExitCode
2821

2922
if ($baseCommitHash -eq $headCommitHash) {
3023
Write-Output "Running code cleanup on staged/unstaged files."
31-
dotnet regitlint -s src/Steeltoe.All.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --properties:Configuration=Release --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f staged,modified
32-
VerifySuccessExitCode
24+
dotnet jb cleanupcode --version
25+
dotnet regitlint -s $solutionFile --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f staged,modified
3326
}
3427
else {
3528
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash, including staged/unstaged files."
36-
dotnet regitlint -s src/Steeltoe.All.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --properties:Configuration=Release --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f staged,modified,commits -a $headCommitHash -b $baseCommitHash
37-
VerifySuccessExitCode
29+
dotnet jb cleanupcode --version
30+
dotnet regitlint -s $solutionFile --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f staged,modified,commits -a $headCommitHash -b $baseCommitHash
3831
}
3932
}
4033
else {
4134
Write-Output "Running code cleanup on all files."
42-
dotnet regitlint -s src/Steeltoe.All.sln --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --properties:Configuration=Release --jb --properties:NuGetAudit=false --jb --verbosity=WARN
43-
VerifySuccessExitCode
35+
dotnet jb cleanupcode --version
36+
dotnet regitlint -s $solutionFile --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN
4437
}

0 commit comments

Comments
 (0)