Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/main' into asyncapi#196-…
Browse files Browse the repository at this point in the history
…Publish-a-global-dotnet-tool

# Conflicts:
#	.github/workflows/ci.yaml
#	Saunter.sln
  • Loading branch information
Senn Geerts authored and Senn Geerts committed Jul 8, 2024
2 parents ba1e856 + 6a3441d commit 90dcff1
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 79 deletions.
12 changes: 12 additions & 0 deletions .github/dotnet/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: dotnet setup
description: "base dotnet setup for project"
runs:
using: composite
steps:
- name: setup
id: setup-dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
8.0.x
14 changes: 14 additions & 0 deletions .github/npm/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: npm setup
description: "base npm setup for project"
runs:
using: composite
steps:
- name: setup dotnet
uses: ./.github/dotnet
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Run NPM install
shell: sh
run: npm ci
working-directory: ./src/Saunter.UI
56 changes: 28 additions & 28 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Note: ci.yaml and release.yaml have some similar steps
# If updating dotnet-version, set in both.

name: CI
name: ci

on:
push:
Expand All @@ -10,32 +7,35 @@ on:
pull_request:

jobs:
build:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 'lts/*' # latest LTS version
- uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.x
8.0.x
- uses: actions/checkout@v2
- name: setup build
uses: ./.github/npm
- name: Run dotnet build
run: dotnet build --configuration Debug

- name: Run NPM install
run: npm ci
working-directory: ./src/Saunter.UI
- name: Run dotnet build
run: dotnet build --configuration Debug
- name: Run dotnet test
run: dotnet test --no-build
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup dotnet
uses: ./.github/dotnet
- name: dotnet format check
run: dotnet format --verify-no-changes *.sln
env:
PATH: ${{ github.env.PATH }}:/home/runner/.dotnet/tools

# Below steps run only on CI, not release
- uses: actions/upload-artifact@v2
with:
name: saunter-bin
path: ./src/Saunter/bin
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup build
uses: ./.github/npm
- name: unit test
run: dotnet test ./test/Saunter.Tests/Saunter.Tests.csproj
# TODO: why there are 2 of them....
- name: unit mark test
run: dotnet test ./test/Saunter.Tests.MarkerTypeTests/Saunter.Tests.MarkerTypeTests.csproj
48 changes: 13 additions & 35 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,23 @@
# Note: ci.yaml and release.yaml have some similar steps
# If updating dotnet-version, set in both.

name: Release

on:
push:
tags:
- 'v*.*.*' # e.g. v0.1.0
- "v*.*.*" # e.g. v0.1.0

jobs:
release:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 'lts/*' # latest LTS version
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x' # SDK Version to use; x will use the latest version of the channel

- name: Run NPM install
run: npm ci
working-directory: ./src/Saunter.UI
- name: Run dotnet build
run: dotnet build --configuration Debug
- name: Run dotnet test
run: dotnet test --no-build

