summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJonathan <jonathan@mullvad.net>2022-06-21 15:52:52 +0200
committerJonathan <jonathan@mullvad.net>2022-06-30 15:05:07 +0200
commit3bf745cb30c9916eacde2b65449054f6007d48a4 (patch)
tree94e3c6f1471a63b8945c5d8b08a50bdd2a120369
parent9d1fae38f7733627fa30f8446fd508507562ba04 (diff)
downloadmullvadvpn-3bf745cb30c9916eacde2b65449054f6007d48a4.tar.xz
mullvadvpn-3bf745cb30c9916eacde2b65449054f6007d48a4.zip
Add CI script for running Clippy
CI script will run clippy with `RUSTFLAGS="--deny warnings"` because this is how we do it in the other build CI scripts. However this might clash with configs that are done in the `.cargo/config` file. I expect this will not be a significant problem however and the CI script is not a critical resource and as such it seems like a waste to bikeshed this.
-rw-r--r--.github/workflows/clippy.yml35
-rwxr-xr-xci/check-clippy.sh9
2 files changed, 44 insertions, 0 deletions
diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml
new file mode 100644
index 0000000000..ac37e831dc
--- /dev/null
+++ b/.github/workflows/clippy.yml
@@ -0,0 +1,35 @@
+name: Rust - Run Clippy to check lints
+on:
+ # Check whenever a file that affects Clippy is changed in a pull request
+ pull_request:
+ paths:
+ - .github/workflows/clippy.yml
+ - ci/check-clippy.sh
+ - clippy.toml
+ - '**/*.rs'
+ # Check if requested manually from the Actions tab
+ workflow_dispatch:
+jobs:
+ clippy_check:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Checkout binaries submodule
+ run: git submodule update --init --depth=1 dist-assets/binaries
+
+ - uses: actions-rs/toolchain@v1.0.6
+ with:
+ toolchain: stable
+ components: clippy
+ override: true
+
+ - name: Install build dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install libdbus-1-dev
+
+ - name: Clippy check
+ run: |
+ ./ci/check-clippy.sh
diff --git a/ci/check-clippy.sh b/ci/check-clippy.sh
new file mode 100755
index 0000000000..e48adfc6b6
--- /dev/null
+++ b/ci/check-clippy.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+set -eux
+
+export RUSTFLAGS="--deny warnings"
+
+# Check rust crates with clippy
+source env.sh
+time cargo clippy --locked --verbose