]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
github-ci: verify generated rust code is rustfmt and clippy clean
authorJason Ish <jason.ish@oisf.net>
Fri, 18 Nov 2022 15:00:20 +0000 (09:00 -0600)
committerVictor Julien <vjulien@oisf.net>
Tue, 6 Dec 2022 13:09:10 +0000 (14:09 +0100)
.github/workflows/builds.yml

index decc4a243356748b25b136e56937ee046c1bc8a7..37f0e667fe02ad05473e3a922b24a81006263cf4 100644 (file)
@@ -282,12 +282,6 @@ jobs:
       - run: tar xvf prep/libhtp.tar.gz
       - run: tar xvf prep/suricata-update.tar.gz
       - run: tar xvf prep/suricata-verify.tar.gz
-      - name: Setup cbindgen
-        run: |
-          mkdir -p $HOME/.cargo/bin
-          cp prep/cbindgen $HOME/.cargo/bin
-          chmod 755 $HOME/.cargo/bin/cbindgen
-          echo "$HOME/.cargo/bin" >> $GITHUB_PATH
       - name: Install system packages
         run: |
           dnf -y install dnf-plugins-core
@@ -295,7 +289,6 @@ jobs:
           dnf -y install \
                 autoconf \
                 automake \
-                cargo-vendor \
                 diffutils \
                 numactl-devel \
                 dpdk-devel \
@@ -324,10 +317,15 @@ jobs:
                 python3-devel \
                 python3-sphinx \
                 python3-yaml \
-                rust-toolset \
                 sudo \
                 which \
                 zlib-devel
+      - run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
+      - run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
+      - run: cp prep/cbindgen $HOME/.cargo/bin
+      - run: chmod 755 $HOME/.cargo/bin/cbindgen
+      - run: rustup component add rustfmt
+      - run: rustup component add clippy
       - name: Build
         run: |
           ./autogen.sh
@@ -336,6 +334,12 @@ jobs:
       - run: ./scripts/setup-app-layer.py --parser --logger --detect FooBar payload
       - run: make -j2
       - run: ./src/suricata --list-app-layer-protos | grep foobar
+      - name: Verify rustfmt
+        run: rustfmt -v --check src/applayerfoobar/*.rs
+        working-directory: rust
+      - name: Verify clippy
+        run: cargo clippy --all-features
+        working-directory: rust
 
   # This build also creates the distribution package that some other builds
   # depend on.