From 45641eab1e0e3d41ad5138929ac4783864b2d656 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Fri, 24 Jan 2025 08:59:39 -0600 Subject: [PATCH] github-ci: test that bindgen bindings are up to date Regenerates the `sys.rs` and looks for any difference. Check will fail if there is a difference. Ticket: #7341 --- .github/workflows/rust.yml | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4539a03574..3571edd6a4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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: | -- 2.47.2