summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2022-07-01 10:24:22 +0200
committerLinus Färnstrand <faern@faern.net>2022-07-01 14:03:25 +0200
commit1ded49e7ef9a2af2cb0f86328009c517d49b2fd8 (patch)
treee88419783160cc0ea3a917a6fbcd064aff02bd3e /.github/workflows
parent983a0ca0d822a3e211d9e0fde5f1b70ed5c44b59 (diff)
downloadmullvadvpn-1ded49e7ef9a2af2cb0f86328009c517d49b2fd8.tar.xz
mullvadvpn-1ded49e7ef9a2af2cb0f86328009c517d49b2fd8.zip
Add a cargo-udeps CI job to find unused dependencies
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/rust-unused-dependencies.yml46
1 files changed, 46 insertions, 0 deletions
diff --git a/.github/workflows/rust-unused-dependencies.yml b/.github/workflows/rust-unused-dependencies.yml
new file mode 100644
index 0000000000..0aba9f8e1f
--- /dev/null
+++ b/.github/workflows/rust-unused-dependencies.yml
@@ -0,0 +1,46 @@
+name: Rust - Unused dependencies
+on:
+ pull_request:
+ paths:
+ - .github/workflows/rust-unused-dependencies.yml
+ - '**/*.rs'
+ - '**/Cargo.toml'
+ # Check if requested manually from the Actions tab
+ workflow_dispatch:
+jobs:
+ cargo-udeps:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Checkout binaries submodule
+ run: git submodule update --init --depth=1 dist-assets/binaries
+
+ - name: Install build dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install libdbus-1-dev
+
+ # cargo-udeps can compile on stable, but not run on stable.
+ # So we need a nighly toolchain. But `rust-cache@v1` keys
+ # the cache on the rustc version. So if we just use `nightly`
+ # the cache will be lost every day. To mitigate this we lock
+ # it to a specific nightly. Obviously we have to bump this from
+ # time to time or when `cargo-udeps` release a version incompatible
+ # with our nightly version.
+ - name: Install Rust
+ uses: actions-rs/toolchain@v1.0.6
+ with:
+ toolchain: nightly-2022-07-01
+ profile: minimal
+ default: true
+
+ - uses: Swatinem/rust-cache@v1
+
+ - name: Install cargo-udeps
+ run: cargo install cargo-udeps
+
+ - name: Check for unused dependencies
+ run: |
+ source env.sh
+ cargo udeps --workspace --all-targets