Release: capi 0.2.2, Go SDK v0.2.4 #6
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
| # Build libreflow_rt_capi for every supported triple and attach a | |
| # per-triple tarball to a GitHub Release. Users of the Go module then | |
| # run `sdk/go/scripts/install_lib.sh vX.Y.Z` to drop the right tarball | |
| # into their `go env GOMODCACHE`'d copy of the module so cgo links | |
| # successfully. | |
| # | |
| # Triggers | |
| # -------- | |
| # - Tag push matching `sdk/go/v*` (e.g. `sdk/go/v0.2.0`) — Go's | |
| # submodule-versioning convention. The `go get | |
| # github.com/offbit-ai/reflow/sdk/go@v0.2.0` lookup expects exactly | |
| # this tag pattern. | |
| # - Manual `workflow_dispatch` for build verification (no release). | |
| name: publish-go | |
| on: | |
| push: | |
| tags: | |
| - 'sdk/go/v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: build / ${{ matrix.triple }} | |
| runs-on: ${{ matrix.host }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - host: macos-14 | |
| triple: aarch64-apple-darwin | |
| ext: dylib | |
| prefix: lib | |
| - host: macos-14 | |
| triple: x86_64-apple-darwin | |
| ext: dylib | |
| prefix: lib | |
| - host: ubuntu-latest | |
| triple: x86_64-unknown-linux-gnu | |
| ext: so | |
| prefix: lib | |
| - host: ubuntu-latest | |
| triple: aarch64-unknown-linux-gnu | |
| ext: so | |
| prefix: lib | |
| linker_pkg: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| - host: windows-latest | |
| triple: x86_64-pc-windows-msvc | |
| ext: dll | |
| prefix: "" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.triple }} | |
| - uses: mozilla-actions/sccache-action@v0.0.5 | |
| - name: Install aarch64 linux cross toolchain | |
| if: ${{ matrix.linker_pkg }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ${{ matrix.linker_pkg }} | |
| echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
| echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
| echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
| echo "CFLAGS_aarch64_unknown_linux_gnu=-march=armv8-a -D__ARM_ARCH=8" >> $GITHUB_ENV | |
| - name: Build libreflow_rt_capi (release) | |
| shell: bash | |
| run: | | |
| set -eux | |
| cargo build --release --target "${{ matrix.triple }}" -p reflow_rt_capi --features generate-header | |
| - name: Stage tarball contents | |
| shell: bash | |
| run: | | |
| set -eux | |
| STAGE="staging/reflow-rt-capi-${{ matrix.triple }}" | |
| mkdir -p "$STAGE/lib" "$STAGE/include" | |
| src="target/${{ matrix.triple }}/release/${{ matrix.prefix }}reflow_rt_capi.${{ matrix.ext }}" | |
| cp "$src" "$STAGE/lib/" | |
| # Windows MSVC also needs the import .lib to satisfy the | |
| # linker; macOS / Linux don't. | |
| if [[ "${{ matrix.triple }}" == *windows* ]]; then | |
| cp "target/${{ matrix.triple }}/release/reflow_rt_capi.dll.lib" "$STAGE/lib/" || true | |
| fi | |
| cp crates/reflow_rt_capi/include/reflow_rt.h "$STAGE/include/" | |
| ls -laR "$STAGE" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: reflow-rt-capi-${{ matrix.triple }} | |
| path: staging/reflow-rt-capi-${{ matrix.triple }}/ | |
| if-no-files-found: error | |
| release: | |
| name: release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/sdk/go/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: ver | |
| run: | | |
| # tag is sdk/go/v0.2.0 -> version is v0.2.0 | |
| ver="${GITHUB_REF#refs/tags/sdk/go/}" | |
| echo "version=$ver" >> "$GITHUB_OUTPUT" | |
| - name: Download per-triple artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| pattern: reflow-rt-capi-* | |
| - name: Create per-triple tarballs | |
| shell: bash | |
| run: | | |
| set -eux | |
| mkdir -p tarballs | |
| VER="${{ steps.ver.outputs.version }}" | |
| for d in artifacts/reflow-rt-capi-*/; do | |
| triple="$(basename "$d" | sed 's/^reflow-rt-capi-//')" | |
| out="tarballs/reflow-rt-capi-${triple}-${VER}.tar.gz" | |
| tar -C "$d" -czf "$out" lib include | |
| done | |
| ls -la tarballs | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Go SDK ${{ steps.ver.outputs.version }} | |
| generate_release_notes: true | |
| files: tarballs/*.tar.gz | |
| fail_on_unmatched_files: true |