# Below steps are only on release, not CI.
- name: Set version
# Gets the numeric version from a tag (e.g. v1.2.3 -> 1.2.3)
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Create Nuget package
run: dotnet pack ./src/Saunter/Saunter.csproj --configuration Release -p:Version="$RELEASE_VERSION" --output ./build
- name: Push Nuget package to Nuget.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push ./build/*.nupkg --api-key $NUGET_API_KEY --source "https://api.nuget.org/v3/index.json"


- uses: actions/checkout@v2
- name: setup build
uses: ./.github/npm
- name: Set version
# Gets the numeric version from a tag (e.g. v1.2.3 -> 1.2.3)
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Create Nuget package
run: dotnet pack ./src/Saunter/Saunter.csproj --configuration Release -p:Version="$RELEASE_VERSION" --output ./build
- name: Push Nuget package to Nuget.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push ./build/*.nupkg --api-key $NUGET_API_KEY --source "https://api.nuget.org/v3/index.json"
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ Builds and releases managed with github actions.
### Build

* Local builds are as simple as `dotnet build && dotnet test`
* CI builds on every push
* CI builds,fmt,unit on every push
* [.github/workflows/ci.yaml](./.github/workflows/ci.yaml)
* Build and tests MUST pass before merging to master


### Release

* Locally, packages can be created using `dotnet pack ./src/Saunter/Saunter.csproj`
Expand Down
22 changes: 19 additions & 3 deletions Saunter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,34 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{6A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StreetlightsAPI", "examples\StreetlightsAPI\StreetlightsAPI.csproj", "{F188D4A7-BBCB-464F-A370-2BD84D18EA79}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E0D34C77-924E-4F6B-9289-5A2F07D125A8}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{E0D34C77-924E-4F6B-9289-5A2F07D125A8}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
CHANGELOG.md = CHANGELOG.md
.github\workflows\ci.yaml = .github\workflows\ci.yaml
README.md = README.md
.github\workflows\release.yaml = .github\workflows\release.yaml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Saunter.IntegrationTests.ReverseProxy", "test\Saunter.IntegrationTests.ReverseProxy\Saunter.IntegrationTests.ReverseProxy.csproj", "{7CD09B89-130A-41AF-ADAE-2166C4ED695B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Saunter.Tests.MarkerTypeTests", "test\Saunter.Tests.MarkerTypeTests\Saunter.Tests.MarkerTypeTests.csproj", "{02284473-6DE7-4EE0-8433-2AC295045549}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "actions", "actions", "{D8CB9C0D-9605-457B-979F-C8994B20A926}"
ProjectSection(SolutionItems) = preProject
.github\workflows\ci.yaml = .github\workflows\ci.yaml
.github\workflows\release.yaml = .github\workflows\release.yaml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{69459F9D-DA73-4E84-8BA7-4CE03E2B7664}"
ProjectSection(SolutionItems) = preProject
.github\dotnet\action.yaml = .github\dotnet\action.yaml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "npm", "npm", "{E8FACA22-CFED-4710-89E4-D55F31BF96B3}"
ProjectSection(SolutionItems) = preProject
.github\npm\action.yaml = .github\npm\action.yaml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsyncAPI.Saunter.Generator.Cli", "src\AsyncAPI.Saunter.Generator.Cli\AsyncAPI.Saunter.Generator.Cli.csproj", "{6C102D4D-3DA4-4763-B75E-C15E33E7E94A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncAPI.Saunter.Generator.Cli.Tests", "test\AsyncAPI.Saunter.Generator.Cli.Tests\AsyncAPI.Saunter.Generator.Cli.Tests.csproj", "{18AD0249-0436-4A26-9972-B97BA6905A54}"
Expand Down Expand Up @@ -137,6 +151,8 @@ Global
{F188D4A7-BBCB-464F-A370-2BD84D18EA79} = {6ABD4842-47AF-49A5-B057-0EBA64416789}
{7CD09B89-130A-41AF-ADAE-2166C4ED695B} = {6491E321-2D02-44AB-9116-D722FE169595}
{02284473-6DE7-4EE0-8433-2AC295045549} = {6491E321-2D02-44AB-9116-D722FE169595}
{69459F9D-DA73-4E84-8BA7-4CE03E2B7664} = {D8CB9C0D-9605-457B-979F-C8994B20A926}
{E8FACA22-CFED-4710-89E4-D55F31BF96B3} = {D8CB9C0D-9605-457B-979F-C8994B20A926}
{6C102D4D-3DA4-4763-B75E-C15E33E7E94A} = {28D4C365-FDED-49AE-A97D-36202E24A55A}
{18AD0249-0436-4A26-9972-B97BA6905A54} = {6491E321-2D02-44AB-9116-D722FE169595}
EndGlobalSection
Expand Down
7 changes: 7 additions & 0 deletions test/Saunter.Tests.MarkerTypeTests/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# EditorConfig is awesome: https://EditorConfig.org

root=false

[*.{cs,vb}]

dotnet_code_quality_unused_parameters = non_public
7 changes: 7 additions & 0 deletions test/Saunter.Tests/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# EditorConfig is awesome: https://EditorConfig.org

root=false

[*.{cs,vb}]

dotnet_code_quality_unused_parameters = non_public
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ public interface IMyMessagePublisher
public class TenantMessageConsumer
{
[Message(typeof(TenantCreated))]
public void SubscribeTenantCreatedEvent(Guid _, TenantCreated __) { }
public void SubscribeTenantCreatedEvent(Guid id, TenantCreated created) { }

[Message(typeof(TenantUpdated))]
public void SubscribeTenantUpdatedEvent(Guid _, TenantUpdated __) { }
public void SubscribeTenantUpdatedEvent(Guid id, TenantUpdated updated) { }

[Message(typeof(TenantRemoved))]
public void SubscribeTenantRemovedEvent(Guid _, TenantRemoved __) { }
public void SubscribeTenantRemovedEvent(Guid id, TenantRemoved removed) { }
}

[AsyncApi]
Expand All @@ -273,13 +273,13 @@ public interface ITenantMessageConsumer
public class TenantMessagePublisher
{
[Message(typeof(TenantCreated))]
public void PublishTenantCreatedEvent(Guid _, TenantCreated __) { }
public void PublishTenantCreatedEvent(Guid id, TenantCreated created) { }

[Message(typeof(TenantUpdated))]
public void PublishTenantUpdatedEvent(Guid _, TenantUpdated __) { }
public void PublishTenantUpdatedEvent(Guid id, TenantUpdated updated) { }

[Message(typeof(TenantRemoved))]
public void PublishTenantRemovedEvent(Guid _, TenantRemoved __) { }
public void PublishTenantRemovedEvent(Guid id, TenantRemoved removed) { }
}

[AsyncApi]
Expand All @@ -305,7 +305,7 @@ public class TenantGenericMessagePublisher
[Message(typeof(AnyTenantCreated))]
[Message(typeof(AnyTenantUpdated))]
[Message(typeof(AnyTenantRemoved))]
public void PublishTenantEvent<TEvent>(Guid _, TEvent __)
public void PublishTenantEvent<TEvent>(Guid id, TEvent @event)
where TEvent : IEvent
{
}
Expand All @@ -329,7 +329,7 @@ void PublishTenantEvent<TEvent>(Guid _, TEvent __)
public class TenantSingleMessagePublisher
{
[Message(typeof(AnyTenantCreated))]
public void PublishTenantCreated(Guid _, AnyTenantCreated __)
public void PublishTenantCreated(Guid id, AnyTenantCreated created)
{
}
}
Expand All @@ -351,13 +351,13 @@ public interface ITenantSingleMessagePublisher
public class OneTenantMessageConsumer
{
[Message(typeof(TenantCreated))]
public void SubscribeTenantCreatedEvent(Guid _, TenantCreated __) { }
public void SubscribeTenantCreatedEvent(Guid id, TenantCreated created) { }

[Message(typeof(TenantUpdated))]
public void SubscribeTenantUpdatedEvent(Guid _, TenantUpdated __) { }
public void SubscribeTenantUpdatedEvent(Guid id, TenantUpdated updated) { }

[Message(typeof(TenantRemoved))]
public void SubscribeTenantRemovedEvent(Guid _, TenantRemoved __) { }
public void SubscribeTenantRemovedEvent(Guid id, TenantRemoved removed) { }
}

[AsyncApi]
Expand Down

0 comments on commit 90dcff1

Please sign in to comment.