-
Notifications
You must be signed in to change notification settings - Fork 52
85 lines (73 loc) · 2.56 KB
/
tests.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
name: Run tests
on:
pull_request:
branches:
- master
push:
branches:
- master
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Start RabbitMQ services
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: pwsh
run: |
docker-compose up -d
$val = 0
while(1 -eq 1) {
$status_ssl_plain = docker inspect --format "{{json .State.Health.Status }}" serilog.sinks.rabbitmq.ssl-plain
$status_ssl_cert = docker inspect --format "{{json .State.Health.Status }}" serilog.sinks.rabbitmq.ssl-cert
if ($status_ssl_plain -eq "healthy" -and $status_ssl_cert -eq "healthy") {
Write-Host "RabbitMQ services started"
break;
}
$val++
if ($val -ge 20)
{
Write-Host "RabbitMQ services not started after 20 attempts"
break;
}
Write-Host "RabbitMQ services status: ssl-plain: $($status_ssl_plain) - ssl-cert: $($status_ssl_cert). Attempt $val. Retry in 1 second."
Start-Sleep -s 1
}
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.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-build -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:CoverletOutput=out/.coverage/
- name: Test solution [Debug/Windows]
if: ${{ startsWith(matrix.os, 'windows') }}
run: dotnet test --no-build --filter FullyQualifiedName\!~Serilog.Sinks.RabbitMQ.Tests.Integration
- name: Upload coverage reports to Codecov
if: ${{ startsWith(matrix.os, 'ubuntu') }}
uses: codecov/codecov-action@v4
with:
files: out/.coverage/*.opencover.xml
token: ${{ secrets.CODECOV_TOKEN }} # required