Skip to content

Commit d306c94

Browse files
TimHessbart-vmware
andauthored
Component builds in GitHub Actions (#1518)
* Add GHA workflows for component builds - except Configuration (tackle containers next) * cleaner names, add configuration (w/o using template) * Update .github/workflows/component-shared-workflow.yml Co-authored-by: Bart Koelman <104792814+bart-vmware@users.noreply.github.com> * remove continue-on-error: true, add missing eureka vars * report test results * fix configuration workflow * add concurrency settings, use shared workflow for config too * fix port copy-pasta, test cancel-in-progress * always try to report tests * start eureka before config server * pause for 30 seconds when config server runs allow time for discovery-first * container names * remove the 30 second pause for discovery-first * Update .github/workflows/component-shared-workflow.yml Co-authored-by: Bart Koelman <104792814+bart-vmware@users.noreply.github.com> * don't warn when no hang dumps, try skipping upload of .trx files * Test reporter: fail on empy test results, don't add a secondary failure when there are failed tests * reduce workflow permissions * adjust for memory dump test separation * Apply suggestions from code review Co-authored-by: Bart Koelman <104792814+bart-vmware@users.noreply.github.com> --------- Co-authored-by: Bart Koelman <104792814+bart-vmware@users.noreply.github.com>
1 parent a2b3556 commit d306c94

File tree

8 files changed

+320
-0
lines changed

8 files changed

+320
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Steeltoe.Common
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
paths:
7+
- .editorconfig
8+
- stylecop.json
9+
- '*.props'
10+
- '*.ruleset'
11+
- .config/dotnet-tools.json
12+
- .github/workflows/component-shared-workflow.yml
13+
- .github/workflows/component-common.yml
14+
- src/Common/**
15+
- src/Steeltoe.Common.slnf
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linux:
23+
uses: ./.github/workflows/component-shared-workflow.yml
24+
with:
25+
component: Common
26+
OS: ubuntu
27+
28+
windows:
29+
uses: ./.github/workflows/component-shared-workflow.yml
30+
with:
31+
component: Common
32+
OS: windows
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Steeltoe.Configuration
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
paths:
7+
- .editorconfig
8+
- stylecop.json
9+
- '*.props'
10+
- '*.ruleset'
11+
- .config/dotnet-tools.json
12+
- .github/workflows/component-shared-workflow.yml
13+
- .github/workflows/component-configuration.yml
14+
- src/Configuration/**
15+
- src/Steeltoe.Configuration.slnf
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linux:
23+
uses: ./.github/workflows/component-shared-workflow.yml
24+
with:
25+
component: Configuration
26+
OS: ubuntu
27+
runConfigServer: true
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Steeltoe.Connectors
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
paths:
7+
- .editorconfig
8+
- stylecop.json
9+
- '*.props'
10+
- '*.ruleset'
11+
- .config/dotnet-tools.json
12+
- .github/workflows/component-shared-workflow.yml
13+
- .github/workflows/component-connectors.yml
14+
- src/Connectors/**
15+
- src/Steeltoe.Connectors.slnf
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linux:
23+
uses: ./.github/workflows/component-shared-workflow.yml
24+
with:
25+
component: Connectors
26+
OS: ubuntu
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Steeltoe.Discovery
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
paths:
7+
- .editorconfig
8+
- stylecop.json
9+
- '*.props'
10+
- '*.ruleset'
11+
- .config/dotnet-tools.json
12+
- .github/workflows/component-shared-workflow.yml
13+
- .github/workflows/component-discovery.yml
14+
- src/Discovery/**
15+
- src/Steeltoe.Discovery.slnf
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linux:
23+
uses: ./.github/workflows/component-shared-workflow.yml
24+
with:
25+
component: Discovery
26+
OS: ubuntu
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Steeltoe.Logging
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
paths:
7+
- .editorconfig
8+
- stylecop.json
9+
- '*.props'
10+
- '*.ruleset'
11+
- .config/dotnet-tools.json
12+
- .github/workflows/component-shared-workflow.yml
13+
- .github/workflows/component-logging.yml
14+
- src/Logging/**
15+
- src/Steeltoe.Logging.slnf
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linux:
23+
uses: ./.github/workflows/component-shared-workflow.yml
24+
with:
25+
component: Logging
26+
OS: ubuntu
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Steeltoe.Management
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
paths:
7+
- .editorconfig
8+
- stylecop.json
9+
- '*.props'
10+
- '*.ruleset'
11+
- .config/dotnet-tools.json
12+
- .github/workflows/component-shared-workflow.yml
13+
- .github/workflows/component-management.yml
14+
- src/Management/**
15+
- src/Steeltoe.Management.slnf
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linux:
23+
uses: ./.github/workflows/component-shared-workflow.yml
24+
with:
25+
component: Management
26+
OS: ubuntu
27+
28+
macos:
29+
uses: ./.github/workflows/component-shared-workflow.yml
30+
with:
31+
component: Management
32+
OS: macos
33+
skipFilter: Category!=SkipOnMacOS
34+
35+
windows:
36+
uses: ./.github/workflows/component-shared-workflow.yml
37+
with:
38+
component: Management
39+
OS: windows
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Steeltoe.Security
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
paths:
7+
- .editorconfig
8+
- stylecop.json
9+
- '*.props'
10+
- '*.ruleset'
11+
- .config/dotnet-tools.json
12+
- .github/workflows/component-shared-workflow.yml
13+
- .github/workflows/component-security.yml
14+
- src/Security/**
15+
- src/Steeltoe.Security.slnf
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linux:
23+
uses: ./.github/workflows/component-shared-workflow.yml
24+
with:
25+
component: Security
26+
OS: ubuntu
27+
windows:
28+
uses: ./.github/workflows/component-shared-workflow.yml
29+
with:
30+
component: Security
31+
OS: windows
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# .github/workflows/component-shared-workflow.yml
2+
3+
name: Component Build
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
component:
9+
required: true
10+
type: string
11+
OS:
12+
required: true
13+
type: string
14+
skipFilter:
15+
required: false
16+
type: string
17+
runConfigServer:
18+
required: false
19+
type: boolean
20+
default: false
21+
22+
permissions:
23+
contents: read
24+
pull-requests: write
25+
26+
jobs:
27+
build:
28+
name: Build ${{ inputs.component }} on ${{ inputs.OS }}
29+
runs-on: ${{ inputs.OS }}-latest
30+
31+
services:
32+
eurekaServer:
33+
image: ${{ inputs.runConfigServer && 'steeltoe.azurecr.io/eureka-server' || null }}
34+
ports:
35+
- 8761:8761
36+
configServer:
37+
image: ${{ inputs.runConfigServer && 'steeltoe.azurecr.io/config-server' || null }}
38+
env:
39+
eureka.client.enabled: true
40+
eureka.client.serviceUrl.defaultZone: http://eurekaServer:8761/eureka
41+
eureka.instance.hostname: localhost
42+
eureka.instance.instanceId: localhost:configServer:8888
43+
ports:
44+
- 8888:8888
45+
46+
env:
47+
DOTNET_NOLOGO: true
48+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
49+
DOTNET_GENERATE_ASPNET_CERTIFICATE: ${{ inputs.OS == 'macOS' && 'false' || '' }}
50+
SolutionFile: src/Steeltoe.${{ inputs.component }}.slnf
51+
CommonTestArgs: >-
52+
--no-build --configuration Release --blame-crash --blame-hang-timeout 3m
53+
--collect "XPlat Code Coverage" --settings coverlet.runsettings --logger trx --results-directory ${{ github.workspace }}
54+
SkipFilterWithoutMemoryDumps: ${{ inputs.skipFilter && format('--filter "{0}&Category!=MemoryDumps"', inputs.skipFilter) || '--filter "Category!=MemoryDumps"' }}
55+
SkipFilterWithMemoryDumps: ${{ inputs.skipFilter && format('--filter "{0}&Category=MemoryDumps"', inputs.skipFilter) || '--filter "Category=MemoryDumps"' }}
56+
57+
steps:
58+
- name: Checkout repo
59+
uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 0
62+
63+
- name: Setup .NET
64+
uses: actions/setup-dotnet@v4
65+
with:
66+
dotnet-version: |
67+
8.0.*
68+
9.0.*
69+
70+
- name: Install Nerdbank.GitVersioning (macOS only)
71+
if: ${{ inputs.OS == 'macos' }}
72+
run: dotnet tool install --global nbgv
73+
74+
- name: Set package version
75+
run: nbgv cloud
76+
77+
- name: Restore dependencies
78+
run: dotnet restore ${{ env.SolutionFile }} --verbosity minimal
79+
80+
- name: Build solution
81+
run: dotnet build ${{ env.SolutionFile }} --no-restore --configuration Release --verbosity minimal
82+
83+
- name: Test (net8.0)
84+
run: dotnet test ${{ env.SolutionFile }} --framework net8.0 ${{ env.SkipFilterWithoutMemoryDumps }} ${{ env.CommonTestArgs }}
85+
86+
- name: Test (net8.0) (memory dumps)
87+
if: ${{ inputs.component == 'Management' }}
88+
run: dotnet test ${{ env.SolutionFile }} --framework net8.0 ${{ env.SkipFilterWithMemoryDumps }} ${{ env.CommonTestArgs }}
89+
90+
- name: Test (net9.0)
91+
run: dotnet test ${{ env.SolutionFile }} --framework net9.0 ${{ env.SkipFilterWithoutMemoryDumps }} ${{ env.CommonTestArgs }}
92+
93+
- name: dotnet test net9.0 (memory dumps)
94+
if: ${{ inputs.component == 'Management' }}
95+
run: dotnet test ${{ env.SolutionFile }} --framework net9.0 ${{ env.SkipFilterWithMemoryDumps }} ${{ env.CommonTestArgs }}
96+
97+
- name: Upload hang dumps (on failure)
98+
if: failure()
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: FailedTestOutput-${{ inputs.OS }}
102+
path: '**/*.dmp'
103+
if-no-files-found: ignore
104+
105+
- name: Report test results
106+
if: always()
107+
uses: dorny/test-reporter@v2
108+
with:
109+
name: ${{ inputs.OS }} test results
110+
reporter: dotnet-trx
111+
path: '**/*.trx'
112+
fail-on-empty: 'true'
113+
fail-on-error: 'false'

0 commit comments

Comments
 (0)