Skip to content

Commit 06c035b

Browse files
committed
Add CI test for cargo-c packaging
Add a test that dry-runs the packaging procedure using cargo-c in CI. We could do more on this front (such as actually linking against the library using the package config), but this should be sufficient to have some confidence that we won't break the workflow. Signed-off-by: Daniel Müller <[email protected]>
1 parent c56211f commit 06c035b

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ jobs:
405405
- run: cargo run --example inspect-mangled
406406
- run: cargo run --example normalize-virt-offset
407407
- run: cargo run --package gsym-in-apk
408-
c-header:
408+
c-lib:
409409
name: Check generated C header
410410
runs-on: ubuntu-latest
411411
steps:
@@ -415,6 +415,30 @@ jobs:
415415
- name: Check that C header is up-to-date
416416
run: git diff --exit-code ||
417417
(echo "!!!! CHECKED IN C HEADER IS OUTDATED !!!!" && false)
418+
- uses: actions/cache/restore@v4
419+
id: restore-cargo-c
420+
with:
421+
path: cargo-c/
422+
key: cargo-c
423+
- if: steps.restore-cargo-c.outputs.cache-hit != 'true'
424+
name: Install cargo-c
425+
# TODO: We will never upgrade the program unless the cache gets
426+
# purged.
427+
run: cargo install cargo-c --features=vendored-openssl --root cargo-c
428+
- if: steps.restore-cargo-c.outputs.cache-hit != 'true'
429+
uses: actions/cache/save@v4
430+
with:
431+
path: cargo-c/
432+
key: cargo-c
433+
- name: Run cargo-c
434+
run: |
435+
cargo-c/bin/cargo-cinstall cinstall --package blazesym-c --prefix / --destdir ./blazesym-c
436+
tree ./blazesym-c || true
437+
# We could do more sanity checking here, but we mostly care
438+
# that cargo-c succeeded and on top of just checking for
439+
# command success also check for existence of generated
440+
# pkg-config file.
441+
test -f ./blazesym-c/lib/x86_64-linux-gnu/pkgconfig/blazesym_c.pc
418442
bench:
419443
# Only run benchmarks on the final push. They are generally only
420444
# informative because the GitHub Runners do not provide a stable
@@ -486,7 +510,7 @@ jobs:
486510
test-release,
487511
test-miri,
488512
test-examples,
489-
c-header,
513+
c-lib,
490514
clippy,
491515
rustfmt,
492516
cargo-doc,

0 commit comments

Comments
 (0)