-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (86 loc) · 2.91 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
91
92
93
94
95
96
97
98
99
100
101
102
name: Build and Test
on:
workflow_dispatch:
pull_request:
branches: [ main, develop ]
push:
branches: [ main, develop ]
paths-ignore:
- '**.md'
- '.gitignore'
- 'docs/**'
env:
SOLUTION: Place.sln
API_PROJECT: src/Place.API/Place.API.csproj
APP_NAME: Place.API
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
cache: false # Désactivé car pas de packages.lock.json
- name: Cache .NET tools
uses: actions/cache@v4
with:
path: ~/.dotnet/tools
key: ${{ runner.os }}-dotnet-tools-${{ hashFiles('.config/dotnet-tools.json') }}
- name: Install and run linting
run: |
make restore
dotnet tool restore
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'
cache: false # Désactivé car pas de packages.lock.json
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: make restore SOLUTION=${{ env.SOLUTION }}
- name: Build
run: make build SOLUTION=${{ env.SOLUTION }}
- name: Run unit tests
run: make test-unit SOLUTION=${{ env.SOLUTION }}
- name: Run integration tests
run: make test-integration SOLUTION=${{ env.SOLUTION }}
- 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: ${{ env.APP_NAME }}-build
path: |
**/bin/Release/**/*.dll
**/bin/Release/**/*.exe
**/bin/Release/**/*.pdb
!**/bin/**/ref/**
compression-level: 9
- name: Cleanup
if: always()
run: make clean SOLUTION=${{ env.SOLUTION }}