Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
124 changes: 124 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: CI & Release

on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
platform: linux-x86_64
archive_ext: tar.gz

- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
platform: linux-aarch64
archive_ext: tar.gz

- os: macos-14
target: aarch64-apple-darwin
platform: macos-arm64
archive_ext: tar.gz

- os: windows-2025
target: x86_64-pc-windows-msvc
platform: windows-x86_64
archive_ext: zip

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache Cargo
uses: Swatinem/rust-cache@v2
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

- name: Run tests
run: cargo test --features with_timsrust

- name: Build release
run: cargo build --features with_timsrust --release

- name: Smoke test (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
g++ -std=c++17 examples/cpp_client.cpp \
-Iinclude \
-Ltarget/release -ltimsrust_cpp_bridge \
-lpthread -ldl -lm \
Comment thread
coderabbitai[bot] marked this conversation as resolved.
-o target/smoke_test
# Run with no args — expect exit code 1 (usage), fail only on signal/crash
target/smoke_test || if [ $? -gt 128 ]; then exit 1; fi
Comment thread
timosachsenberg marked this conversation as resolved.

- name: Smoke test (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
clang++ -std=c++17 examples/cpp_client.cpp \
-Iinclude \
-Ltarget/release -ltimsrust_cpp_bridge \
-framework Security -framework SystemConfiguration \
-lresolv -lpthread \
-o target/smoke_test
# Run with no args — expect exit code 1 (usage), fail only on signal/crash
target/smoke_test || if [ $? -gt 128 ]; then exit 1; fi

- name: Setup MSVC dev environment
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Smoke test (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
cl.exe /std:c++17 /EHsc /Fe:target\smoke_test.exe /I include examples\cpp_client.cpp target\release\timsrust_cpp_bridge.lib ws2_32.lib userenv.lib bcrypt.lib ntdll.lib advapi32.lib
target\smoke_test.exe || ver>nul
Comment thread
timosachsenberg marked this conversation as resolved.
Outdated

- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/v')
id: version
shell: bash
run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"

- name: Package
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: bash scripts/package.sh "${{ steps.version.outputs.version }}" "${{ matrix.target }}"

- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: timsrust_cpp_bridge-v${{ steps.version.outputs.version }}-${{ matrix.platform }}
path: target/package/timsrust_cpp_bridge-v${{ steps.version.outputs.version }}-${{ matrix.platform }}.${{ matrix.archive_ext }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
generate_release_notes: true
33 changes: 33 additions & 0 deletions cmake/timsrust_cpp_bridgeConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# timsrust_cpp_bridgeConfig.cmake
# Config-mode package file for timsrust_cpp_bridge
#
# Provides imported target: timsrust_cpp_bridge::timsrust_cpp_bridge
#
# This file lives at <prefix>/lib/cmake/timsrust_cpp_bridge/timsrust_cpp_bridgeConfig.cmake
# The prefix is resolved relative to this file's location.

get_filename_component(_TIMSRUST_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)

if(NOT TARGET timsrust_cpp_bridge::timsrust_cpp_bridge)
add_library(timsrust_cpp_bridge::timsrust_cpp_bridge STATIC IMPORTED)

set_target_properties(timsrust_cpp_bridge::timsrust_cpp_bridge PROPERTIES
IMPORTED_LOCATION "${_TIMSRUST_PREFIX}/lib/@TIMSRUST_LIB_FILENAME@"
INTERFACE_INCLUDE_DIRECTORIES "${_TIMSRUST_PREFIX}/include"
)

# Platform-specific system link dependencies required by the Rust static library.
# These are validated empirically by CI smoke tests on each platform.
if(UNIX AND NOT APPLE)
set_property(TARGET timsrust_cpp_bridge::timsrust_cpp_bridge APPEND PROPERTY
INTERFACE_LINK_LIBRARIES pthread dl m)
elseif(APPLE)
set_property(TARGET timsrust_cpp_bridge::timsrust_cpp_bridge APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "-framework Security" "-framework SystemConfiguration" resolv)
elseif(WIN32)
set_property(TARGET timsrust_cpp_bridge::timsrust_cpp_bridge APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ws2_32 userenv bcrypt ntdll advapi32)
endif()
endif()

unset(_TIMSRUST_PREFIX)
20 changes: 20 additions & 0 deletions cmake/timsrust_cpp_bridgeConfigVersion.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# timsrust_cpp_bridgeConfigVersion.cmake
# Auto-generated version compatibility file — SameMinorVersion semantics.

set(PACKAGE_VERSION "@TIMSRUST_VERSION_MAJOR@.@TIMSRUST_VERSION_MINOR@.@TIMSRUST_VERSION_PATCH@")

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
# SameMinorVersion: major and minor must match exactly
if("@TIMSRUST_VERSION_MAJOR@" EQUAL PACKAGE_FIND_VERSION_MAJOR
AND "@TIMSRUST_VERSION_MINOR@" EQUAL PACKAGE_FIND_VERSION_MINOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()

if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
endif()
endif()
Loading
Loading