Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 26 additions & 59 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,83 +12,73 @@ on:
- published

env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
NUGET_API_KEY: ${{ secrets.NUGET_KEY }}
NUGET_FEED: https://api.nuget.org/v3/index.json

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
- name: Install tools
run: dotnet tool restore
- name: check format
run: dotnet csharpier check .
run: |
dotnet tool restore
./build.sh --target CheckFormat

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
- name: Install dependencies
run: dotnet restore Motor.NET.slnx
- name: Build
run: dotnet build --configuration Release --no-restore Motor.NET.slnx
- name: Pack
run: dotnet pack -v minimal -c Release --no-restore -o ./artifacts Motor.NET.slnx
- name: Publish Bridge
run: dotnet publish --framework net9.0 -v minimal -c Release --no-restore -o ./artifacts-bridge ./src/Motor.Extensions.Hosting.Bridge/Motor.Extensions.Hosting.Bridge.csproj
run: ./build.sh --target Artifacts
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: artifacts
path: |
./artifacts/*.nupkg
./artifacts/*.snupkg
- name: Upload Artifact Bridge
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: artifacts-bridge
path: ./artifacts-bridge/*

test-net8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
- name: Install dependencies
run: dotnet restore Motor.NET.slnx
9.0.x
- name: Test .NET8
run: dotnet test --no-restore Motor.NET.slnx --framework net8.0
run: ./build.sh -t Test --dotnet-versions net8.0

test-net9:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
- name: Install dependencies
run: dotnet restore Motor.NET.slnx
9.0.x
- name: Test .NET9
run: dotnet test --no-restore Motor.NET.slnx --framework net9.0
run: ./build.sh -t Test --dotnet-versions net9.0


#code-ql:
Expand Down Expand Up @@ -117,55 +107,32 @@ jobs:
steps:
- name: Download Artifact
id: download
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: artifacts
- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
- name: Push to NuGet Feed
run: dotnet nuget push "${{ steps.download.outputs.download-path }}/*.nupkg" --skip-duplicate --source $NUGET_FEED --api-key $NUGET_KEY
- name: Push to NuGet feed
run: ./build.sh -t NugetPush --artifacts-directory "${{ steps.download.outputs.download-path }}"

build-bridge:
needs: [build, format, test-net8, test-net9]
runs-on: ubuntu-latest
steps:
- name: Download Artifact
id: download
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: artifacts-bridge
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=ghcr.io/gdatasoftwareag/motornet/bridge
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${VERSION}-${GITHUB_SHA::8}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Login to Github Registry
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Packages
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name == 'release' }}
context: "${{ steps.download.outputs.download-path }}"
tags: ${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
run: /build.sh -t BridgeContainerImage --bridge-artifacts-directory "${{ steps.download.outputs.download-path }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ obj/
v14/
tools/*
artifacts/
artifacts-bridge/
test-results/
TestResults/
*.trx
.vscode
.rider
*.user
.ionide/
build/tools/
3 changes: 3 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<ItemGroup>
<PackageVersion Include="AWSSDK.Extensions.NETCore.Setup" Version="4.0.4.6" />
<PackageVersion Include="AWSSDK.SQS" Version="4.0.3.3" />
<PackageVersion Include="Cake.Docker" Version="1.5.0" />
<PackageVersion Include="Cake.DotNetLocalTools.Module" Version="3.0.12" />
<PackageVersion Include="Cake.Frosting" Version="6.2.0" />
<PackageVersion Include="CloudNative.CloudEvents" Version="2.8.0" />
<PackageVersion Include="CloudNative.CloudEvents.Kafka" Version="2.8.0" />
<PackageVersion Include="CloudNative.CloudEvents.SystemTextJson" Version="2.8.0" />
Expand Down
3 changes: 3 additions & 0 deletions Motor.NET.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@
<Project Path="test/Motor.Extensions.Http_UnitTest/Motor.Extensions.Http_UnitTest.csproj" />
<Project Path="test/Motor.Extensions.Utilities_IntegrationTest/Motor.Extensions.Utilities_IntegrationTest.csproj" />
</Folder>
<Project Path="build/build.csproj">
<Build Project="false" />
</Project>
</Solution>
2 changes: 2 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dotnet run --project build/Build.csproj -- $args
exit $LASTEXITCODE;
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet run --project ./build/Build.csproj -- "$@"
60 changes: 60 additions & 0 deletions build/Artifacts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System.IO;
using System.Linq;
using Cake.Common.Diagnostics;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Pack;
using Cake.Common.Tools.DotNet.Publish;
using Cake.Frosting;

namespace build;

[TaskName("Pack")]
[IsDependentOn(typeof(BuildTask))]
public sealed class PackTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context) =>
context.DotNetPack(
context.SolutionFilePath,
new DotNetPackSettings
{
Configuration = context.BuildConfiguration,
OutputDirectory = context.ArtifactsDirectory,
NoBuild = true,
IncludeSource = true,
IncludeSymbols = true,
Verbosity = DotNetVerbosity.Minimal,
}
);
}

[TaskName("Publish")]
[IsDependentOn(typeof(BuildTask))]
public sealed class PublishTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
var newestVersion = context.DotNetVersions.Max();
context.Information($"Publishing bridge for {newestVersion}");
context.DotNetPublish(
Path.Combine(
context.SolutionDirectory,
"src",
"Motor.Extensions.Hosting.Bridge",
"Motor.Extensions.Hosting.Bridge.csproj"
),
new DotNetPublishSettings
{
Configuration = context.BuildConfiguration,
Framework = newestVersion,
OutputDirectory = context.BridgeArtifactsDirectory,
NoBuild = true,
Verbosity = DotNetVerbosity.Minimal,
}
);
}
}

[TaskName("Artifacts")]
[IsDependentOn(typeof(PackTask))]
[IsDependentOn(typeof(PublishTask))]
public sealed class ArtifactsTask : FrostingTask<BuildContext> { }
12 changes: 12 additions & 0 deletions build/Build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Cake.Docker" />
<PackageReference Include="Cake.DotNetLocalTools.Module" />
<PackageReference Include="Cake.Frosting" />
</ItemGroup>
</Project>
Loading
Loading