Skip to content

chore: trigger publish #140

chore: trigger publish

chore: trigger publish #140

name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-windows:
runs-on: windows-latest
env:
HUSKY: 0
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.x'
- name: Determine version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Display version
run: echo "SemVer ${{ steps.gitversion.outputs.semVer }}"
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Restore .NET dependencies
run: dotnet restore
- name: Build Metreja.Tool
run: dotnet build src/Metreja.Tool/Metreja.Tool.csproj -c Release --no-restore
- name: Build Metreja.Profiler (C++ DLL)
run: msbuild src/Metreja.Profiler/Metreja.Profiler.vcxproj /p:Configuration=Release /p:Platform=x64 "/p:SolutionDir=${{ github.workspace }}/"
- name: Run clang-tidy on Profiler
shell: pwsh
run: |
# Discover MSVC and Windows SDK include paths
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vswhere -latest -property installationPath
$msvcPath = Get-ChildItem "$vsPath\VC\Tools\MSVC" | Sort-Object Name | Select-Object -Last 1
$sdkVersion = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots").KitsRoot10
$sdkVer = Get-ChildItem "${sdkVersion}Include" | Sort-Object Name | Select-Object -Last 1
$includes = @(
"-I", "src/Metreja.Profiler",
"-I", "src/Metreja.Profiler/include",
"-I", "src/Metreja.Profiler/vendor",
"-I", "src/Metreja.Profiler/platform",
"-isystem", "$($msvcPath.FullName)\include",
"-isystem", "$($sdkVer.FullName)\um",
"-isystem", "$($sdkVer.FullName)\shared",
"-isystem", "$($sdkVer.FullName)\ucrt"
)
$cppFiles = Get-ChildItem src/Metreja.Profiler/*.cpp | ForEach-Object { $_.FullName }
& clang-tidy @cppFiles -- -std=c++17 -DWIN32 -D_WINDOWS -DNDEBUG @includes
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Build Metreja.TestApp
run: dotnet build test/Metreja.TestApp/Metreja.TestApp.csproj -c Release --no-restore
- name: Run integration tests
run: dotnet test test/Metreja.IntegrationTests/Metreja.IntegrationTests.csproj -c Release --no-restore --verbosity normal
- name: Upload profiler DLL
if: success() && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v7
with:
name: profiler-windows
path: bin/Release/Metreja.Profiler.dll
build-macos:
runs-on: macos-14
env:
HUSKY: 0
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.x'
- name: Determine version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Display version
run: echo "SemVer ${{ steps.gitversion.outputs.semVer }}"
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Build Metreja.Profiler (CMake)
run: |
cd src/Metreja.Profiler
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
- name: Copy dylib to bin/Release
run: |
mkdir -p bin/Release
cp src/Metreja.Profiler/build/libMetreja.Profiler.dylib bin/Release/
- name: Restore .NET dependencies
run: dotnet restore
- name: Build Metreja.Tool
run: dotnet build src/Metreja.Tool/Metreja.Tool.csproj -c Release --no-restore
- name: Build Metreja.TestApp
run: dotnet build test/Metreja.TestApp/Metreja.TestApp.csproj -c Release --no-restore
- name: Run integration tests
run: dotnet test test/Metreja.IntegrationTests/Metreja.IntegrationTests.csproj -c Release --no-restore --verbosity normal
- name: Upload profiler dylib
if: success() && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v7
with:
name: profiler-macos
path: bin/Release/libMetreja.Profiler.dylib