From 430ea4022ad03a2a45782fb2b28291e8c5d21587 Mon Sep 17 00:00:00 2001 From: Katze719 Date: Wed, 26 Aug 2026 14:48:51 +0200 Subject: [PATCH 01/15] feat: publish portable x86-64 and aarch64 builds --- .github/workflows/block_pr_check_labels.yml | 3 - .github/workflows/build_binary.yml | 194 +++++++++++++++----- .github/workflows/publish_jsr.yml | 50 +++-- .github/workflows/test_deno.yml | 28 ++- .github/workflows/test_unit_cpp.yml | 19 +- CMakeLists.txt | 62 ++++++- README.md | 28 ++- jsr/README.md | 14 +- jsr/src/bin/index.ts | 8 +- scripts/verify_release_binary.sh | 63 +++++++ 10 files changed, 370 insertions(+), 99 deletions(-) create mode 100755 scripts/verify_release_binary.sh diff --git a/.github/workflows/block_pr_check_labels.yml b/.github/workflows/block_pr_check_labels.yml index 6d4041f5..3a85c18e 100644 --- a/.github/workflows/block_pr_check_labels.yml +++ b/.github/workflows/block_pr_check_labels.yml @@ -1,7 +1,4 @@ name: 'Block PR Check Labels' -description: | - This workflow checks for specific labels and if a forbidden label exists, fails the pipeline, - thus preventing the merge. on: pull_request: diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index ba7555b5..9ebd3195 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -1,25 +1,22 @@ name: 'Build Binary' -description: | - This workflow builds the binary files for Linux. The build binaries are stored as artifact - and may be reused by other workflows. on: push: - branches: [ 'main' ] - tags: [ '*' ] - + branches: ['main'] + tags: ['*'] pull_request: - branches: [ '*' ] + branches: ['*'] jobs: - build-binary: - name: 'Build binary' - runs-on: ubuntu-latest + generate-metadata: + name: 'Generate FFI metadata' + runs-on: ubuntu-24.04 env: ASTREIN_VERSION: '1.1.0' ASTREIN_SHA256: 'd5964319ea5a3742e4d7223ee5963d6aa3b24c8f67ef75c61d591c635f413497' - permissions: - contents: write + outputs: + package_version: ${{ steps.version.outputs.PACKAGE_VERSION }} + is_valid_package_version: ${{ steps.check-tag.outputs.IS_VALID_PACKAGE_VERSION }} steps: - name: 'Checkout repository' @@ -59,75 +56,170 @@ jobs: -DCPP_BINDINGS_LINUX_ENABLE_FFI_JSON_EXPORT=ON \ -DCPP_BINDINGS_LINUX_ASTREIN_EXECUTABLE="${RUNNER_TEMP}/astrein/bin/astrein" - - name: 'Build' + - name: 'Generate metadata' run: | cmake --build --preset linux-gcc-release \ - --target cpp_bindings_linux cpp_bindings_linux_ffi_json - - - name: 'Set PACKAGE_VERSION from env.sh' + --target cpp_bindings_linux_ffi_json + + - name: 'Set package version' id: version run: | . build/env.sh - echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_OUTPUT + echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> "${GITHUB_OUTPUT}" - - name: 'Check tag' - id: 'check-tag' + - name: 'Check package version' + id: check-tag env: PACKAGE_VERSION: ${{ steps.version.outputs.PACKAGE_VERSION }} - run: | - if [[ "$PACKAGE_VERSION" =~ ^(0|[1-9][[:digit:]]*)\.(0|[1-9][[:digit:]]*)\.(0|[1-9][[:digit:]]*)(-(alpha|rc|beta|experimental)\.[1-9][[:digit:]]*)?$ ]]; then - echo "Version \"$PACKAGE_VERSION\" is a valid package version." - echo "IS_VALID_PACKAGE_VERSION=true" >> $GITHUB_OUTPUT + if [[ "${PACKAGE_VERSION}" =~ ^(0|[1-9][[:digit:]]*)\.(0|[1-9][[:digit:]]*)\.(0|[1-9][[:digit:]]*)(-(alpha|rc|beta|experimental)\.[1-9][[:digit:]]*)?$ ]]; then + echo "Version \"${PACKAGE_VERSION}\" is a valid package version." + echo "IS_VALID_PACKAGE_VERSION=true" >> "${GITHUB_OUTPUT}" else - echo "Version \"$PACKAGE_VERSION\" is not a valid package version." - echo "IS_VALID_PACKAGE_VERSION=false" >> $GITHUB_OUTPUT + echo "Version \"${PACKAGE_VERSION}\" is not a valid package version." + echo "IS_VALID_PACKAGE_VERSION=false" >> "${GITHUB_OUTPUT}" fi - - name: 'Upload artifacts' + - name: 'Upload FFI metadata' uses: actions/upload-artifact@v4 with: if-no-files-found: error - name: libcpp_bindings_linux - path: | - build/libcpp_bindings_linux.so - build/cpp_bindings_linux.ffi.json + name: cpp-bindings-linux-ffi + path: build/cpp_bindings_linux.ffi.json - - name: 'Create GitHub Release' - if: github.ref_type == 'tag' && steps.check-tag.outputs.IS_VALID_PACKAGE_VERSION == 'true' - uses: softprops/action-gh-release@v2 + build-binary: + name: 'Build ${{ matrix.target }}' + runs-on: ${{ matrix.runner }} + container: + image: ${{ matrix.image }} + strategy: + fail-fast: false + matrix: + include: + - target: linux-x86_64-gnu + runner: ubuntu-24.04 + image: quay.io/pypa/manylinux_2_28_x86_64@sha256:4dc41da7df20400310c80d162a2fe2d2c2f3d9734d8dec20f6b9843711618deb + artifact: libcpp_bindings_linux-linux-x86_64-gnu + - target: linux-aarch64-gnu + runner: ubuntu-24.04-arm + image: quay.io/pypa/manylinux_2_28_aarch64@sha256:29a6ceb78de5b00494e6e7456a72782a4cb54238de102e7491d15fe47789b4d1 + artifact: libcpp_bindings_linux-linux-aarch64-gnu + + steps: + - name: 'Checkout repository' + uses: actions/checkout@v4 with: - name: 'v${{ steps.version.outputs.PACKAGE_VERSION }}' - tag_name: ${{ github.ref_name }} - generate_release_notes: true - files: | - build/libcpp_bindings_windows.so - build/cpp_bindings_linux.ffi.json - - outputs: - package_version: ${{ steps.version.outputs.PACKAGE_VERSION }} - is_valid_package_version: ${{ steps.check-tag.outputs.IS_VALID_PACKAGE_VERSION }} + fetch-depth: 0 + + - name: 'Configure portable release' + run: | + cmake -S . -B build -G "Unix Makefiles" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_COMPILER=g++ \ + -DCPP_BINDINGS_LINUX_PORTABLE_CPU_BASELINE=ON \ + -DCPP_BINDINGS_LINUX_STATIC_CXX_RUNTIME=ON + + - name: 'Build and test' + run: | + cmake --build build \ + --target cpp_bindings_linux cpp_bindings_linux_tests \ + --parallel 4 + ctest --test-dir build \ + --output-on-failure \ + --output-junit test-report.xml + + - name: 'Stage and verify binary' + run: | + mkdir -p "dist/${{ matrix.target }}" + cp -L build/libcpp_bindings_linux.so \ + "dist/${{ matrix.target }}/libcpp_bindings_linux.so" + ./scripts/verify_release_binary.sh \ + "dist/${{ matrix.target }}/libcpp_bindings_linux.so" \ + "${{ matrix.target }}" + + - name: 'Upload test report' + if: always() + uses: actions/upload-artifact@v4 + with: + if-no-files-found: warn + name: test-report-${{ matrix.target }} + path: build/test-report.xml + + - name: 'Upload binary' + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + name: ${{ matrix.artifact }} + path: dist/${{ matrix.target }}/libcpp_bindings_linux.so test-unit-cpp: name: 'Run: Test Unit C++' needs: ['build-binary'] uses: './.github/workflows/test_unit_cpp.yml' with: - artifact-name: libcpp_bindings_linux - + artifact-name: libcpp_bindings_linux-linux-x86_64-gnu permissions: contents: read checks: write - + + create-release: + name: 'Create GitHub release' + needs: ['generate-metadata', 'build-binary', 'test-unit-cpp'] + if: github.ref_type == 'tag' && needs.generate-metadata.outputs.is_valid_package_version == 'true' + runs-on: ubuntu-24.04 + permissions: + contents: write + + steps: + - name: 'Download x86-64 binary' + uses: actions/download-artifact@v4 + with: + name: libcpp_bindings_linux-linux-x86_64-gnu + path: release/x86_64 + + - name: 'Download AArch64 binary' + uses: actions/download-artifact@v4 + with: + name: libcpp_bindings_linux-linux-aarch64-gnu + path: release/aarch64 + + - name: 'Download FFI metadata' + uses: actions/download-artifact@v4 + with: + name: cpp-bindings-linux-ffi + path: release/ffi + + - name: 'Name release assets' + run: | + mv release/x86_64/libcpp_bindings_linux.so \ + release/libcpp_bindings_linux-linux-x86_64-gnu.so + mv release/aarch64/libcpp_bindings_linux.so \ + release/libcpp_bindings_linux-linux-aarch64-gnu.so + mv release/ffi/cpp_bindings_linux.ffi.json \ + release/cpp_bindings_linux.ffi.json + + - name: 'Create GitHub release' + uses: softprops/action-gh-release@v2 + with: + name: 'v${{ needs.generate-metadata.outputs.package_version }}' + tag_name: ${{ github.ref_name }} + generate_release_notes: true + files: | + release/libcpp_bindings_linux-linux-x86_64-gnu.so + release/libcpp_bindings_linux-linux-aarch64-gnu.so + release/cpp_bindings_linux.ffi.json + publish-jsr: name: 'Run: Publish JSR' - needs: ['build-binary', 'test-unit-cpp'] + needs: ['generate-metadata', 'build-binary', 'test-unit-cpp'] uses: './.github/workflows/publish_jsr.yml' with: - publish: ${{ needs.build-binary.outputs.is_valid_package_version == 'true' }} - version: ${{ needs.build-binary.outputs.package_version }} - artifact-name: libcpp_bindings_linux - + publish: ${{ needs.generate-metadata.outputs.is_valid_package_version == 'true' }} + version: ${{ needs.generate-metadata.outputs.package_version }} + x86-64-artifact-name: libcpp_bindings_linux-linux-x86_64-gnu + aarch64-artifact-name: libcpp_bindings_linux-linux-aarch64-gnu + ffi-artifact-name: cpp-bindings-linux-ffi permissions: contents: read id-token: write diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index 62f36306..c6323975 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -1,7 +1,4 @@ name: 'Publish JSR' -description: | - This workflow serializes the build binary to Base64 and generates a JSON file with meta data about the file. - The file then gets published to JSR (@serial/cpp-bindings-linux). on: workflow_call: @@ -16,8 +13,18 @@ on: required: true type: string - artifact-name: - description: 'Name of the artifact' + x86-64-artifact-name: + description: 'Name of the x86-64 binary artifact' + required: true + type: string + + aarch64-artifact-name: + description: 'Name of the AArch64 binary artifact' + required: true + type: string + + ffi-artifact-name: + description: 'Name of the shared FFI metadata artifact' required: true type: string @@ -40,22 +47,41 @@ jobs: with: deno-version: '2.x' - - name: 'Download artifact' + - name: 'Download x86-64 binary' + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.x86-64-artifact-name }} + path: 'artifacts/x86_64' + + - name: 'Download AArch64 binary' uses: actions/download-artifact@v4 with: - name: ${{ inputs.artifact-name }} - path: 'artifacts' + name: ${{ inputs.aarch64-artifact-name }} + path: 'artifacts/aarch64' + + - name: 'Download FFI metadata' + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.ffi-artifact-name }} + path: 'artifacts/ffi' - name: 'Prepare files for JSR' run: | mkdir -p ./jsr/bin - cp ./artifacts/libcpp_bindings_linux.so ./jsr/bin/x86_64.so - cp ./artifacts/cpp_bindings_linux.ffi.json ./jsr/bin/x86_64.ffi.json + cp ./artifacts/x86_64/libcpp_bindings_linux.so ./jsr/bin/x86_64.so + cp ./artifacts/aarch64/libcpp_bindings_linux.so ./jsr/bin/aarch64.so + cp ./artifacts/ffi/cpp_bindings_linux.ffi.json ./jsr/bin/x86_64.ffi.json + cp ./artifacts/ffi/cpp_bindings_linux.ffi.json ./jsr/bin/aarch64.ffi.json ./jsr/scripts/binary_to_json.sh \ - ./artifacts/libcpp_bindings_linux.so \ + ./jsr/bin/x86_64.so \ ./jsr/bin/x86_64.json \ - linux-x86_64 + linux-x86_64-gnu + + ./jsr/scripts/binary_to_json.sh \ + ./jsr/bin/aarch64.so \ + ./jsr/bin/aarch64.json \ + linux-aarch64-gnu ./jsr/scripts/set_version.sh \ jsr/jsr.json \ diff --git a/.github/workflows/test_deno.yml b/.github/workflows/test_deno.yml index 5e5fd1d6..7854a4ae 100644 --- a/.github/workflows/test_deno.yml +++ b/.github/workflows/test_deno.yml @@ -7,12 +7,19 @@ on: jobs: deno-tests: - name: Deno integration tests (deno ${{ matrix.deno }}) - runs-on: ubuntu-latest + name: Deno integration tests (${{ matrix.arch }}, deno ${{ matrix.deno }}) + runs-on: ${{ matrix.runner }} strategy: + fail-fast: false matrix: deno: ["2.6.0", "2.5.0"] + arch: [x86_64, aarch64] + include: + - arch: x86_64 + runner: ubuntu-24.04 + - arch: aarch64 + runner: ubuntu-24.04-arm steps: - name: Checkout repository @@ -23,23 +30,23 @@ jobs: with: deno-version: v${{ matrix.deno }} - - name: Setup GCC - uses: egor-tensin/setup-gcc@v2 + - name: Setup CMake + uses: jwlawson/actions-setup-cmake@v2 with: - version: '16' - platform: 'x64' + cmake-version: '3.31.x' - name: Install build dependencies run: | sudo apt-get update - sudo apt-get install -y cmake ninja-build socat git + sudo apt-get install -y gcc-14 g++-14 ninja-build socat git - name: Configure CMake run: | cmake -S . -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER=gcc-16 \ - -DCMAKE_CXX_COMPILER=g++-16 + -DCMAKE_C_COMPILER=gcc-14 \ + -DCMAKE_CXX_COMPILER=g++-14 \ + -DCPP_BINDINGS_LINUX_PORTABLE_CPU_BASELINE=ON - name: Build run: | @@ -49,7 +56,8 @@ jobs: run: | socat -d -d pty,raw,echo=0,link=/tmp/ttyCI_A,mode=666 pty,raw,echo=0,link=/tmp/ttyCI_B,mode=666 & sleep 2 - stdbuf -i0 -o0 cat < /tmp/ttyCI_B > /tmp/ttyCI_B & + exec 3<>/tmp/ttyCI_B + stdbuf -i0 -o0 cat <&3 >&3 & sleep 1 - name: Run Deno integration tests diff --git a/.github/workflows/test_unit_cpp.yml b/.github/workflows/test_unit_cpp.yml index 2e852bf5..23ca9028 100644 --- a/.github/workflows/test_unit_cpp.yml +++ b/.github/workflows/test_unit_cpp.yml @@ -1,6 +1,4 @@ name: 'Test Unit C++' -description: | - This workflow builds the library and runs the unit tests. on: workflow_call: @@ -22,6 +20,8 @@ jobs: steps: - name: 'Checkout repository' uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: 'Download artifact' uses: actions/download-artifact@v4 @@ -51,15 +51,23 @@ jobs: run: | cmake --build --preset linux-gcc-release --target cpp_bindings_linux_tests + - name: 'Use portable release binary in tests' + run: | + cp -L artifacts/libcpp_bindings_linux.so \ + "$(readlink -f build/libcpp_bindings_linux.so)" + - name: 'Install test dependencies' run: | sudo apt-get install -y socat - name: Start virtual serial echo (socat) run: | - socat -d -d pty,raw,echo=0,link=$SERIAL_TEST_PORT_IN,mode=666 pty,raw,echo=0,link=$SERIAL_TEST_PORT_OUT,mode=666 & + socat -d -d \ + "pty,raw,echo=0,link=${SERIAL_TEST_PORT_IN},mode=666" \ + "pty,raw,echo=0,link=${SERIAL_TEST_PORT_OUT},mode=666" & sleep 2 - stdbuf -i0 -o0 cat < $SERIAL_TEST_PORT_OUT > $SERIAL_TEST_PORT_OUT & + exec 3<>"${SERIAL_TEST_PORT_OUT}" + stdbuf -i0 -o0 cat <&3 >&3 & sleep 1 - name: 'Run tests' @@ -73,7 +81,7 @@ jobs: ./cpp_bindings_linux_tests \ --gtest_color=yes \ - --gtest_output=xml:$TEST_REPORT_NAME + --gtest_output="xml:${TEST_REPORT_NAME}" - name: 'Upload test report' if: always() @@ -93,4 +101,3 @@ jobs: annotate_notice: true transformers: '[{"searchValue": "${{ github.workspace }}", "replaceValue": ""}]' check_title_template: '{{FILE_NAME}} | {{TEST_NAME}}' - diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e5adc1c..783329dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,16 @@ option( "Enable ASTrein JSON export for the cpp-core FFI headers" OFF ) +option( + CPP_BINDINGS_LINUX_PORTABLE_CPU_BASELINE + "Build for the generic CPU baseline of the current architecture" + OFF +) +option( + CPP_BINDINGS_LINUX_STATIC_CXX_RUNTIME + "Statically link the GNU C++ and compiler runtimes into the shared library" + OFF +) set( CPP_BINDINGS_LINUX_ASTREIN_EXECUTABLE "" @@ -169,19 +179,56 @@ set_target_properties( target_include_directories( cpp_bindings_linux - PUBLIC + PRIVATE $ $ + $ $ ) -target_link_libraries( - cpp_bindings_linux - PUBLIC - cpp_core::cpp_core -) +target_compile_features(cpp_bindings_linux PRIVATE cxx_std_26) + +if(CPP_BINDINGS_LINUX_PORTABLE_CPU_BASELINE) + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _cpp_bindings_linux_processor) -target_compile_features(cpp_bindings_linux PUBLIC cxx_std_26) + if(_cpp_bindings_linux_processor MATCHES "^(x86_64|amd64)$") + target_compile_options( + cpp_bindings_linux + PRIVATE + -march=x86-64 + -mtune=generic + ) + elseif(_cpp_bindings_linux_processor MATCHES "^(aarch64|arm64)$") + target_compile_options( + cpp_bindings_linux + PRIVATE + -march=armv8-a + ) + else() + message( + FATAL_ERROR + "CPP_BINDINGS_LINUX_PORTABLE_CPU_BASELINE does not support " + "CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}" + ) + endif() +endif() + +if(CPP_BINDINGS_LINUX_STATIC_CXX_RUNTIME) + if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + message( + FATAL_ERROR + "CPP_BINDINGS_LINUX_STATIC_CXX_RUNTIME currently requires GCC" + ) + endif() + + target_link_options( + cpp_bindings_linux + PRIVATE + -static-libstdc++ + -static-libgcc + "LINKER:--exclude-libs,ALL" + ) +endif() file(GLOB SRC_UNIT_TESTS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.test.cpp") file(GLOB TESTS_INTEGRATION "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.test.cpp") @@ -197,6 +244,7 @@ if(TEST_SOURCES) ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/generated + ${cpp_core_SOURCE_DIR}/include ) target_link_libraries( diff --git a/README.md b/README.md index c72610c0..a1fea523 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ configuring, reading from, and writing to serial ports. - Git - CMake 3.30 or newer - Ninja -- A compiler with C++26 support (CI uses GCC 16) +- A compiler with sufficient C++26 support CMake downloads `cpp-core` and GoogleTest automatically during configuration. @@ -28,12 +28,34 @@ cmake --build --preset linux-gcc-release --target cpp_bindings_linux The shared library is written to `build/libcpp_bindings_linux.so`. +Official release and JSR artifacts are built for these GNU/Linux targets: + +| Target | CPU baseline | Minimum glibc | +| --- | --- | --- | +| `linux-x86_64-gnu` | generic x86-64 | 2.28 | +| `linux-aarch64-gnu` | ARMv8-A | 2.28 | + +The release builds statically include the GNU C++ and compiler runtimes. They +still use the target system's glibc and therefore require glibc 2.28 or newer. +To reproduce the portable release configuration for the host architecture: + +```sh +cmake -S . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCPP_BINDINGS_LINUX_PORTABLE_CPU_BASELINE=ON \ + -DCPP_BINDINGS_LINUX_STATIC_CXX_RUNTIME=ON +cmake --build build --target cpp_bindings_linux +``` + +The CI release builds use pinned `manylinux_2_28` images with GCC 14. GCC 16 +is used separately to generate the ASTrein FFI metadata. + To select a specific compiler, add it while configuring, for example: ```sh cmake --preset linux-gcc-release \ - -DCMAKE_C_COMPILER=gcc-16 \ - -DCMAKE_CXX_COMPILER=g++-16 + -DCMAKE_C_COMPILER=gcc-14 \ + -DCMAKE_CXX_COMPILER=g++-14 ``` ## Tests diff --git a/jsr/README.md b/jsr/README.md index bfac12ea..dbb135df 100644 --- a/jsr/README.md +++ b/jsr/README.md @@ -5,8 +5,13 @@ Binaries are provided as a [package on JSR](https://jsr.io/@serial/cpp-bindings-linux). They are serialized as a base64 string inside the JSON file. -The package also includes cpp-core FFI API metadata generated with -[ASTrein](https://github.com/Katze719/ASTrein) at `bin/x86_64.ffi.json`. +The package contains portable binaries for `linux-x86_64-gnu` and +`linux-aarch64-gnu`, both requiring glibc 2.28 or newer. The x86-64 artifact +uses the generic x86-64 baseline. + +It also includes cpp-core FFI API metadata generated with +[ASTrein](https://github.com/Katze719/ASTrein) at `bin/x86_64.ffi.json` and +`bin/aarch64.ffi.json`. It describes the exported C symbols, parameter and return types, callbacks, default values, and API documentation used by downstream FFI adapter generators. @@ -18,9 +23,10 @@ This package is primarily intended as a dependency for [`@serial/serial`](https: Import the JSON and write the binary data to disk: ```ts -import {x86_64} from '@serial/cpp-bindings-linux/bin'; +import {aarch64, x86_64} from '@serial/cpp-bindings-linux/bin'; -Deno.writeFileSync(`./${x86_64.filename}`, Uint8Array.fromBase64(x86_64.data)); +const binary = Deno.build.arch === "aarch64" ? aarch64 : x86_64; +Deno.writeFileSync(`./${binary.filename}`, Uint8Array.fromBase64(binary.data)); // Now you can open the binary using for example `Deno.dlopen`... ``` diff --git a/jsr/src/bin/index.ts b/jsr/src/bin/index.ts index 66555bc7..277fda8b 100644 --- a/jsr/src/bin/index.ts +++ b/jsr/src/bin/index.ts @@ -5,13 +5,15 @@ * Import the corresponding binary and write the file to disk. * * ```ts - * import {x86_64} from '@serial/cpp-bindings-linux/bin' + * import {aarch64, x86_64} from '@serial/cpp-bindings-linux/bin' * - * Deno.writeFileSync(`./${x86_64.filename}`, Uint8Array.fromBase64(x86_64.data)) + * const binary = Deno.build.arch === "aarch64" ? aarch64 : x86_64 + * Deno.writeFileSync(`./${binary.filename}`, Uint8Array.fromBase64(binary.data)) * ``` * @module */ +import aarch64 from '../../bin/aarch64.json' with { type: "json" } import x86_64 from '../../bin/x86_64.json' with { type: "json" } -export {x86_64} +export {aarch64, x86_64} diff --git a/scripts/verify_release_binary.sh b/scripts/verify_release_binary.sh new file mode 100755 index 00000000..a86b2680 --- /dev/null +++ b/scripts/verify_release_binary.sh @@ -0,0 +1,63 @@ +#!/bin/sh +set -eu + +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +BINARY_PATH=$1 +TARGET=$2 +MAX_GLIBC_VERSION=2.28 + +if [ ! -f "$BINARY_PATH" ]; then + echo "Binary does not exist: $BINARY_PATH" >&2 + exit 1 +fi + +case "$TARGET" in + linux-x86_64-gnu) + EXPECTED_MACHINE="Advanced Micro Devices X86-64" + ;; + linux-aarch64-gnu) + EXPECTED_MACHINE="AArch64" + ;; + *) + echo "Unsupported target: $TARGET" >&2 + exit 1 + ;; +esac + +ACTUAL_MACHINE=$(readelf --file-header "$BINARY_PATH" | sed -n 's/^ *Machine: *//p') +if [ "$ACTUAL_MACHINE" != "$EXPECTED_MACHINE" ]; then + echo "Expected ELF machine '$EXPECTED_MACHINE', got '$ACTUAL_MACHINE'" >&2 + exit 1 +fi + +if readelf --dynamic "$BINARY_PATH" | grep -Eq 'Shared library: \[(libstdc\+\+|libgcc_s)'; then + echo "Release binary must not depend on the target system's C++ or GCC runtime" >&2 + exit 1 +fi + +GLIBC_VERSIONS=$(readelf --version-info "$BINARY_PATH" | grep -o 'GLIBC_[0-9][0-9.]*' || true) +if [ -n "$GLIBC_VERSIONS" ]; then + HIGHEST_GLIBC_VERSION=$(printf '%s\n' "$GLIBC_VERSIONS" | sed 's/^GLIBC_//' | sort -Vu | tail -n 1) + HIGHEST_ALLOWED_VERSION=$(printf '%s\n%s\n' "$MAX_GLIBC_VERSION" "$HIGHEST_GLIBC_VERSION" | sort -Vu | tail -n 1) + + if [ "$HIGHEST_ALLOWED_VERSION" != "$MAX_GLIBC_VERSION" ]; then + echo "Release binary requires glibc $HIGHEST_GLIBC_VERSION; maximum is $MAX_GLIBC_VERSION" >&2 + exit 1 + fi +else + HIGHEST_GLIBC_VERSION=none +fi + +if [ "$TARGET" = "linux-x86_64-gnu" ]; then + X86_PROPERTIES=$(readelf --notes "$BINARY_PATH" 2>/dev/null) + if printf '%s\n' "$X86_PROPERTIES" | grep -Eq 'x86-64-v[234]'; then + echo "x86-64 release binary requires a higher-than-baseline ISA" >&2 + exit 1 + fi +fi + +echo "Verified $TARGET: machine=$ACTUAL_MACHINE, max-glibc=$HIGHEST_GLIBC_VERSION" From a7f98f64512ba5f04f9a0e21e1abdd515905a2d3 Mon Sep 17 00:00:00 2001 From: Katze719 Date: Wed, 26 Aug 2026 14:51:59 +0200 Subject: [PATCH 02/15] fix: limit Deno CI to library target --- .github/workflows/test_deno.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_deno.yml b/.github/workflows/test_deno.yml index 7854a4ae..bb9a237e 100644 --- a/.github/workflows/test_deno.yml +++ b/.github/workflows/test_deno.yml @@ -50,7 +50,7 @@ jobs: - name: Build run: | - cmake --build build --config Release + cmake --build build --config Release --target cpp_bindings_linux - name: Start virtual serial echo (socat) run: | From bbde907664039268694c29754fc7b7fa2066f38f Mon Sep 17 00:00:00 2001 From: Katze719 Date: Wed, 26 Aug 2026 16:18:51 +0200 Subject: [PATCH 03/15] fix: generate metadata for each Linux target --- .github/workflows/build_binary.yml | 82 +++++++++++++++++++----------- .github/workflows/publish_jsr.yml | 10 ++-- README.md | 4 +- jsr/README.md | 4 +- scripts/verify_release_binary.sh | 8 +-- 5 files changed, 65 insertions(+), 43 deletions(-) diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index 9ebd3195..9c0a8d8b 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -24,11 +24,14 @@ jobs: with: fetch-depth: 0 - - name: 'Setup GCC' - uses: egor-tensin/setup-gcc@v2 - with: - version: '16' - platform: 'x64' + - name: 'Install native and cross compilers' + run: | + sudo apt-get update + sudo apt-get install -y \ + gcc-14 \ + g++-14 \ + gcc-14-aarch64-linux-gnu \ + g++-14-aarch64-linux-gnu - name: 'Download ASTrein' run: | @@ -48,23 +51,39 @@ jobs: with: cmake-version: '3.31.x' - - name: 'Configure CMake' + - name: 'Configure x86-64 metadata context' + run: | + cmake -S . -B build/ffi/x86_64 -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=gcc-14 \ + -DCMAKE_CXX_COMPILER=g++-14 \ + -DCPP_BINDINGS_LINUX_ENABLE_FFI_JSON_EXPORT=ON \ + -DCPP_BINDINGS_LINUX_ASTREIN_EXECUTABLE="${RUNNER_TEMP}/astrein/bin/astrein" \ + -DCPP_BINDINGS_LINUX_FFI_JSON_OUTPUT="${GITHUB_WORKSPACE}/dist/ffi/x86_64.ffi.json" + + - name: 'Configure AArch64 metadata context' run: | - cmake --preset linux-gcc-release \ - -DCMAKE_C_COMPILER=gcc-16 \ - -DCMAKE_CXX_COMPILER=g++-16 \ + cmake -S . -B build/ffi/aarch64 -G Ninja \ + -DCMAKE_SYSTEM_NAME=Linux \ + -DCMAKE_SYSTEM_PROCESSOR=aarch64 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc-14 \ + -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++-14 \ -DCPP_BINDINGS_LINUX_ENABLE_FFI_JSON_EXPORT=ON \ - -DCPP_BINDINGS_LINUX_ASTREIN_EXECUTABLE="${RUNNER_TEMP}/astrein/bin/astrein" + -DCPP_BINDINGS_LINUX_ASTREIN_EXECUTABLE="${RUNNER_TEMP}/astrein/bin/astrein" \ + -DCPP_BINDINGS_LINUX_FFI_JSON_OUTPUT="${GITHUB_WORKSPACE}/dist/ffi/aarch64.ffi.json" - - name: 'Generate metadata' + - name: 'Generate target-specific metadata' run: | - cmake --build --preset linux-gcc-release \ + cmake --build build/ffi/x86_64 \ + --target cpp_bindings_linux_ffi_json + cmake --build build/ffi/aarch64 \ --target cpp_bindings_linux_ffi_json - name: 'Set package version' id: version run: | - . build/env.sh + . build/ffi/x86_64/env.sh echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> "${GITHUB_OUTPUT}" - name: 'Check package version' @@ -85,7 +104,7 @@ jobs: with: if-no-files-found: error name: cpp-bindings-linux-ffi - path: build/cpp_bindings_linux.ffi.json + path: dist/ffi/*.ffi.json build-binary: name: 'Build ${{ matrix.target }}' @@ -96,14 +115,14 @@ jobs: fail-fast: false matrix: include: - - target: linux-x86_64-gnu + - target: x86_64-linux-gnu runner: ubuntu-24.04 image: quay.io/pypa/manylinux_2_28_x86_64@sha256:4dc41da7df20400310c80d162a2fe2d2c2f3d9734d8dec20f6b9843711618deb - artifact: libcpp_bindings_linux-linux-x86_64-gnu - - target: linux-aarch64-gnu + artifact: libcpp_bindings_linux-x86_64-linux-gnu + - target: aarch64-linux-gnu runner: ubuntu-24.04-arm image: quay.io/pypa/manylinux_2_28_aarch64@sha256:29a6ceb78de5b00494e6e7456a72782a4cb54238de102e7491d15fe47789b4d1 - artifact: libcpp_bindings_linux-linux-aarch64-gnu + artifact: libcpp_bindings_linux-aarch64-linux-gnu steps: - name: 'Checkout repository' @@ -158,7 +177,7 @@ jobs: needs: ['build-binary'] uses: './.github/workflows/test_unit_cpp.yml' with: - artifact-name: libcpp_bindings_linux-linux-x86_64-gnu + artifact-name: libcpp_bindings_linux-x86_64-linux-gnu permissions: contents: read checks: write @@ -175,13 +194,13 @@ jobs: - name: 'Download x86-64 binary' uses: actions/download-artifact@v4 with: - name: libcpp_bindings_linux-linux-x86_64-gnu + name: libcpp_bindings_linux-x86_64-linux-gnu path: release/x86_64 - name: 'Download AArch64 binary' uses: actions/download-artifact@v4 with: - name: libcpp_bindings_linux-linux-aarch64-gnu + name: libcpp_bindings_linux-aarch64-linux-gnu path: release/aarch64 - name: 'Download FFI metadata' @@ -193,11 +212,13 @@ jobs: - name: 'Name release assets' run: | mv release/x86_64/libcpp_bindings_linux.so \ - release/libcpp_bindings_linux-linux-x86_64-gnu.so + release/libcpp_bindings_linux-x86_64-linux-gnu.so mv release/aarch64/libcpp_bindings_linux.so \ - release/libcpp_bindings_linux-linux-aarch64-gnu.so - mv release/ffi/cpp_bindings_linux.ffi.json \ - release/cpp_bindings_linux.ffi.json + release/libcpp_bindings_linux-aarch64-linux-gnu.so + mv release/ffi/x86_64.ffi.json \ + release/cpp_bindings_linux-x86_64-linux-gnu.ffi.json + mv release/ffi/aarch64.ffi.json \ + release/cpp_bindings_linux-aarch64-linux-gnu.ffi.json - name: 'Create GitHub release' uses: softprops/action-gh-release@v2 @@ -206,9 +227,10 @@ jobs: tag_name: ${{ github.ref_name }} generate_release_notes: true files: | - release/libcpp_bindings_linux-linux-x86_64-gnu.so - release/libcpp_bindings_linux-linux-aarch64-gnu.so - release/cpp_bindings_linux.ffi.json + release/libcpp_bindings_linux-x86_64-linux-gnu.so + release/libcpp_bindings_linux-aarch64-linux-gnu.so + release/cpp_bindings_linux-x86_64-linux-gnu.ffi.json + release/cpp_bindings_linux-aarch64-linux-gnu.ffi.json publish-jsr: name: 'Run: Publish JSR' @@ -217,8 +239,8 @@ jobs: with: publish: ${{ needs.generate-metadata.outputs.is_valid_package_version == 'true' }} version: ${{ needs.generate-metadata.outputs.package_version }} - x86-64-artifact-name: libcpp_bindings_linux-linux-x86_64-gnu - aarch64-artifact-name: libcpp_bindings_linux-linux-aarch64-gnu + x86-64-artifact-name: libcpp_bindings_linux-x86_64-linux-gnu + aarch64-artifact-name: libcpp_bindings_linux-aarch64-linux-gnu ffi-artifact-name: cpp-bindings-linux-ffi permissions: contents: read diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index c6323975..7307094b 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -24,7 +24,7 @@ on: type: string ffi-artifact-name: - description: 'Name of the shared FFI metadata artifact' + description: 'Name of the target-specific FFI metadata artifact' required: true type: string @@ -70,18 +70,18 @@ jobs: mkdir -p ./jsr/bin cp ./artifacts/x86_64/libcpp_bindings_linux.so ./jsr/bin/x86_64.so cp ./artifacts/aarch64/libcpp_bindings_linux.so ./jsr/bin/aarch64.so - cp ./artifacts/ffi/cpp_bindings_linux.ffi.json ./jsr/bin/x86_64.ffi.json - cp ./artifacts/ffi/cpp_bindings_linux.ffi.json ./jsr/bin/aarch64.ffi.json + cp ./artifacts/ffi/x86_64.ffi.json ./jsr/bin/x86_64.ffi.json + cp ./artifacts/ffi/aarch64.ffi.json ./jsr/bin/aarch64.ffi.json ./jsr/scripts/binary_to_json.sh \ ./jsr/bin/x86_64.so \ ./jsr/bin/x86_64.json \ - linux-x86_64-gnu + x86_64-linux-gnu ./jsr/scripts/binary_to_json.sh \ ./jsr/bin/aarch64.so \ ./jsr/bin/aarch64.json \ - linux-aarch64-gnu + aarch64-linux-gnu ./jsr/scripts/set_version.sh \ jsr/jsr.json \ diff --git a/README.md b/README.md index a1fea523..22ebb031 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ Official release and JSR artifacts are built for these GNU/Linux targets: | Target | CPU baseline | Minimum glibc | | --- | --- | --- | -| `linux-x86_64-gnu` | generic x86-64 | 2.28 | -| `linux-aarch64-gnu` | ARMv8-A | 2.28 | +| `x86_64-linux-gnu` | generic x86-64 | 2.28 | +| `aarch64-linux-gnu` | ARMv8-A | 2.28 | The release builds statically include the GNU C++ and compiler runtimes. They still use the target system's glibc and therefore require glibc 2.28 or newer. diff --git a/jsr/README.md b/jsr/README.md index dbb135df..e4f9893d 100644 --- a/jsr/README.md +++ b/jsr/README.md @@ -5,8 +5,8 @@ Binaries are provided as a [package on JSR](https://jsr.io/@serial/cpp-bindings-linux). They are serialized as a base64 string inside the JSON file. -The package contains portable binaries for `linux-x86_64-gnu` and -`linux-aarch64-gnu`, both requiring glibc 2.28 or newer. The x86-64 artifact +The package contains portable binaries for `x86_64-linux-gnu` and +`aarch64-linux-gnu`, both requiring glibc 2.28 or newer. The x86-64 artifact uses the generic x86-64 baseline. It also includes cpp-core FFI API metadata generated with diff --git a/scripts/verify_release_binary.sh b/scripts/verify_release_binary.sh index a86b2680..09b553d3 100755 --- a/scripts/verify_release_binary.sh +++ b/scripts/verify_release_binary.sh @@ -2,7 +2,7 @@ set -eu if [ "$#" -ne 2 ]; then - echo "Usage: $0 " >&2 + echo "Usage: $0 " >&2 exit 1 fi @@ -16,10 +16,10 @@ if [ ! -f "$BINARY_PATH" ]; then fi case "$TARGET" in - linux-x86_64-gnu) + x86_64-linux-gnu) EXPECTED_MACHINE="Advanced Micro Devices X86-64" ;; - linux-aarch64-gnu) + aarch64-linux-gnu) EXPECTED_MACHINE="AArch64" ;; *) @@ -52,7 +52,7 @@ else HIGHEST_GLIBC_VERSION=none fi -if [ "$TARGET" = "linux-x86_64-gnu" ]; then +if [ "$TARGET" = "x86_64-linux-gnu" ]; then X86_PROPERTIES=$(readelf --notes "$BINARY_PATH" 2>/dev/null) if printf '%s\n' "$X86_PROPERTIES" | grep -Eq 'x86-64-v[234]'; then echo "x86-64 release binary requires a higher-than-baseline ISA" >&2 From f36b5fd0d69b7fbca7177470ee19b0c36b971cbf Mon Sep 17 00:00:00 2001 From: Katze719 Date: Wed, 26 Aug 2026 16:31:59 +0200 Subject: [PATCH 04/15] ci: prepare native ASTrein 1.2 metadata --- .github/workflows/build_binary.yml | 112 +++++++++++++++++++---------- 1 file changed, 76 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index 9c0a8d8b..aaad1656 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -8,15 +8,26 @@ on: branches: ['*'] jobs: - generate-metadata: - name: 'Generate FFI metadata' - runs-on: ubuntu-24.04 + generate-target-metadata: + name: 'Generate FFI metadata (${{ matrix.target }})' + runs-on: ${{ matrix.runner }} env: - ASTREIN_VERSION: '1.1.0' - ASTREIN_SHA256: 'd5964319ea5a3742e4d7223ee5963d6aa3b24c8f67ef75c61d591c635f413497' - outputs: - package_version: ${{ steps.version.outputs.PACKAGE_VERSION }} - is_valid_package_version: ${{ steps.check-tag.outputs.IS_VALID_PACKAGE_VERSION }} + ASTREIN_VERSION: '1.2.0' + ASTREIN_SHA256: ${{ matrix.astrein-sha256 }} + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-linux-gnu + arch: x86_64 + runner: ubuntu-24.04 + astrein-archive: astrein-linux-x86_64.tar.gz + astrein-sha256: TODO_SET_AFTER_ASTREIN_V1_2_0_RELEASE + - target: aarch64-linux-gnu + arch: aarch64 + runner: ubuntu-24.04-arm + astrein-archive: astrein-linux-aarch64.tar.gz + astrein-sha256: TODO_SET_AFTER_ASTREIN_V1_2_0_RELEASE steps: - name: 'Checkout repository' @@ -24,24 +35,29 @@ jobs: with: fetch-depth: 0 - - name: 'Install native and cross compilers' + - name: 'Validate ASTrein checksum' + run: | + if [[ ! "${ASTREIN_SHA256}" =~ ^[[:xdigit:]]{64}$ ]]; then + echo "Set the SHA-256 for ${{ matrix.astrein-archive }} after ASTrein v${ASTREIN_VERSION} is released." >&2 + exit 1 + fi + + - name: 'Install native compiler' run: | sudo apt-get update sudo apt-get install -y \ gcc-14 \ - g++-14 \ - gcc-14-aarch64-linux-gnu \ - g++-14-aarch64-linux-gnu + g++-14 - name: 'Download ASTrein' run: | curl --fail --location \ - --output "${RUNNER_TEMP}/astrein-linux-x86_64.tar.gz" \ - "https://github.com/Katze719/ASTrein/releases/download/v${ASTREIN_VERSION}/astrein-linux-x86_64.tar.gz" - echo "${ASTREIN_SHA256} ${RUNNER_TEMP}/astrein-linux-x86_64.tar.gz" \ + --output "${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ + "https://github.com/Katze719/ASTrein/releases/download/v${ASTREIN_VERSION}/${{ matrix.astrein-archive }}" + echo "${ASTREIN_SHA256} ${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ | sha256sum --check - mkdir -p "${RUNNER_TEMP}/astrein" - tar -xzf "${RUNNER_TEMP}/astrein-linux-x86_64.tar.gz" \ + tar -xzf "${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ -C "${RUNNER_TEMP}/astrein" \ --strip-components=1 "${RUNNER_TEMP}/astrein/bin/astrein" --version @@ -51,39 +67,56 @@ jobs: with: cmake-version: '3.31.x' - - name: 'Configure x86-64 metadata context' + - name: 'Configure native metadata context' run: | - cmake -S . -B build/ffi/x86_64 -G Ninja \ + cmake -S . -B "build/ffi/${{ matrix.arch }}" -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=gcc-14 \ -DCMAKE_CXX_COMPILER=g++-14 \ -DCPP_BINDINGS_LINUX_ENABLE_FFI_JSON_EXPORT=ON \ -DCPP_BINDINGS_LINUX_ASTREIN_EXECUTABLE="${RUNNER_TEMP}/astrein/bin/astrein" \ - -DCPP_BINDINGS_LINUX_FFI_JSON_OUTPUT="${GITHUB_WORKSPACE}/dist/ffi/x86_64.ffi.json" + -DCPP_BINDINGS_LINUX_FFI_JSON_OUTPUT="${GITHUB_WORKSPACE}/dist/ffi/${{ matrix.arch }}.ffi.json" - - name: 'Configure AArch64 metadata context' + - name: 'Generate metadata' run: | - cmake -S . -B build/ffi/aarch64 -G Ninja \ - -DCMAKE_SYSTEM_NAME=Linux \ - -DCMAKE_SYSTEM_PROCESSOR=aarch64 \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc-14 \ - -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++-14 \ - -DCPP_BINDINGS_LINUX_ENABLE_FFI_JSON_EXPORT=ON \ - -DCPP_BINDINGS_LINUX_ASTREIN_EXECUTABLE="${RUNNER_TEMP}/astrein/bin/astrein" \ - -DCPP_BINDINGS_LINUX_FFI_JSON_OUTPUT="${GITHUB_WORKSPACE}/dist/ffi/aarch64.ffi.json" + cmake --build "build/ffi/${{ matrix.arch }}" \ + --target cpp_bindings_linux_ffi_json - - name: 'Generate target-specific metadata' + - name: 'Upload target-specific FFI metadata' + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + name: cpp-bindings-linux-ffi-${{ matrix.target }} + path: dist/ffi/${{ matrix.arch }}.ffi.json + + generate-metadata: + name: 'Collect FFI metadata' + needs: ['generate-target-metadata'] + runs-on: ubuntu-24.04 + outputs: + package_version: ${{ steps.version.outputs.PACKAGE_VERSION }} + is_valid_package_version: ${{ steps.check-tag.outputs.IS_VALID_PACKAGE_VERSION }} + + steps: + - name: 'Checkout repository' + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 'Setup CMake' + uses: jwlawson/actions-setup-cmake@v2 + with: + cmake-version: '3.31.x' + + - name: 'Configure package context' run: | - cmake --build build/ffi/x86_64 \ - --target cpp_bindings_linux_ffi_json - cmake --build build/ffi/aarch64 \ - --target cpp_bindings_linux_ffi_json + cmake -S . -B build/package -G Ninja \ + -DCMAKE_BUILD_TYPE=Release - name: 'Set package version' id: version run: | - . build/ffi/x86_64/env.sh + . build/package/env.sh echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> "${GITHUB_OUTPUT}" - name: 'Check package version' @@ -99,7 +132,14 @@ jobs: echo "IS_VALID_PACKAGE_VERSION=false" >> "${GITHUB_OUTPUT}" fi - - name: 'Upload FFI metadata' + - name: 'Download target-specific FFI metadata' + uses: actions/download-artifact@v4 + with: + pattern: cpp-bindings-linux-ffi-* + path: dist/ffi + merge-multiple: true + + - name: 'Upload combined FFI metadata' uses: actions/upload-artifact@v4 with: if-no-files-found: error From 7db9d3b1dea99be32551a26d303c39d828b5b610 Mon Sep 17 00:00:00 2001 From: Katze719 <38188106+Katze719@users.noreply.github.com> Date: Wed, 26 Aug 2026 20:20:58 +0200 Subject: [PATCH 05/15] Apply suggestions from code review Co-authored-by: Katze719 <38188106+Katze719@users.noreply.github.com> --- .github/workflows/build_binary.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index aaad1656..f4f10010 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -22,12 +22,12 @@ jobs: arch: x86_64 runner: ubuntu-24.04 astrein-archive: astrein-linux-x86_64.tar.gz - astrein-sha256: TODO_SET_AFTER_ASTREIN_V1_2_0_RELEASE + astrein-sha256: 'cd0bb42f883322d9b7bbf1a34b57acfab83bcf78cf529a5cd122234fc8787582' - target: aarch64-linux-gnu arch: aarch64 runner: ubuntu-24.04-arm astrein-archive: astrein-linux-aarch64.tar.gz - astrein-sha256: TODO_SET_AFTER_ASTREIN_V1_2_0_RELEASE + astrein-sha256: '6e53ac2f5a8b341e7a49439129790f4b1b82d5073a98ddf44a189fe9a9ebf732' steps: - name: 'Checkout repository' From c8461c4e925f318011555656764fca078eac3014 Mon Sep 17 00:00:00 2001 From: Katze719 Date: Wed, 26 Aug 2026 20:30:46 +0200 Subject: [PATCH 06/15] feat: add installation of gcc-14 and g++-14 for package context compilation --- .github/workflows/build_binary.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index f4f10010..811965f8 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -108,10 +108,19 @@ jobs: with: cmake-version: '3.31.x' + - name: 'Install package-context compiler' + run: | + sudo apt-get update + sudo apt-get install -y \ + gcc-14 \ + g++-14 + - name: 'Configure package context' run: | cmake -S . -B build/package -G Ninja \ - -DCMAKE_BUILD_TYPE=Release + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=gcc-14 \ + -DCMAKE_CXX_COMPILER=g++-14 - name: 'Set package version' id: version From deb2960fa5b32b611b92f85912988c758474316e Mon Sep 17 00:00:00 2001 From: Katze719 Date: Fri, 28 Aug 2026 13:54:55 +0200 Subject: [PATCH 07/15] feat: add descriptions to workflow files for clarity --- .github/workflows/block_pr_check_labels.yml | 3 +++ .github/workflows/build_binary.yml | 3 +++ .github/workflows/publish_jsr.yml | 3 +++ .github/workflows/test_unit_cpp.yml | 2 ++ 4 files changed, 11 insertions(+) diff --git a/.github/workflows/block_pr_check_labels.yml b/.github/workflows/block_pr_check_labels.yml index 3a85c18e..6d4041f5 100644 --- a/.github/workflows/block_pr_check_labels.yml +++ b/.github/workflows/block_pr_check_labels.yml @@ -1,4 +1,7 @@ name: 'Block PR Check Labels' +description: | + This workflow checks for specific labels and if a forbidden label exists, fails the pipeline, + thus preventing the merge. on: pull_request: diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index 811965f8..9cd0b701 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -1,4 +1,7 @@ name: 'Build Binary' +description: | + This workflow builds the binary files for Linux. The build binaries are stored as artifact + and may be reused by other workflows. on: push: diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index 7307094b..f44ff9da 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -1,4 +1,7 @@ name: 'Publish JSR' +description: | + This workflow serializes the build binary to Base64 and generates a JSON file with meta data about the file. + The file then gets published to JSR (@serial/cpp-bindings-linux). on: workflow_call: diff --git a/.github/workflows/test_unit_cpp.yml b/.github/workflows/test_unit_cpp.yml index 23ca9028..e3c88e73 100644 --- a/.github/workflows/test_unit_cpp.yml +++ b/.github/workflows/test_unit_cpp.yml @@ -1,4 +1,6 @@ name: 'Test Unit C++' +description: | + This workflow builds the library and runs the unit tests. on: workflow_call: From c68863b05f3996f772ed45dd47a259136ad4935f Mon Sep 17 00:00:00 2001 From: Katze719 Date: Fri, 28 Aug 2026 18:56:12 +0200 Subject: [PATCH 08/15] feat: update JSR publishing workflow and README for improved structure and clarity --- .github/workflows/publish_jsr.yml | 18 ++++++------- jsr/README.md | 27 ++++++++++++-------- jsr/src/bin/index.ts | 42 +++++++++++++++++++++++-------- 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index f44ff9da..ced5980f 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -70,20 +70,20 @@ jobs: - name: 'Prepare files for JSR' run: | - mkdir -p ./jsr/bin - cp ./artifacts/x86_64/libcpp_bindings_linux.so ./jsr/bin/x86_64.so - cp ./artifacts/aarch64/libcpp_bindings_linux.so ./jsr/bin/aarch64.so - cp ./artifacts/ffi/x86_64.ffi.json ./jsr/bin/x86_64.ffi.json - cp ./artifacts/ffi/aarch64.ffi.json ./jsr/bin/aarch64.ffi.json + mkdir -p ./jsr/bin/x86_64 ./jsr/bin/aarch64 + cp ./artifacts/x86_64/libcpp_bindings_linux.so ./jsr/bin/x86_64/library.so + cp ./artifacts/aarch64/libcpp_bindings_linux.so ./jsr/bin/aarch64/library.so + cp ./artifacts/ffi/x86_64.ffi.json ./jsr/bin/x86_64/ffi.json + cp ./artifacts/ffi/aarch64.ffi.json ./jsr/bin/aarch64/ffi.json ./jsr/scripts/binary_to_json.sh \ - ./jsr/bin/x86_64.so \ - ./jsr/bin/x86_64.json \ + ./jsr/bin/x86_64/library.so \ + ./jsr/bin/x86_64/library.json \ x86_64-linux-gnu ./jsr/scripts/binary_to_json.sh \ - ./jsr/bin/aarch64.so \ - ./jsr/bin/aarch64.json \ + ./jsr/bin/aarch64/library.so \ + ./jsr/bin/aarch64/library.json \ aarch64-linux-gnu ./jsr/scripts/set_version.sh \ diff --git a/jsr/README.md b/jsr/README.md index e4f9893d..228a6e71 100644 --- a/jsr/README.md +++ b/jsr/README.md @@ -3,33 +3,40 @@ [![Build Binary](https://github.com/Serial-IO/cpp-bindings-linux/actions/workflows/build_binary.yml/badge.svg)](https://github.com/Serial-IO/cpp-bindings-linux/actions/workflows/build_binary.yml) [![JSR](https://jsr.io/badges/@serial/cpp-bindings-linux)](https://jsr.io/@serial/cpp-bindings-linux) -Binaries are provided as a [package on JSR](https://jsr.io/@serial/cpp-bindings-linux). They are serialized as a base64 string inside the JSON file. +Binaries are provided as a +[package on JSR](https://jsr.io/@serial/cpp-bindings-linux). They are serialized +as a base64 string inside the JSON file. The package contains portable binaries for `x86_64-linux-gnu` and `aarch64-linux-gnu`, both requiring glibc 2.28 or newer. The x86-64 artifact uses the generic x86-64 baseline. It also includes cpp-core FFI API metadata generated with -[ASTrein](https://github.com/Katze719/ASTrein) at `bin/x86_64.ffi.json` and -`bin/aarch64.ffi.json`. -It describes the exported C symbols, parameter and return types, callbacks, -default values, and API documentation used by downstream FFI adapter generators. - -This package is primarily intended as a dependency for [`@serial/serial`](https://jsr.io/@serial/serial). However, it can also be used independently. +[ASTrein](https://github.com/Katze719/ASTrein) at `bin/x86_64/ffi.json` and +`bin/aarch64/ffi.json`. It describes the exported C symbols, parameter and +return types, callbacks, default values, and API documentation used by +downstream FFI adapter generators. +This package is primarily intended as a dependency for +[`@serial/serial`](https://jsr.io/@serial/serial). However, it can also be used +independently. ## Usage -Import the JSON and write the binary data to disk: +Import the JSON and write the binary data to disk. Each architecture export also +contains its matching FFI metadata: ```ts -import {aarch64, x86_64} from '@serial/cpp-bindings-linux/bin'; +import { aarch64, x86_64 } from "@serial/cpp-bindings-linux/bin"; const binary = Deno.build.arch === "aarch64" ? aarch64 : x86_64; Deno.writeFileSync(`./${binary.filename}`, Uint8Array.fromBase64(binary.data)); +// The matching FFI metadata is available as `binary.ffi`. // Now you can open the binary using for example `Deno.dlopen`... ``` > [!NOTE] -> For a more in depth guide, check out the [Wiki](https://github.com/Serial-IO/cpp-bindings-linux/wiki) section on how to use the C++ bindings for Linux. +> For a more in depth guide, check out the +> [Wiki](https://github.com/Serial-IO/cpp-bindings-linux/wiki) section on how to +> use the C++ bindings for Linux. diff --git a/jsr/src/bin/index.ts b/jsr/src/bin/index.ts index 277fda8b..1388fc2c 100644 --- a/jsr/src/bin/index.ts +++ b/jsr/src/bin/index.ts @@ -1,19 +1,41 @@ /** - * Module that provides exports for serialized binary files. - * + * Module that provides serialized binaries and FFI metadata. + * * @example * Import the corresponding binary and write the file to disk. - * + * * ```ts - * import {aarch64, x86_64} from '@serial/cpp-bindings-linux/bin' - * - * const binary = Deno.build.arch === "aarch64" ? aarch64 : x86_64 - * Deno.writeFileSync(`./${binary.filename}`, Uint8Array.fromBase64(binary.data)) + * import { aarch64, x86_64 } from "@serial/cpp-bindings-linux/bin"; + * + * const binary = Deno.build.arch === "aarch64" ? aarch64 : x86_64; + * + * Deno.writeFileSync( + * `./${binary.filename}`, + * Uint8Array.fromBase64(binary.data), + * ); + * + * // The matching FFI metadata is available as `binary.ffi`. * ``` * @module */ -import aarch64 from '../../bin/aarch64.json' with { type: "json" } -import x86_64 from '../../bin/x86_64.json' with { type: "json" } +import aarch64Library from "../../bin/aarch64/library.json" with { + type: "json", +}; +import aarch64ffi from "../../bin/aarch64/ffi.json" with { type: "json" }; +import x86_64Library from "../../bin/x86_64/library.json" with { + type: "json", +}; +import x86_64ffi from "../../bin/x86_64/ffi.json" with { type: "json" }; -export {aarch64, x86_64} +const aarch64 = { + ...aarch64Library, + ffi: aarch64ffi, +}; + +const x86_64 = { + ...x86_64Library, + ffi: x86_64ffi, +}; + +export { aarch64, x86_64 }; From 44480f529d17db67625817557c47f8c125f21be3 Mon Sep 17 00:00:00 2001 From: Katze719 <38188106+Katze719@users.noreply.github.com> Date: Fri, 28 Aug 2026 19:40:27 +0200 Subject: [PATCH 09/15] Update .github/workflows/build_binary.yml Co-authored-by: Mqx <62719703+Mqxx@users.noreply.github.com> --- .github/workflows/build_binary.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index 9cd0b701..1baa56c7 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -57,7 +57,7 @@ jobs: curl --fail --location \ --output "${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ "https://github.com/Katze719/ASTrein/releases/download/v${ASTREIN_VERSION}/${{ matrix.astrein-archive }}" - echo "${ASTREIN_SHA256} ${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ + echo "${ASTREIN_SHA256} ${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ | sha256sum --check - mkdir -p "${RUNNER_TEMP}/astrein" tar -xzf "${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ From 15b15bcc6fefefac249996355236a21e1576bebf Mon Sep 17 00:00:00 2001 From: Mqx <62719703+Mqxx@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:02:28 +0200 Subject: [PATCH 10/15] fix: format --- jsr/src/bin/index.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/jsr/src/bin/index.ts b/jsr/src/bin/index.ts index 1388fc2c..e73e8096 100644 --- a/jsr/src/bin/index.ts +++ b/jsr/src/bin/index.ts @@ -19,13 +19,9 @@ * @module */ -import aarch64Library from "../../bin/aarch64/library.json" with { - type: "json", -}; +import aarch64Library from "../../bin/aarch64/library.json" with { type: "json" }; import aarch64ffi from "../../bin/aarch64/ffi.json" with { type: "json" }; -import x86_64Library from "../../bin/x86_64/library.json" with { - type: "json", -}; +import x86_64Library from "../../bin/x86_64/library.json" with { type: "json" }; import x86_64ffi from "../../bin/x86_64/ffi.json" with { type: "json" }; const aarch64 = { From c727acc3a94d5328fa87fba7e93467475c626fcc Mon Sep 17 00:00:00 2001 From: Mqx <62719703+Mqxx@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:29:10 +0200 Subject: [PATCH 11/15] fix: format --- .github/workflows/build_binary.yml | 32 ++++++++++++------- .github/workflows/publish_jsr.yml | 32 ++++++++++--------- .github/workflows/test_deno.yml | 2 +- {jsr => registries/jsr}/.gitignore | 0 {jsr => registries/jsr}/README.md | 0 {jsr => registries/jsr}/jsr.json | 0 .../jsr}/scripts/binary_to_json.sh | 0 .../jsr}/scripts/set_version.sh | 0 {jsr => registries/jsr}/src/bin/index.ts | 0 9 files changed, 38 insertions(+), 28 deletions(-) rename {jsr => registries/jsr}/.gitignore (100%) rename {jsr => registries/jsr}/README.md (100%) rename {jsr => registries/jsr}/jsr.json (100%) rename {jsr => registries/jsr}/scripts/binary_to_json.sh (100%) mode change 100755 => 100644 rename {jsr => registries/jsr}/scripts/set_version.sh (100%) mode change 100755 => 100644 rename {jsr => registries/jsr}/src/bin/index.ts (100%) diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index 1baa56c7..9ce3d4be 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -7,16 +7,18 @@ on: push: branches: ['main'] tags: ['*'] + pull_request: branches: ['*'] jobs: generate-target-metadata: - name: 'Generate FFI metadata (${{ matrix.target }})' + name: 'Generate target metadata (${{ matrix.target }})' runs-on: ${{ matrix.runner }} env: ASTREIN_VERSION: '1.2.0' ASTREIN_SHA256: ${{ matrix.astrein-sha256 }} + strategy: fail-fast: false matrix: @@ -26,6 +28,7 @@ jobs: runner: ubuntu-24.04 astrein-archive: astrein-linux-x86_64.tar.gz astrein-sha256: 'cd0bb42f883322d9b7bbf1a34b57acfab83bcf78cf529a5cd122234fc8787582' + - target: aarch64-linux-gnu arch: aarch64 runner: ubuntu-24.04-arm @@ -59,6 +62,7 @@ jobs: "https://github.com/Katze719/ASTrein/releases/download/v${ASTREIN_VERSION}/${{ matrix.astrein-archive }}" echo "${ASTREIN_SHA256} ${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ | sha256sum --check - + mkdir -p "${RUNNER_TEMP}/astrein" tar -xzf "${RUNNER_TEMP}/${{ matrix.astrein-archive }}" \ -C "${RUNNER_TEMP}/astrein" \ @@ -93,13 +97,9 @@ jobs: path: dist/ffi/${{ matrix.arch }}.ffi.json generate-metadata: - name: 'Collect FFI metadata' + name: 'Generate metadata' needs: ['generate-target-metadata'] runs-on: ubuntu-24.04 - outputs: - package_version: ${{ steps.version.outputs.PACKAGE_VERSION }} - is_valid_package_version: ${{ steps.check-tag.outputs.IS_VALID_PACKAGE_VERSION }} - steps: - name: 'Checkout repository' uses: actions/checkout@v4 @@ -157,12 +157,17 @@ jobs: if-no-files-found: error name: cpp-bindings-linux-ffi path: dist/ffi/*.ffi.json + + outputs: + package_version: ${{ steps.version.outputs.PACKAGE_VERSION }} + is_valid_package_version: ${{ steps.check-tag.outputs.IS_VALID_PACKAGE_VERSION }} build-binary: - name: 'Build ${{ matrix.target }}' + name: 'Build binary (${{ matrix.target }})' runs-on: ${{ matrix.runner }} container: image: ${{ matrix.image }} + strategy: fail-fast: false matrix: @@ -171,6 +176,7 @@ jobs: runner: ubuntu-24.04 image: quay.io/pypa/manylinux_2_28_x86_64@sha256:4dc41da7df20400310c80d162a2fe2d2c2f3d9734d8dec20f6b9843711618deb artifact: libcpp_bindings_linux-x86_64-linux-gnu + - target: aarch64-linux-gnu runner: ubuntu-24.04-arm image: quay.io/pypa/manylinux_2_28_aarch64@sha256:29a6ceb78de5b00494e6e7456a72782a4cb54238de102e7491d15fe47789b4d1 @@ -228,12 +234,13 @@ jobs: name: 'Run: Test Unit C++' needs: ['build-binary'] uses: './.github/workflows/test_unit_cpp.yml' - with: - artifact-name: libcpp_bindings_linux-x86_64-linux-gnu permissions: contents: read checks: write + with: + artifact-name: libcpp_bindings_linux-x86_64-linux-gnu + create-release: name: 'Create GitHub release' needs: ['generate-metadata', 'build-binary', 'test-unit-cpp'] @@ -288,12 +295,13 @@ jobs: name: 'Run: Publish JSR' needs: ['generate-metadata', 'build-binary', 'test-unit-cpp'] uses: './.github/workflows/publish_jsr.yml' + permissions: + contents: read + id-token: write + with: publish: ${{ needs.generate-metadata.outputs.is_valid_package_version == 'true' }} version: ${{ needs.generate-metadata.outputs.package_version }} x86-64-artifact-name: libcpp_bindings_linux-x86_64-linux-gnu aarch64-artifact-name: libcpp_bindings_linux-aarch64-linux-gnu ffi-artifact-name: cpp-bindings-linux-ffi - permissions: - contents: read - id-token: write diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index ced5980f..80f44a57 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -70,34 +70,36 @@ jobs: - name: 'Prepare files for JSR' run: | - mkdir -p ./jsr/bin/x86_64 ./jsr/bin/aarch64 - cp ./artifacts/x86_64/libcpp_bindings_linux.so ./jsr/bin/x86_64/library.so - cp ./artifacts/aarch64/libcpp_bindings_linux.so ./jsr/bin/aarch64/library.so - cp ./artifacts/ffi/x86_64.ffi.json ./jsr/bin/x86_64/ffi.json - cp ./artifacts/ffi/aarch64.ffi.json ./jsr/bin/aarch64/ffi.json + mkdir -p ./registries/jsr/bin/x86_64 + cp ./artifacts/x86_64/libcpp_bindings_linux.so ./registries/jsr/bin/x86_64/library.so + cp ./artifacts/ffi/x86_64.ffi.json ./registries/jsr/bin/x86_64/ffi.json + + mkdir -p ./registries/jsr/bin/aarch64 + cp ./artifacts/aarch64/libcpp_bindings_linux.so ./registries/jsr/bin/aarch64/library.so + cp ./artifacts/ffi/aarch64.ffi.json ./registries/jsr/bin/aarch64/ffi.json - ./jsr/scripts/binary_to_json.sh \ - ./jsr/bin/x86_64/library.so \ - ./jsr/bin/x86_64/library.json \ + ./registries/jsr/scripts/binary_to_json.sh \ + ./registries/jsr/bin/x86_64/library.so \ + ./registries/jsr/bin/x86_64/library.json \ x86_64-linux-gnu - ./jsr/scripts/binary_to_json.sh \ - ./jsr/bin/aarch64/library.so \ - ./jsr/bin/aarch64/library.json \ + ./registries/jsr/scripts/binary_to_json.sh \ + ./registries/jsr/bin/aarch64/library.so \ + ./registries/jsr/bin/aarch64/library.json \ aarch64-linux-gnu - ./jsr/scripts/set_version.sh \ - jsr/jsr.json \ + ./registries/jsr/scripts/set_version.sh \ + registries/jsr/jsr.json \ "${{ inputs.version }}" - name: 'Publish package to JSR (normal)' if: inputs.publish - working-directory: jsr + working-directory: registries/jsr run: | deno publish --allow-dirty - name: 'Publish package to JSR (dry-run)' if: ${{ !inputs.publish }} - working-directory: jsr + working-directory: registries/jsr run: | deno publish --allow-dirty --dry-run diff --git a/.github/workflows/test_deno.yml b/.github/workflows/test_deno.yml index bb9a237e..9b75394f 100644 --- a/.github/workflows/test_deno.yml +++ b/.github/workflows/test_deno.yml @@ -3,7 +3,7 @@ name: Deno Integration Tests on: push: branches: [ main, master ] - pull_request: + pull_request: {} jobs: deno-tests: diff --git a/jsr/.gitignore b/registries/jsr/.gitignore similarity index 100% rename from jsr/.gitignore rename to registries/jsr/.gitignore diff --git a/jsr/README.md b/registries/jsr/README.md similarity index 100% rename from jsr/README.md rename to registries/jsr/README.md diff --git a/jsr/jsr.json b/registries/jsr/jsr.json similarity index 100% rename from jsr/jsr.json rename to registries/jsr/jsr.json diff --git a/jsr/scripts/binary_to_json.sh b/registries/jsr/scripts/binary_to_json.sh old mode 100755 new mode 100644 similarity index 100% rename from jsr/scripts/binary_to_json.sh rename to registries/jsr/scripts/binary_to_json.sh diff --git a/jsr/scripts/set_version.sh b/registries/jsr/scripts/set_version.sh old mode 100755 new mode 100644 similarity index 100% rename from jsr/scripts/set_version.sh rename to registries/jsr/scripts/set_version.sh diff --git a/jsr/src/bin/index.ts b/registries/jsr/src/bin/index.ts similarity index 100% rename from jsr/src/bin/index.ts rename to registries/jsr/src/bin/index.ts From 2b9231334b41ddd4d25156526addba3566a49d18 Mon Sep 17 00:00:00 2001 From: Mqx <62719703+Mqxx@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:37:16 +0200 Subject: [PATCH 12/15] fix: moved --- {registries/jsr => jsr}/.gitignore | 0 {registries/jsr => jsr}/README.md | 0 {registries/jsr => jsr}/jsr.json | 0 {registries/jsr => jsr}/scripts/binary_to_json.sh | 0 {registries/jsr => jsr}/scripts/set_version.sh | 0 {registries/jsr => jsr}/src/bin/index.ts | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {registries/jsr => jsr}/.gitignore (100%) rename {registries/jsr => jsr}/README.md (100%) rename {registries/jsr => jsr}/jsr.json (100%) rename {registries/jsr => jsr}/scripts/binary_to_json.sh (100%) mode change 100644 => 100755 rename {registries/jsr => jsr}/scripts/set_version.sh (100%) rename {registries/jsr => jsr}/src/bin/index.ts (100%) diff --git a/registries/jsr/.gitignore b/jsr/.gitignore similarity index 100% rename from registries/jsr/.gitignore rename to jsr/.gitignore diff --git a/registries/jsr/README.md b/jsr/README.md similarity index 100% rename from registries/jsr/README.md rename to jsr/README.md diff --git a/registries/jsr/jsr.json b/jsr/jsr.json similarity index 100% rename from registries/jsr/jsr.json rename to jsr/jsr.json diff --git a/registries/jsr/scripts/binary_to_json.sh b/jsr/scripts/binary_to_json.sh old mode 100644 new mode 100755 similarity index 100% rename from registries/jsr/scripts/binary_to_json.sh rename to jsr/scripts/binary_to_json.sh diff --git a/registries/jsr/scripts/set_version.sh b/jsr/scripts/set_version.sh similarity index 100% rename from registries/jsr/scripts/set_version.sh rename to jsr/scripts/set_version.sh diff --git a/registries/jsr/src/bin/index.ts b/jsr/src/bin/index.ts similarity index 100% rename from registries/jsr/src/bin/index.ts rename to jsr/src/bin/index.ts From 406f56de0a7647e80ee5cda01522190d715bf81c Mon Sep 17 00:00:00 2001 From: Mqx <62719703+Mqxx@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:39:19 +0200 Subject: [PATCH 13/15] fix: revert --- .github/workflows/publish_jsr.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index 80f44a57..22b431dc 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -70,36 +70,36 @@ jobs: - name: 'Prepare files for JSR' run: | - mkdir -p ./registries/jsr/bin/x86_64 - cp ./artifacts/x86_64/libcpp_bindings_linux.so ./registries/jsr/bin/x86_64/library.so - cp ./artifacts/ffi/x86_64.ffi.json ./registries/jsr/bin/x86_64/ffi.json + mkdir -p ./jsr/bin/x86_64 + cp ./artifacts/x86_64/libcpp_bindings_linux.so ./jsr/bin/x86_64/library.so + cp ./artifacts/ffi/x86_64.ffi.json ./jsr/bin/x86_64/ffi.json - mkdir -p ./registries/jsr/bin/aarch64 - cp ./artifacts/aarch64/libcpp_bindings_linux.so ./registries/jsr/bin/aarch64/library.so - cp ./artifacts/ffi/aarch64.ffi.json ./registries/jsr/bin/aarch64/ffi.json + mkdir -p ./jsr/bin/aarch64 + cp ./artifacts/aarch64/libcpp_bindings_linux.so ./jsr/bin/aarch64/library.so + cp ./artifacts/ffi/aarch64.ffi.json ./jsr/bin/aarch64/ffi.json - ./registries/jsr/scripts/binary_to_json.sh \ - ./registries/jsr/bin/x86_64/library.so \ - ./registries/jsr/bin/x86_64/library.json \ + ./jsr/scripts/binary_to_json.sh \ + ./jsr/bin/x86_64/library.so \ + ./jsr/bin/x86_64/library.json \ x86_64-linux-gnu - ./registries/jsr/scripts/binary_to_json.sh \ - ./registries/jsr/bin/aarch64/library.so \ - ./registries/jsr/bin/aarch64/library.json \ + ./jsr/scripts/binary_to_json.sh \ + ./jsr/bin/aarch64/library.so \ + ./jsr/bin/aarch64/library.json \ aarch64-linux-gnu - ./registries/jsr/scripts/set_version.sh \ + ./jsr/scripts/set_version.sh \ registries/jsr/jsr.json \ "${{ inputs.version }}" - name: 'Publish package to JSR (normal)' if: inputs.publish - working-directory: registries/jsr + working-directory: jsr run: | deno publish --allow-dirty - name: 'Publish package to JSR (dry-run)' if: ${{ !inputs.publish }} - working-directory: registries/jsr + working-directory: jsr run: | deno publish --allow-dirty --dry-run From d6c0547c36b425ba20e93c10817acd283faa30f8 Mon Sep 17 00:00:00 2001 From: Mqx <62719703+Mqxx@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:45:09 +0200 Subject: [PATCH 14/15] fix: permission --- jsr/scripts/set_version.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 jsr/scripts/set_version.sh diff --git a/jsr/scripts/set_version.sh b/jsr/scripts/set_version.sh old mode 100644 new mode 100755 From 5bbc5c3c5cda96ea0562d48204ae1ee24c3dd9af Mon Sep 17 00:00:00 2001 From: Katze719 Date: Fri, 28 Aug 2026 23:26:10 +0200 Subject: [PATCH 15/15] fix: update path for JSR version script in publish workflow --- .github/workflows/publish_jsr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index 22b431dc..9510660b 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -89,7 +89,7 @@ jobs: aarch64-linux-gnu ./jsr/scripts/set_version.sh \ - registries/jsr/jsr.json \ + jsr/jsr.json \ "${{ inputs.version }}" - name: 'Publish package to JSR (normal)'