]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
github-ci: test that bindgen bindings are up to date
authorJason Ish <jason.ish@oisf.net>
Fri, 24 Jan 2025 14:59:39 +0000 (08:59 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 17 Feb 2025 06:31:29 +0000 (07:31 +0100)
Regenerates the `sys.rs` and looks for any difference. Check will fail
if there is a difference.

Ticket: #7341

.github/workflows/rust.yml

index 4539a03574d9593f8f3a9a349cf0d7fbb2642734..3571edd6a45247815745977e97233447f5046821 100644 (file)
@@ -21,20 +21,18 @@ jobs:
     runs-on: ubuntu-latest
     container: almalinux:9
     steps:
-      - name: Cache rust
-        uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
-        with:
-          path: ~/.cargo
-          key: check-rust
-
       - name: Install system packages
         run: |
-          dnf -y install dnf-plugins-core
+          dnf -y install dnf-plugins-core epel-release
           dnf config-manager --set-enabled crb
           dnf -y install \
                 autoconf \
                 automake \
-                cargo-vendor \
+                bindgen \
+                cargo \
+                cbindgen \
+                clang-devel \
+                clippy \
                 diffutils \
                 numactl-devel \
                 dpdk-devel \
@@ -61,21 +59,28 @@ jobs:
                 python3-devel \
                 python3-sphinx \
                 python3-yaml \
+                rust \
+                rustfmt \
                 sudo \
                 which \
                 zlib-devel
 
-      - name: Installing Rust
-        run: |
-          curl https://sh.rustup.rs -sSf | sh -s -- -y
-          echo "$HOME/.cargo/bin" >> $GITHUB_PATH
-      - name: Install cbindgen
-        run: cargo install --debug cbindgen
       - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
       - run: git config --global --add safe.directory /__w/suricata/suricata
       - run: ./scripts/bundle.sh
       - run: ./autogen.sh
       - run: ./configure --enable-warnings
+      - name: Checking bindgen output
+        working-directory: rust
+        run: |
+          bindgen --version
+          make check-bindgen-bindings
+          diff=$(git diff sys)
+          if [ "${diff}" ]; then
+              echo "${diff}"
+              echo "::error ::Bindgen bindings appear to be out of date"
+              exit 1
+          fi
       - run: cargo clippy --all-features --fix --allow-no-vcs
         working-directory: rust
       - run: |