Skip to content

Commit ee9012b

Browse files
authored
Merge pull request #1344 from rabbitmq/lukebakken/update-build
Build using traversal project
2 parents 5b64ca9 + b6af935 commit ee9012b

File tree

13 files changed

+96
-83
lines changed

13 files changed

+96
-83
lines changed

.ci/gha-run-tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ Write-Host "[INFO] Setting RABBITMQ_RABBITMQCTL_PATH to '$rabbitmqctl_path'..."
2828
$env:RABBITMQ_RABBITMQCTL_PATH = $rabbitmqctl_path
2929
[Environment]::SetEnvironmentVariable('RABBITMQ_RABBITMQCTL_PATH', $rabbitmqctl_path, 'Machine')
3030

31-
$solution_file = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'RabbitMQDotNetClient.sln'
32-
dotnet test --no-restore --no-build --logger "console;verbosity=detailed" $solution_file
31+
$build_csproj_file = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'Build.csproj'
32+
dotnet test $build_csproj_file --no-restore --no-build --logger "console;verbosity=detailed"

.ci/versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"erlang": "25.3",
3-
"rabbitmq": "3.11.11"
2+
"erlang": "25.3.1",
3+
"rabbitmq": "3.11.15"
44
}

.github/workflows/main.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ jobs:
4242
- name: List NuGet sources
4343
run: dotnet nuget locals all --list
4444
- name: Restore
45-
run: dotnet restore --verbosity=normal
45+
run: dotnet restore ./Build.csproj --verbosity=normal
4646
- name: Build
47-
run: dotnet build --no-restore --verbosity=normal
47+
run: dotnet build ./Build.csproj --no-restore --verbosity=normal
48+
- name: Verify
49+
run: dotnet format ./RabbitMQDotNetClient.sln --no-restore --verbosity=diagnostic --verify-no-changes
4850
- name: Test
4951
run: ./.ci/gha-run-tests.ps1
5052

@@ -79,12 +81,12 @@ jobs:
7981
restore-keys: |
8082
${{ runner.os }}-v0-nuget-
8183
- name: Restore
82-
run: dotnet restore --verbosity=normal
84+
run: dotnet restore ./Build.csproj --verbosity=normal
8385
- name: Build
84-
run: dotnet build --no-restore --verbosity=normal
86+
run: dotnet build ./Build.csproj --no-restore --verbosity=normal
87+
- name: Verify
88+
run: dotnet format ./RabbitMQDotNetClient.sln --no-restore --verbosity=diagnostic --verify-no-changes
8589
- name: Test
86-
run: dotnet test --no-restore --no-build --logger "console;verbosity=detailed" --framework "net6.0"
90+
run: dotnet test ./Build.csproj --no-restore --no-build --logger "console;verbosity=detailed" --framework "net6.0"
8791
env:
8892
RABBITMQ_RABBITMQCTL_PATH: DOCKER:${{job.services.rabbitmq.id}}
89-
- name: Verify Formatting
90-
run: dotnet format --verbosity normal --no-restore --verify-no-changes

APIDOCS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pushd _site
99
git remote add origin-ssh [email protected]:rabbitmq/rabbitmq-dotnet-client.git
1010
git checkout --track origin-ssh/gh-pages
1111
popd
12-
.\build.bat
12+
.\build.ps1 -RunTests:$false
1313
docfx.exe
1414
pushd _site
1515
git commit -a -m 'rabbitmq-dotnet-client docs vX.Y.Z'

Build.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.Build.Traversal/3.2.0">
2+
3+
<PropertyGroup>
4+
<IsPackable>false</IsPackable>
5+
<MinVerSkip>true</MinVerSkip>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="projects/Benchmarks/Benchmarks.csproj" />
10+
<ProjectReference Include="projects/RabbitMQ.Client/RabbitMQ.Client.csproj" />
11+
<ProjectReference Include="projects/TestApplications/CreateChannel/CreateChannel.csproj" />
12+
<ProjectReference Include="projects/TestApplications/MassPublish/MassPublish.csproj" />
13+
<ProjectReference Include="projects/Unit/Unit.csproj" />
14+
</ItemGroup>
15+
16+
</Project>

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Benchmarks can be found under `./projects/Benchmarks`. On the command line, run
8686
like so:
8787

