diff --git a/.github/workflows/rust-unused-dependencies.yml b/.github/workflows/rust-unused-dependencies.yml index 8c16eef0a4e5..186838b06b4d 100644 --- a/.github/workflows/rust-unused-dependencies.yml +++ b/.github/workflows/rust-unused-dependencies.yml @@ -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 diff --git a/Cargo.lock b/Cargo.lock index 941d141d7c47..92f3c9940efa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2242,7 +2242,6 @@ dependencies = [ "anyhow", "async-trait", "cacao", - "chrono", "insta", "log", "mullvad-paths", diff --git a/installer-downloader/Cargo.toml b/installer-downloader/Cargo.toml index 03ccc28d4a16..48997b99e1e6 100644 --- a/installer-downloader/Cargo.toml +++ b/installer-downloader/Cargo.toml @@ -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"] }