-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (51 loc) · 2.09 KB
/
Copy pathtest.yml
File metadata and controls
58 lines (51 loc) · 2.09 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
name: Test
on:
workflow_call:
inputs:
paths:
description: "Array of paths to .sln or .csproj files"
required: true
type: string
jobs:
test:
runs-on: [self-hosted, Windows]
env:
DOTNET_VERSION: "9.0.x"
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
allow-unsafe-pr-checkout: ${{ github.event_name != 'pull_request_target' || contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }}
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || github.event.pull_request.head.sha }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Create .NET global.json
run: |
dotnet new globaljson --sdk-version $env:DOTNET_VERSION
- name: Run tests for each path
shell: pwsh
run: |
# Parse the input string to a JSON array
$paths = ConvertFrom-Json -InputObject '${{ inputs.paths }}'
foreach ($path in $paths) {
dotnet test $path -c Release --verbosity=minimal --results-directory TestResults -- --report-trx --report-trx-filename AllTests.trx
}
- name: Publish test results
uses: Eternet/publish-unit-test-result-action/windows@v2
if: always()
with:
files: "**/TestResults/**/*.trx"
check_name: Tests
job_summary: true
- name: Debug TestResults
if: always()
run: dir **\TestResults\*
- name: Upload TestResults artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: TestResults
path: "**/TestResults/**/*.trx"
retention-days: 7