Shared core support using Panama (only Java 23+) #4
Workflow file for this run
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
| name: Native build | |
| # Cross-compiles the Rust shared-core wrapper (sdk-core/src/main/rust) for every supported | |
| # platform, smoke-tests the produced library, and uploads it as an artifact. The release pipeline | |
| # downloads these artifacts and overlays them into the single (uber) sdk-core jar. | |
| on: | |
| pull_request: | |
| paths: | |
| - 'sdk-core/src/main/rust/**' | |
| - '.github/workflows/native.yaml' | |
| workflow_dispatch: | |
| workflow_call: | |
| jobs: | |
| build: | |
| name: "Build native (${{ matrix.target }})" | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| cross: false | |
| - target: aarch64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| cross: true | |
| - target: x86_64-unknown-linux-musl | |
| runner: ubuntu-latest | |
| cross: true | |
| - target: aarch64-unknown-linux-musl | |
| runner: ubuntu-latest | |
| cross: true | |
| - target: x86_64-apple-darwin | |
| runner: macos-13 | |
| cross: false | |
| - target: aarch64-apple-darwin | |
| runner: macos-14 | |
| cross: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| - name: Install cross | |
| if: ${{ matrix.cross }} | |
| run: cargo install cross --git https://github.com/cross-rs/cross --locked | |
| - name: Build cdylib | |
| working-directory: sdk-core/src/main/rust | |
| run: | | |
| if [ "${{ matrix.cross }}" = "true" ]; then | |
| cross build --release --target ${{ matrix.target }} | |
| else | |
| cargo build --release --target ${{ matrix.target }} | |
| fi | |
| - name: Locate library | |
| id: lib | |
| working-directory: sdk-core/src/main/rust | |
| run: | | |
| dir="target/${{ matrix.target }}/release" | |
| file=$(ls "$dir"/librestate_sdk_core.so "$dir"/librestate_sdk_core.dylib 2>/dev/null | head -1) | |
| if [ -z "$file" ]; then echo "no library produced for ${{ matrix.target }}"; exit 1; fi | |
| echo "path=sdk-core/src/main/rust/$file" >> "$GITHUB_OUTPUT" | |
| echo "file=$file" >> "$GITHUB_OUTPUT" | |
| - name: Smoke test (exported C symbols present) | |
| working-directory: sdk-core/src/main/rust | |
| run: | | |
| f="${{ steps.lib.outputs.file }}" | |
| # Linux uses `nm -D` (no symbol prefix); macOS uses `nm -gU` (leading underscore). | |
| if [ "$RUNNER_OS" = "macOS" ]; then list="nm -gU"; pre="_"; else list="nm -D"; pre=""; fi | |
| for sym in init vm_new vm_free free_buffer vm_sys_call vm_take_notification; do | |
| $list "$f" 2>/dev/null | grep -qE "[ ]${pre}${sym}$" || { echo "missing exported symbol: $sym"; exit 1; } | |
| done | |
| echo "All expected symbols present in $f" | |
| - name: Upload native library | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-${{ matrix.target }} | |
| path: ${{ steps.lib.outputs.path }} | |
| if-no-files-found: error |