Skip to content
Closed
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
48 changes: 48 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# Enable version updates for NuGet (.NET packages)
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
# Group all Microsoft.Extensions.* packages together
microsoft-extensions:
patterns:
- "Microsoft.Extensions.*"
# Group all System.* packages together
system-packages:
patterns:
- "System.*"
# Group test-related packages together
test-packages:
patterns:
- "xunit*"
- "Microsoft.NET.Test.Sdk"

# Enable version updates for npm (Node.js test dependencies)
- package-ecosystem: "npm"
directory: "/test/node"
schedule:
interval: "weekly"
open-pull-requests-limit: 5

# Enable version updates for Docker base images
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
222 changes: 114 additions & 108 deletions .github/workflows/main-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,123 +3,129 @@ name: Main and Release CI Build
on:
workflow_dispatch:
push:
branches: [ master, main ]
branches: [master, main]
create:
tags:
- 'v*.*'
- "v*.*"
pull_request:
branches: [ master, main ]
branches: [master, main]

jobs:
build:
permissions: write-all
permissions: write-all
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: windows-latest
windows: true
runs-on: ${{ matrix.os }}

steps:
- run: |
mkdir artifacts
mkdir artifacts/build

- uses: actions/checkout@v4
with:
fetch-depth: 0 # Mandatory to use the extract version from tag action

- name: Extract version from tag
uses: damienaicheh/[email protected]


- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build Docker Image TAR file
run: |
mkdir -p artifacts/build/images
DOCKER_BUILDKIT=1 docker build . --build-arg "REVISION=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}" --build-arg "VERSION=${{ env.MAJOR }}.${{ env.MINOR }}" -t azbridge:${{ env.MAJOR }}.${{ env.MINOR }} -t azbridge
docker save azbridge:${{ env.MAJOR }}.${{ env.MINOR }} > artifacts/build/images/azbridge-oci-image-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.tar
if: matrix.os == 'ubuntu-latest'

- name: Build for Windows-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=true /p:RuntimeIdentifier=win-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for Windows-arm64
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=win-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for Windows-x86
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=win-x86 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for macOS-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=osx-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'macos-latest'
- name: Build for macOS-arm64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=osx-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'macos-latest'
- name: Build for Linux-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=linux-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'ubuntu-latest'
- name: Build for Linux-arm64
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=linux-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'ubuntu-latest'

- name: Unit Test Windows x64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
run: dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=win-x64 /p:Configuration=Debug
if: matrix.os == 'windows-latest'
- name: Unit Test Linux x64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
run: dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=linux-x64 /p:Configuration=Debug
if: matrix.os == 'ubuntu-latest'
- name: Unit Test macOS arm64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# W/A for Dns.GetHostEntry(Dns.GetHostName()) exception https://github.com/actions/runner-images/issues/8649
run: |
echo -e "$(ipconfig getifaddr en0) $(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
./test/unit/macos_unblock_testip.sh
dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=osx-arm64 /p:Configuration=Debug
if: matrix.os == 'macos-latest'

- uses: actions/upload-artifact@v3
with:
name: XBuild
path: artifacts/build/net8.0

- uses: actions/upload-artifact@v3
with:
name: XBuild
path: artifacts/build/images
if: matrix.os == 'ubuntu-latest'

#- name: Integration Tests Docker/Linux
# env:
# AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# run: bash ./verify-build.sh
# if: matrix.os == 'ubuntu-latest'

#- name: Integration Tests Windows
# env:
# AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# run: ./verify-build.cmd
# if: matrix.os == 'windows-latest'

# create a release if a tag has been pushed
- name: Generate Release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
artifacts: "artifacts/build/net8.0/*,artifacts/build/images/*"
generateReleaseNotes: true
allowUpdates: true

- run: |
mkdir artifacts
mkdir artifacts/build

- uses: actions/checkout@v4
with:
fetch-depth: 0 # Mandatory to use the extract version from tag action

- name: Extract version from tag
uses: damienaicheh/[email protected]

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build Docker Image TAR file
run: |
mkdir -p artifacts/build/images
DOCKER_BUILDKIT=1 docker build . --build-arg "REVISION=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}" --build-arg "VERSION=${{ env.MAJOR }}.${{ env.MINOR }}" -t azbridge:${{ env.MAJOR }}.${{ env.MINOR }} -t azbridge
docker save azbridge:${{ env.MAJOR }}.${{ env.MINOR }} > artifacts/build/images/azbridge-oci-image-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}.tar
if: matrix.os == 'ubuntu-latest'