8888
```
89-
dotnet run -c Release -f netcoreapp5.0 --project ./projects/Benchmarks/ --filter Networking_BasicDeliver_LongLivedConnection
89+
dotnet run -c Release -f net6.0 --project ./projects/Benchmarks/ --filter Networking_BasicDeliver_LongLivedConnection
9090
```
9191

9292
## Code of Conduct

RUNNING_TESTS.md

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
1-
## Overview
1+
# Overview
22

3-
.NET client's test suite assumes there's a RabbitMQ node listening on `localhost:5672`
4-
(the default settings). TLS tests require a node listening on the default
5-
[TLS port](https://rabbitmq.com/ssl.html).
3+
The RabbitMQ .NET client's test suite assumes there's a RabbitMQ node listening
4+
on `localhost:5672` (the default settings). TLS tests require a node listening
5+
on the default [TLS port](https://rabbitmq.com/ssl.html).
66

7-
It is possible to use Visual Studio Community Edition .NET Core, and
8-
`dotnet.exe` in `PATH`, to build the client and run the test suite.
7+
It is possible to use Visual Studio Community Edition and `dotnet.exe` in
8+
`PATH`, to build the client and run the test suite.
99

1010

1111
## Building
1212

13-
Before this project can be opened in Visual Studio, it's necessary to pull down dependencies
14-
and perform protocol encoder/decoder code generation.
1513

16-
On Windows run:
14+
### Windows
1715

18-
``` powershell
19-
build.bat
16+
```powershell
17+
build.ps1
2018
```
2119

22-
On MacOS and linux run:
20+
### MacOS and Linux
2321

24-
``` shell
25-
./build.sh
22+
```shell
23+
dotnet build ./Build.csproj
2624
```
2725

28-
This will complete the code AMQP 0-9-1 protocol code generation and build all projects. After this open the solution in Visual Studio.
26+
This will build all projects. After this open the solution in Visual Studio.
2927

3028

3129
## Test Environment Requirements
3230

33-
Tests can be run from Visual Studio using the NUnit Test Adapter. Note that it
31+
Tests can be run from Visual Studio using the XUnit Test Adapter. Note that it
3432
may take some time for the adapter to discover tests in the assemblies.
3533

3634
The test suite assumes there's a RabbitMQ node running locally with all
3735
defaults, and the tests will need to be able to run commands against the
3836
[`rabbitmqctl`](https://www.rabbitmq.com/rabbitmqctl.8.html) tool for that node.
3937
Two options to accomplish this are covered below.
4038

39+
4140
### Option One: Using a RabbitMQ Release
4241

4342
It is possible to install and run a node using any [binary build](https://www.rabbitmq.com/download.html)
@@ -46,16 +45,16 @@ invoked directly without using an absolute file path. Note that this method does
4645

4746
On Windows, you must run unit tests as follows (replace `X.Y.Z` with your RabbitMQ version):
4847

49-
```
50-
set "RABBITMQ_RABBITMQCTL_PATH=C:\Program Files\RabbitMQ Server\rabbitmq_server-X.Y.Z\sbin\rabbitmqctl.bat"
51-
.\run-test.bat
48+
```powershell
49+
$env:RABBITMQ_RABBITMQCTL_PATH='C:\Program Files\RabbitMQ Server\rabbitmq_server-X.Y.Z\sbin\rabbitmqctl.bat'
50+
.\build.ps1 -RunTests
5251
```
5352

5453
### Option Two: Building a RabbitMQ Node from Source
5554

5655
T run a RabbitMQ node [built from source](https://www.rabbitmq.com/build-server.html):
5756

58-
```
57+
```shell
5958
git clone https://github.com/rabbitmq/rabbitmq-server.git rabbitmq-server
6059
cd rabbitmq-server
6160

@@ -77,26 +76,32 @@ RABBITMQ_RABBITMQCTL_PATH=/path/to/rabbitmqctl dotnet test projects/Unit
7776

7877
### Option Three: Using a Docker Container
7978

80-
It is also possible to run a RabbitMQ node in a [Docker](https://www.docker.com/) container. Set the environment variable `RABBITMQ_RABBITMQCTL_PATH` to `DOCKER:<container_name>` (for example `DOCKER:rabbitmq01`). This tells the unit tests to run the `rabbitmqctl` commands through Docker, in the format `docker exec rabbitmq01 rabbitmqctl <args>`:
79+
It is also possible to run a RabbitMQ node in a
80+
[Docker](https://www.docker.com/) container. Set the environment variable
81+
`RABBITMQ_RABBITMQCTL_PATH` to `DOCKER:<container_name>` (for example
82+
`DOCKER:rabbitmq01`). This tells the unit tests to run the `rabbitmqctl`
83+
commands through Docker, in the format `docker exec rabbitmq01 rabbitmqctl
84+
<args>`:
8185

82-
``` shell
86+
```shell
8387
docker run -d --hostname rabbitmq01 --name rabbitmq01 -p 15672:15672 -p 5672:5672 rabbitmq:3-management
8488
```
8589

8690
## Running All Tests
8791

8892
Then, to run the tests use:
8993

90-
``` powershell
91-
# will run tests on .NET Core and .NET Framework
92-
run-test.bat
94+
95+
### Windows
96+
97+
```powershell
98+
build.ps1 -RunTests
9399
```
94100

95-
On MacOS, Linux, BSD use:
101+
### MacOS, Linux, BSD:
96102

97-
``` shell
98-
# will only run tests on .NET Core
99-
run-test.sh
103+
```shell
104+
dotnet test ./Build.csproj
100105
```
101106

102107
## Running Individual Suites or Test Cases
@@ -115,5 +120,5 @@ dotnet test projects/Unit --filter "FullyQualifiedName~RabbitMQ.Client.Unit.Test
115120
To run tests targeting .NET 6.0:
116121

117122
``` shell
118-
dotnet test -f ".net6.0" projects/Unit
123+
dotnet test --framework net6.0 projects/Unit
119124
```

build.bat

Lines changed: 0 additions & 4 deletions
This file was deleted.

build.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[CmdletBinding(PositionalBinding=$false)]
2+
param(
3+
[switch]$RunTests
4+
)
5+
6+
Write-Host "Run Parameters:" -ForegroundColor Cyan
7+
Write-Host "`tPSScriptRoot: $PSScriptRoot"
8+
Write-Host "`tRunTests: $RunTests"
9+
Write-Host "`tdotnet --version: $(dotnet --version)"
10+
11+
Write-Host "Building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
12+
dotnet build "$PSScriptRoot\Build.csproj"
13+
Write-Host "Done building." -ForegroundColor "Green"
14+
15+
if ($RunTests) {
16+
Write-Host "Running tests: Build.csproj traversal (all frameworks)" -ForegroundColor "Magenta"
17+
dotnet test "$PSScriptRoot\Build.csproj" --no-restore --no-build --logger "console;verbosity=detailed"
18+
if ($LastExitCode -ne 0) {
19+
Write-Host "Error with tests, aborting build." -Foreground "Red"
20+
Exit 1
21+
}
22+
Write-Host "Tests passed!" -ForegroundColor "Green"
23+
}
24+
25+
Write-Host "Done."

build.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"allowPrerelease": false
4+
}
5+
}

run-test.bat

Lines changed: 0 additions & 3 deletions
This file was deleted.

run-test.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)