Draft
Add GitHub Actions release workflow and CMake pre-built managed artifact support#5
Conversation
Agent-Logs-Url: https://github.com/jpfeuffer/openms-thermo-bridge/sessions/2feac3e6-3e8b-4200-b0e5-76ed164546ee Co-authored-by: jpfeuffer <8102638+jpfeuffer@users.noreply.github.com>
…e write CVE Agent-Logs-Url: https://github.com/jpfeuffer/openms-thermo-bridge/sessions/2feac3e6-3e8b-4200-b0e5-76ed164546ee Co-authored-by: jpfeuffer <8102638+jpfeuffer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add GitHub Actions release workflow for managed C# artifacts
Add GitHub Actions release workflow and CMake pre-built managed artifact support
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Downstream C++ consumers currently need a full .NET 8 SDK at build time solely to run
dotnet publishfor the managed shim. This PR pre-builds and publishes the managed output directory as GitHub Release artifacts and adds CMake options to consume them, so only the .NET 8 runtime is required at build/runtime.Release workflow (
.github/workflows/release.yml)v*tags; builds a 3-leg matrix (linux-x64,win-x64,osx-x64)curl-install to~/.dotnet-x64,--os osx -a x64).nupkgfiles, writes a local NuGet config, runsdotnet publish, and zips the output asopenms-thermo-bridge-managed-<platform>-<version>.zippublish-releasejob collects all three zips and creates the GitHub Release viasoftprops/action-gh-release@v2actions/download-artifactpinned tov4.1.3(fixes arbitrary file write CVE affecting>= 4.0.0, < 4.1.3)New CMake options
OPENMS_THERMO_BRIDGE_PREBUILT_MANAGED_DIR(empty PATH, default off)Point at an unpacked release artifact zip. Skips
dotnet publish; validates thatThermoWrapperManaged.dllandThermoWrapperManaged.runtimeconfig.jsonare present before proceeding.OPENMS_THERMO_BRIDGE_DOWNLOAD_PREBUILT_MANAGED(BOOL, defaultOFF)Auto-fetches the correct platform zip from GitHub Releases at configure time, extracts it into
${CMAKE_CURRENT_BINARY_DIR}/prebuilt-managed/, and uses it. Re-configure skips the download if the zip is already cached. Falls back withFATAL_ERRORif download fails and no SDK is available.On Apple Silicon both options always resolve to the
osx-x64artifact (Rosetta), consistent with the existing workaround. Theadd_dependencies/openms_thermo_bridge_copy_runtime_filesbuild graph is unchanged in both paths.Documentation (
README.md)Original prompt
Goal
Pre-build and publish the managed C# output directory as GitHub Release artifacts so downstream C++ users only need CMake and a .NET runtime (not SDK) at build time.
Tasks
1. Add GitHub Actions release workflow (
.github/workflows/release.yml)v*.ubuntu-latest→linux-x64,windows-latest→win-x64,macos-latest→osx-x64(using the existing arm64/Rosetta workaround so the artifact works on Apple Silicon via--os osx -a x64).~/.dotnet-x64, setDOTNET_ROOT,DOTNET_ROOT_X64).dotnet publish ThermoWrapperManaged.csproj -c Release --nologo --self-contained false(macOS adds-r osx-x64) to produce the managed directory.openms-thermo-bridge-managed-<platform>-<version>.zip.softprops/action-gh-releaseto create a GitHub Release and attach all three zips as assets.contents: writepermission to the job.2. Extend CMake with
OPENMS_THERMO_BRIDGE_PREBUILT_MANAGED_DIRoptionOPENMS_THERMO_BRIDGE_PREBUILT_MANAGED_DIR(empty by default).add_custom_commandthat runsdotnet publish.ThermoWrapperManaged.dllandThermoWrapperManaged.runtimeconfig.jsonexist in the given directory.OPENMS_THERMO_BRIDGE_MANAGED_DIRto the provided path.add_dependencies(openms_thermo_bridge openms_thermo_bridge_managed)andopenms_thermo_bridge_copy_runtime_filesmachinery already usesOPENMS_THERMO_BRIDGE_MANAGED_DIR, so everything downstream works unchanged.3. Add
OPENMS_THERMO_BRIDGE_DOWNLOAD_PREBUILT_MANAGEDfor auto-downloadOPENMS_THERMO_BRIDGE_DOWNLOAD_PREBUILT_MANAGED(default OFF).file(DOWNLOAD ...)) fetches the correct platform zip from the GitHub Releases API URL (parameterised by project version tag).${CMAKE_CURRENT_BINARY_DIR}/prebuilt-managed/usingcmake -E tar.OPENMS_THERMO_BRIDGE_PREBUILT_MANAGED_DIRto that extracted directory.FATAL_ERRORmessage if the download fails and neither a local prebuilt nor a dotnet SDK is available.4. macOS arm64 workaround for the pre-built artifact
dotnet publish --os osx -a x64), so the published zip is always osx-x64.OPENMS_THERMO_BRIDGE_DOWNLOAD_PREBUILT_MANAGED=ONon Apple Silicon:osx-x64artifact URL.CMAKE_OSX_ARCHITECTURESis still forced tox86_64(existing behaviour).OPENMS_THERMO_BRIDGE_PREBUILT_MANAGED_DIRis set manually on Apple Silicon, CMake emits the same Rosetta performance warning it currently does, but does not block the build.5. Update documentation (
README.md)-DOPENMS_THERMO_BRIDGE_PREBUILT_MANAGED_DIR=/path/to/unpacked/zipfor manually downloaded artifacts.-DOPENMS_THERMO_BRIDGE_DOWNLOAD_PREBUILT_MANAGED=ONfor automatic download.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Analysis: Can the C# Wrapper Be Eliminated?
No — the C# wrapper (ThermoWrapperManaged.cs) cannot be removed.
The Thermo RawFileReader library (ThermoFisher.CommonCore.*) is a managed .NET assembly. It exposes entirely managed types: IRawDataPlus, Scan, ChromatogramTraceSettings, managed strings, LINQ, managed exceptions, etc. There is no native C or C++ API surface — the library exists only in managed code.
The nethost/hostfxr mechanism that the C++ side uses can only call across the managed/native boundary via [UnmanagedCallersOnly] entry points. Those entry points are the methods in ThermoWrapperManaged.cs that:
Receive raw IntPtr/int/double arguments from C++,
Unmarshal them into managed .NET types,
Call the RawFileReader managed API,
Marshal results back into native-compatible primitives (blittable arrays via Marshal.Copy, UTF-8 strings into caller-provided buffers, sentinel error values, etc.).
Without this shim, C++ would have no way to turn a managed IRawDat...
This pull request was created from Copilot chat.