- name: Build for Windows-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=true /p:RuntimeIdentifier=win-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for Windows-arm64
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=win-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for Windows-x86
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=win-x86 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'windows-latest'
- name: Build for macOS-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=osx-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'macos-latest'
- name: Build for macOS-arm64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=osx-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'macos-latest'
- name: Build for Linux-x64
run: dotnet msbuild /t:Package /p:WindowsOnly=false /p:RuntimeIdentifier=linux-x64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'ubuntu-latest'
- name: Build for Linux-arm64
run: dotnet msbuild /t:Restore,Package /p:WindowsOnly=false /p:RuntimeIdentifier=linux-arm64 /p:Configuration=Release /p:TargetFramework=net8.0 /p:VersionSuffix=rel /p:VersionPrefix=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}
if: matrix.os == 'ubuntu-latest'

- name: Unit Test Windows x64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
run: dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=win-x64 /p:Configuration=Debug
if: matrix.os == 'windows-latest'
- name: Unit Test Linux x64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
run: dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=linux-x64 /p:Configuration=Debug
if: matrix.os == 'ubuntu-latest'
- name: Unit Test macOS arm64
env:
AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# W/A for Dns.GetHostEntry(Dns.GetHostName()) exception https://github.com/actions/runner-images/issues/8649
run: |
echo -e "$(ipconfig getifaddr en0) $(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
./test/unit/macos_unblock_testip.sh
dotnet test /p:TargetFramework=net8.0 /p:RuntimeIdentifier=osx-arm64 /p:Configuration=Debug
if: matrix.os == 'macos-latest'

- uses: actions/upload-artifact@v4
with:
name: XBuild-${{ matrix.os }}
path: artifacts/build/net8.0

- uses: actions/upload-artifact@v4
with:
name: XBuild-Docker-Images-ubuntu-latest
path: artifacts/build/images
if: matrix.os == 'ubuntu-latest'

#- name: Integration Tests Docker/Linux
# env:
# AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# run: bash ./verify-build.sh
# if: matrix.os == 'ubuntu-latest'

#- name: Integration Tests Windows
# env:
# AZBRIDGE_TEST_CXNSTRING: ${{ secrets.AZBRIDGE_TEST_CXNSTRING }}
# run: ./verify-build.cmd
# if: matrix.os == 'windows-latest'

release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts

- name: Generate Release
uses: ncipollo/release-action@v1
with:
artifacts: "artifacts/**/*"
generateReleaseNotes: true
allowUpdates: true
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<PackageVersion Include="Microsoft.Azure.Relay" Version="3.0.1" />
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
<PackageVersion Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
<PackageVersion Include="Azure.Identity" Version="1.14.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Systemd" Version="8.0.0" />
Expand Down
14 changes: 11 additions & 3 deletions test/unit/Microsoft.Azure.Relay.Bridge.Tests/BridgeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,18 @@ public void OnError(Exception error)

public void OnNext(KeyValuePair<string, object> value)
{
DiagnosticsRecord record = (DiagnosticsRecord)value.Value;
try
{
DiagnosticsRecord record = (DiagnosticsRecord)value.Value;

string message = $"[{DateTime.UtcNow}], {value.Key}, {record.Activity}, {record.Info}";
logger.WriteLine(message);
string message = $"[{DateTime.UtcNow}], {value.Key}, {record.Activity}, {record.Info}";
logger.WriteLine(message);
}
catch (InvalidOperationException)
{
// Ignore if there's no active test - this can happen when the subscription
// from BridgeTest.RunScenarios persists and other test classes trigger diagnostics
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/Microsoft.Azure.Relay.Bridge.Tests/ConfigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ private static void CheckMaxConfig(Config config)
Assert.Equal("Endpoint=sb://cvrelay.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abcdefgh;", config.AzureRelayConnectionString);
Assert.Equal("sb://cvrelay.servicebus.windows.net/", config.AzureRelayEndpoint);
Assert.Equal("RootManageSharedAccessKey", config.AzureRelaySharedAccessKeyName);
Assert.Equal("P0CQgKxRl8S0ABAlmbitHDEWfwWUQzKB34J0w48SB/w=", config.AzureRelaySharedAccessKey);
Assert.Equal("abcdefgh", config.AzureRelaySharedAccessKey);
Assert.Null(config.AzureRelaySharedAccessSignature);
Assert.Equal("127.0.0.4", config.BindAddress);
Assert.False(config.ClearAllForwardings);
Expand Down