From 8f90b34bc0db354c3243444c4ebe54051bc1564c Mon Sep 17 00:00:00 2001 From: robot9001 Date: Sat, 14 Oct 2023 18:29:47 +0200 Subject: [PATCH] ci: Run `bindgen` for `libmagic` versions for comparison Signed-off-by: robot9001 --- .github/workflows/test-libmagic-version.yml | 26 +++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-libmagic-version.yml b/.github/workflows/test-libmagic-version.yml index 4f4e960..8a18b32 100644 --- a/.github/workflows/test-libmagic-version.yml +++ b/.github/workflows/test-libmagic-version.yml @@ -8,7 +8,7 @@ on: jobs: build: - name: "cargo test" + name: "cargo test && bindgen" permissions: contents: read strategy: @@ -32,7 +32,7 @@ jobs: - run: | sudo apt-get update - sudo apt-get install automake gcc libtool make python3 zlib1g-dev + sudo apt-get install automake gcc libtool make python3 zlib1g-dev llvm-dev libclang-dev clang - run: curl --output file-${{ matrix.version }}.tgz https://astron.com/pub/file/file-${{ matrix.version }}.tar.gz @@ -71,3 +71,25 @@ jobs: - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 - run: cargo +${{ steps.toolchain.outputs.name }} test --all-targets --all-features --verbose + + - uses: taiki-e/install-action@ebb475ef6e41abb770588020cd8c6ca3503cb868 # v2.19.4 + with: + tool: bindgen-cli@0.68.1 + + # bindgen doesn't exactly match crate MSRV + - run: > + bindgen + --use-core + --no-size_t-is-usize + --allowlist-file '${{ steps.prefix.outputs.dir }}/include/magic.h' + --opaque-type 'magic_set' + --no-copy 'magic_set' + --rust-target '1.47' + --output 'bindings.rs' + '${{ steps.prefix.outputs.dir }}/include/magic.h' + + - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: bindgen-${{ matrix.version }} + path: | + bindings.rs