Skip to content

Commit

Permalink
add CI action for cargo cbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Nov 21, 2024
1 parent 2cf226b commit 23466e0
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ jobs:
done
link-c-dynamic-library:
name: dynamic library
name: vanilla dynamic library
strategy:
matrix:
include:
Expand Down Expand Up @@ -304,6 +304,45 @@ jobs:
cargo build --release --target ${{matrix.target}} --features=custom-prefix
objdump -tT target/${{matrix.target}}/release/deps/libz_rs.so | grep -q "MY_CUSTOM_PREFIX_uncompress" || (echo "symbol not found!" && exit 1)
cargo-c-dynamic-library:
name: cargo-c dynamic library
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
features:
- ''
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: stable
targets: ${{matrix.target}}
- name: Install cargo-c
env:
LINK: https://github.com/lu-zero/cargo-c/releases/latest/download
run: |
curl -L "$LINK/cargo-c-x86_64-unknown-linux-musl.tar.gz" |
tar xz -C $HOME/.cargo/bin
- name: build with and test the result of cargo-c
working-directory: libz-rs-sys-cdylib
run: |
# build using cargo-c this time
cargo cinstall --offline --release --destdir=/tmp/cargo-cbuild-libz-rs
tree /tmp/cargo-cbuild-libz-rs
# verify that the SONAME is set and includes a version
objdump -p target/x86_64-unknown-linux-gnu/release/libz_rs.so | awk '/SONAME/{print $2}' | grep -E 'libz_rs\.so\.[0-9]+\.[0-9]+'
# build zpipe with our library
cc -o zpipe zpipe.c -I /tmp/cargo-cbuild-libz-rs/usr/local/lib/x86_64-linux-gnu -lz_rs
export LD_LIBRARY_PATH=/tmp/cargo-cbuild-zlib-rs/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
./zpipe < Cargo.toml | ./zpipe -d > out.txt
cmp -s Cargo.toml out.txt
wasm32:
name: "wasm32"
runs-on: ubuntu-latest
Expand Down

0 comments on commit 23466e0

Please sign in to comment.