-
Notifications
You must be signed in to change notification settings - Fork 8
187 lines (152 loc) · 6.29 KB
/
pr-validation.yml
File metadata and controls
187 lines (152 loc) · 6.29 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: PR Validation
on:
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pr-validation-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
APP_TEST_PROJECT: tests/PrompterOne.Web.Tests/PrompterOne.Web.Tests.csproj
CORE_TEST_PROJECT: tests/PrompterOne.Core.Tests/PrompterOne.Core.Tests.csproj
PLAYWRIGHT_CLI: tests/PrompterOne.Web.UITests/bin/Debug/net10.0/.playwright/package/cli.js
SOLUTION_FILE: PrompterOne.slnx
jobs:
build_supporting_suites:
name: Build Supporting Tests
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Restore solution
run: dotnet restore "$SOLUTION_FILE"
- name: Restore WebAssembly workload
run: dotnet workload restore
- name: Build solution
run: dotnet build "$SOLUTION_FILE" -warnaserror
test_supporting_suites:
name: Supporting Tests
needs: build_supporting_suites
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Expose GitHub Actions Runtime
uses: actions/github-script@v8
with:
script: |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']);
core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL']);
- name: Test supporting suites
run: |
dotnet test @./tests/dotnet-test-progress.rsp --project "$CORE_TEST_PROJECT" --coverage --coverage-output-format cobertura
dotnet test @./tests/dotnet-test-progress.rsp --project "$APP_TEST_PROJECT" --coverage --coverage-output-format cobertura
- name: Upload supporting suite test results
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: test-results-pr-validation-supporting
path: |
tests/PrompterOne.Core.Tests/bin/**/TestResults/**
tests/PrompterOne.Web.Tests/bin/**/TestResults/**
if-no-files-found: ignore
- name: Publish supporting suite coverage report
if: always() && hashFiles('tests/PrompterOne.Core.Tests/bin/**/TestResults/*.cobertura.xml', 'tests/PrompterOne.Web.Tests/bin/**/TestResults/*.cobertura.xml') != ''
uses: ./.github/actions/publish-coverage-report
with:
artifact-name: coverage-report-pr-validation-supporting
reports: tests/PrompterOne.Core.Tests/bin/**/TestResults/*.cobertura.xml;tests/PrompterOne.Web.Tests/bin/**/TestResults/*.cobertura.xml
targetdir: coverage-report/supporting
title: PR Validation Supporting Coverage
build_browser_suites:
name: Build Browser Tests
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Restore solution
run: dotnet restore "$SOLUTION_FILE"
- name: Restore WebAssembly workload
run: dotnet workload restore
- name: Build solution
run: dotnet build "$SOLUTION_FILE" -warnaserror
browser_tests:
name: ${{ matrix.suite.name }}
needs: build_browser_suites
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
suite:
- name: Shell
artifact: shell
project: tests/PrompterOne.Web.UITests.Shell/PrompterOne.Web.UITests.Shell.csproj
- name: Studio
artifact: studio
project: tests/PrompterOne.Web.UITests.Studio/PrompterOne.Web.UITests.Studio.csproj
- name: Editor
artifact: editor
project: tests/PrompterOne.Web.UITests.Editor/PrompterOne.Web.UITests.Editor.csproj
- name: Reader
artifact: reader
project: tests/PrompterOne.Web.UITests.Reader/PrompterOne.Web.UITests.Reader.csproj
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Expose GitHub Actions Runtime
uses: actions/github-script@v8
with:
script: |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']);
core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL']);
- name: Restore solution
run: dotnet restore "$SOLUTION_FILE"
- name: Restore WebAssembly workload
run: dotnet workload restore
- name: Build solution
run: dotnet build "$SOLUTION_FILE" -warnaserror
- name: Install Playwright browser
run: node "$PLAYWRIGHT_CLI" install chromium
- name: Test browser suite
run: dotnet test @./tests/dotnet-test-progress.rsp --project "${{ matrix.suite.project }}" --coverage --coverage-output-format cobertura
- name: Upload browser suite test results
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: test-results-pr-validation-${{ matrix.suite.artifact }}
path: tests/PrompterOne.Web.UITests.${{ matrix.suite.name }}/bin/**/TestResults/**
if-no-files-found: ignore
- name: Publish browser suite coverage report
if: always() && hashFiles(format('tests/PrompterOne.Web.UITests.{0}/bin/**/TestResults/*.cobertura.xml', matrix.suite.name)) != ''
uses: ./.github/actions/publish-coverage-report
with:
artifact-name: coverage-report-pr-validation-${{ matrix.suite.artifact }}
reports: tests/PrompterOne.Web.UITests.${{ matrix.suite.name }}/bin/**/TestResults/*.cobertura.xml
targetdir: coverage-report/${{ matrix.suite.artifact }}
title: PR Validation ${{ matrix.suite.name }} Coverage
- name: Upload Playwright artifacts
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: playwright-artifacts-pr-validation-${{ matrix.suite.artifact }}
path: output/playwright/
if-no-files-found: ignore