Repository navigation
83 lines (71 loc) · 2.49 KB
/
Copy pathhiroz-build-go-libs.yml
File metadata and controls
83 lines (71 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Dexory hiroz: build lyrical libhiroz.a for Go consumers.
#
# Called from botsandus/hiroz. Uploads per-target artifacts; does NOT create a
# GitHub Release (that is hiroz-cut-release.yml, which attaches them to
# dexory/vX.Y.Z).
name: hiroz build Go libs
on:
workflow_call:
env:
DISTRO: lyrical
jobs:
build:
name: libhiroz (lyrical, ${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Rust target (aarch64 Linux cross)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: rustup target add ${{ matrix.target }}
- name: Install ziglang (aarch64 Linux cross)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: pip install ziglang
- name: Install cargo-zigbuild (aarch64 Linux cross)
if: matrix.target == 'aarch64-unknown-linux-gnu'
uses: taiki-e/install-action@v2
with:
tool: cargo-zigbuild
- name: Build libhiroz (native)
if: matrix.target != 'aarch64-unknown-linux-gnu'
shell: bash
run: |
cargo build --release \
--features ffi,rmw-zenoh,${DISTRO} \
--no-default-features \
--target ${{ matrix.target }} \
-p hiroz
- name: Build libhiroz (aarch64 Linux via zigbuild)
if: matrix.target == 'aarch64-unknown-linux-gnu'
shell: bash
run: |
cargo zigbuild --release \
--features ffi,rmw-zenoh,${DISTRO} \
--no-default-features \
--target ${{ matrix.target }} \
-p hiroz
- name: Package library + header
shell: bash
run: |
mkdir -p go-dist
src="target/${{ matrix.target }}/release"
name="libhiroz-${DISTRO}-${{ matrix.target }}"
[ -f "$src/libhiroz.a" ] && cp "$src/libhiroz.a" "go-dist/${name}.a"
cp crates/hiroz-go/hiroz/hiroz_ffi.h "go-dist/hiroz_ffi.h"
ls -la go-dist
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: libhiroz-${{ env.DISTRO }}-${{ matrix.target }}
path: go-dist/*