-
Notifications
You must be signed in to change notification settings - Fork 172
110 lines (96 loc) · 4.13 KB
/
component-shared-workflow.yml
File metadata and controls
110 lines (96 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Component Build
on:
workflow_call:
inputs:
component:
required: true
type: string
OS:
required: true
type: string
runDockerContainers:
required: false
type: boolean
default: false
permissions:
contents: read
pull-requests: write
env:
STEELTOE_MACOS_DIAGNOSE_HOSTNAME_LOOKUP: true
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: true
SOLUTION_FILE: 'src/Steeltoe.${{ inputs.component }}.slnf'
COMMON_TEST_ARGS: >-
--no-build --configuration Release --collect "XPlat Code Coverage" --logger trx --results-directory ${{ github.workspace }}/TestOutput
--settings coverlet.runsettings --blame-crash --blame-hang-timeout 1m
jobs:
build:
name: Build and Test
timeout-minutes: 15
runs-on: ${{ inputs.OS }}-latest
services:
eurekaServer:
image: ${{ inputs.runDockerContainers && 'steeltoe.azurecr.io/eureka-server' || null }}
ports:
- 8761:8761
configServer:
image: ${{ inputs.runDockerContainers && 'steeltoe.azurecr.io/config-server' || null }}
env:
eureka.client.enabled: true
eureka.client.serviceUrl.defaultZone: http://eurekaServer:8761/eureka
eureka.instance.hostname: localhost
eureka.instance.instanceId: localhost:configServer:8888
ports:
- 8888:8888
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.*
9.0.*
10.0.*
- name: Turn off dev certificate (macOS only)
if: ${{ inputs.OS == 'macos' }}
# Setting DOTNET_GENERATE_ASPNET_CERTIFICATE to "false" makes it easier to determine which test failed on macOS when it tried to start a web server with https enabled.
# Without setting this, the following message appears in the logs:
# The application is trying to access the ASP.NET Core developer certificate key. A prompt might appear to ask for permission to access the key.
# When that happens, select 'Always Allow' to grant 'dotnet' access to the certificate key in the future.
# and the test run fails, but without indicating which test caused it. By setting this, the causing test fails with the next message:
# Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
# To prevent the causing test from failing the test run, disable it on macOS using FactSkippedOnPlatform/TheorySkippedOnPlatform.
shell: bash
run: echo "DOTNET_GENERATE_ASPNET_CERTIFICATE=false" >> $GITHUB_ENV
- name: Git checkout
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Restore packages
run: dotnet restore ${{ env.SOLUTION_FILE }} /p:Configuration=Release /p:NuGetAudit=false --verbosity minimal
- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal
- name: Test
id: test
run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category!=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
- name: Test (memory dumps)
id: test-memory-dumps
if: ${{ inputs.component == 'Management' }}
run: dotnet test src/Management/test/Endpoint.Test --filter "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
- name: Upload crash/hang dumps (on failure)
if: ${{ !cancelled() && (steps.test.outcome == 'failure' || steps.test-memory-dumps.outcome == 'failure') }}
uses: actions/upload-artifact@v7
with:
name: FailedTestOutput-${{ inputs.OS }}-latest
path: |
${{ github.workspace }}/TestOutput/**/*.dmp
${{ github.workspace }}/TestOutput/**/Sequence_*.xml
if-no-files-found: ignore
- name: Report test results
if: ${{ !cancelled() && (steps.test.outcome != 'skipped' || steps.test-memory-dumps.outcome != 'skipped') }}
uses: dorny/test-reporter@v3
with:
name: ${{ inputs.OS }}-latest test results
reporter: dotnet-trx
path: '**/*.trx'
fail-on-empty: 'true'
fail-on-error: 'false'