-
Notifications
You must be signed in to change notification settings - Fork 51
89 lines (76 loc) · 2.57 KB
/
tests.yml
File metadata and controls
89 lines (76 loc) · 2.57 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
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
name: Run tests
on:
pull_request:
branches:
- master
# Upload code coverage results when PRs are merged
push:
branches:
- master
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
test:
strategy:
matrix:
os: [ubuntu-22.04, windows-latest]
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Start RabbitMQ services
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: pwsh
run: |
docker compose up --quiet-pull --wait --wait-timeout 30
if ($LASTEXITCODE -eq 0) {
Write-Host "RabbitMQ services successfully started"
}
else {
Write-Host "docker compose up failed with exit code $LASTEXITCODE."
Write-Host "$(docker compose logs)"
exit $LASTEXITCODE
}
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Check formatting
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: dotnet format --no-restore --verify-no-changes --severity warn || (echo "Run 'dotnet format' to fix issues" && exit 1)
- name: Build solution [Release]
run: dotnet build --no-restore -c Release
- name: Build solution [Debug]
run: dotnet build --no-restore -c Debug
- name: Test solution [Debug]
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: dotnet test --no-restore --no-build -p:TestTfmsInParallel=false -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:CoverletOutput=out/.coverage/
- name: Test solution [Debug/Windows]
if: ${{ startsWith(matrix.os, 'windows') }}
run: dotnet test --no-restore --no-build -p:TestTfmsInParallel=false --filter FullyQualifiedName\!~Serilog.Sinks.RabbitMQ.Tests.Integration
- name: Upload coverage reports to Codecov
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: codecov/codecov-action@v5
with:
files: out/.coverage/*.opencover.xml
token: ${{ secrets.CODECOV_TOKEN }} # required
buildcheck:
needs:
- test
runs-on: ubuntu-22.04
if: always()
steps:
- name: Pass build check
if: ${{ needs.test.result == 'success' }}
run: exit 0
- name: Fail build check
if: ${{ needs.test.result != 'success' }}
run: exit 1