Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 13 additions & 99 deletions .github/workflows/rust-unused-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,116 +6,30 @@ on:
- .github/workflows/rust-unused-dependencies.yml
- '**/*.rs'
- '**/Cargo.toml'
- 'building/*-container-image.txt'
workflow_dispatch:
env:
# Pinning nightly just to avoid random breakage. It's fine to bump this at any time
RUST_NIGHTLY_TOOLCHAIN: nightly-2025-11-05

permissions: {}

jobs:
prepare-containers:
cargo-shear:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Fetch container image names
run: |
echo "inner_container_image_linux=$(cat ./building/linux-container-image.txt)" >> $GITHUB_ENV
echo "inner_container_image_android=$(cat ./building/android-container-image.txt)" >> $GITHUB_ENV

outputs:
container_image_linux: ${{ env.inner_container_image_linux }}
container_image_android: ${{ env.inner_container_image_android }}

cargo-udeps-linux:
needs: prepare-containers
runs-on: ubuntu-latest
container:
image: ${{ needs.prepare-containers.outputs.container_image_linux }}

steps:
# Fix for HOME path overridden by GH runners when building in containers, see:
# https://github.com/actions/runner/issues/863
- name: Fix HOME path
run: echo "HOME=/root" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --init --depth=1 dist-assets/binaries
git submodule update --init wireguard-go-rs/libwg/wireguard-go

- name: Install nightly Rust toolchain
run: rustup override set $RUST_NIGHTLY_TOOLCHAIN
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main

- uses: taiki-e/install-action@v2
with:
tool: cargo-udeps
- name: Install cargo-shear
run: cargo binstall --no-confirm cargo-shear

- name: Check for unused dependencies
- name: Run cargo shear in all workspaces
shell: bash
run: cargo udeps --workspace

cargo-udeps-android:
needs: prepare-containers
runs-on: ubuntu-latest
container:
image: ${{ needs.prepare-containers.outputs.container_image_android }}

steps:
# Fix for HOME path overridden by GH runners when building in containers, see:
# https://github.com/actions/runner/issues/863
- name: Fix HOME path
run: echo "HOME=/root" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout wireguard-go submodule
run: |
git config --global --add safe.directory '*'
git submodule update --init wireguard-go-rs/libwg/wireguard-go

- name: Install nightly Rust
run: |
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
rustup target add aarch64-linux-android

- uses: taiki-e/install-action@v2
with:
tool: cargo-udeps

- name: Check for unused dependencies
run: cargo udeps --target aarch64-linux-android --package mullvad-jni

cargo-udeps:
strategy:
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
# By default, the longest path a filename can have in git on Windows is 260 character.
- name: Set git config for long paths
if: runner.os == 'Windows'
run: |
git config --system core.longpaths true

- name: Checkout repository
uses: actions/checkout@v4

- uses: ./.github/actions/mullvad-build-env
with:
rust-toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}

- uses: taiki-e/install-action@v2
with:
tool: cargo-udeps

- name: Check for unused dependencies
shell: bash
run: cargo udeps --workspace
workspaces=$(find . -name Cargo.lock -type f -exec dirname {} \;)
for workspace in $workspaces; do
echo ""
echo "[#] Checking workspace: $workspace"
echo ""
cargo shear "$workspace"
done
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion installer-downloader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ windows-sys = { workspace = true, features = ["Win32_System", "Win32_System_Libr
[target.'cfg(any(target_os = "windows", target_os = "macos"))'.dependencies]
anyhow = { workspace = true }
async-trait = "0.1"
chrono = { workspace = true, features = ["clock"] }
log = { workspace = true }
rand = { workspace = true }
serde = { workspace = true, features = ["derive"] }
Expand Down
Loading