-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (75 loc) · 2.68 KB
/
continuous.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
name: Build and Test
on:
workflow_dispatch:
pull_request:
branches: [ main, develop ]
push:
branches: [ main, develop ]
paths-ignore:
- '**.md'
- '.gitignore'
- 'docs/**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Cache .NET tools
uses: actions/cache@v4
with:
path: ~/.dotnet/tools
key: ${{ runner.os }}-dotnet-tools-${{ hashFiles('.config/dotnet-tools.json') }}
- name: Install linting tools
run: dotnet tool restore
- name: Validate code linting
run: dotnet dotnet-csharpier --check .
build_and_test:
needs: lint
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet clean && dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Run unit tests
run: dotnet test --no-build --filter "Category=Unit" --configuration Release --verbosity minimal --logger "trx;LogFileName=unit_tests.trx"
- name: Run integration tests
run: dotnet test --no-build --filter "Category=Integration" --configuration Release --verbosity minimal --logger "trx;LogFileName=integration_tests.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: .NET Tests # Name of the check run which will be created
path: '**/TestResults/*.trx' # Path to test results
reporter: dotnet-trx # Format of test results
fail-on-error: true # Fail workflow if test reporter fails
list-suites: 'all' # List all test suites in report
list-tests: 'failed' # List all failed tests in report
max-annotations: 50 # Maximum number of annotations to create
- name: Upload artifacts
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: app-build
path: |
**/bin/**/*.dll
**/bin/**/*.exe
**/bin/**/*.pdb
!**/bin/**/ref/**