-
Notifications
You must be signed in to change notification settings - Fork 24
57 lines (44 loc) · 1.33 KB
/
build-and-test.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
name: Build and test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --no-restore --configuration Release --logger "junit;LogFilePath=test-result.xml"
- name: Publish
run: dotnet publish src/WebApi/WebApi.csproj --no-build --no-restore --configuration Release --output ./publish
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: published-files
path: ./publish
- name: Test Report
uses: test-summary/action@v2
if: success() || failure()
with:
paths: ./**/test-result.xml
output: test-summary.md
- name: Output job summary
if: success() || failure()
run: |
cat test-summary.md >> $GITHUB_STEP_SUMMARY