-
Notifications
You must be signed in to change notification settings - Fork 29
96 lines (86 loc) · 2.73 KB
/
dotnet.yml
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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
env:
DOTNET_CONFIGURATION: Release
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: actions/setup-java@v4
name: Set up Java
with:
distribution: "microsoft"
java-version: "21"
- uses: actions/setup-node@v4
name: Set up Node.js
with:
node-version: "latest"
- uses: actions/cache@v4
name: Cache NuGet packages
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- uses: actions/cache@v4
name: Cache Java Docker images
with:
path: /var/lib/docker/image
key: ${{ runner.os }}-docker-${{ hashFiles('examples/java/CommunityToolkit.Aspire.Java.Spring.Maven/Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-
- name: Install Aspire workload
run: dotnet workload install aspire
- name: Setup .NET dev certs
run: |
dotnet tool update -g linux-dev-certs
dotnet linux-dev-certs install
- name: Setup Node projects
run: |
npm install -g @azure/static-web-apps-cli
cd examples/swa/CommunityToolkit.Aspire.StaticWebApps.WebApp
npm ci
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration ${{ env.DOTNET_CONFIGURATION }}
- name: Test
run: dotnet test --no-build --configuration ${{ env.DOTNET_CONFIGURATION }} --collect "XPlat Code Coverage" --results-directory test-results --logger trx -parallel none
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
${{ github.workspace }}/test-results/**
test-reporting:
permissions:
contents: read
actions: read
checks: write
runs-on: ubuntu-latest
needs: build
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: ".NET Tests"
path: "*.trx"
reporter: dotnet-trx