Repository: cargo-prebuilt/cargo-prebuilt (language: rust)

Issue:
Run prebuilt tests in ci



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 487bc34..0ed12b2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,7 +1,7 @@
 name: Rust Build and Test
 ## Name: Rust Build and Test
 ## Author: harmless-tech
-## Version: cache-based-1.0.0
+## Version: cache-based-1.2.0
 ## Git Repo: https://github.com/harmless-tech/rust-github-actions
 
 on:
@@ -12,11 +12,11 @@ on:
   workflow_dispatch:
 
 env:
-  CARGO_TERM_COLOR: always
   bin-name: cargo-prebuilt
+  CARGO_TERM_COLOR: always
 
 jobs:
-  deps:
+  setup:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
@@ -42,8 +42,8 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-audit
+        with:
+          tools: cargo-audit
       - name: Download Deps
         if: ${{ !steps.cache.outputs.cache-hit }}
         run: cargo fetch --verbose --locked
@@ -72,7 +72,7 @@ jobs:
 
   x86_64-unknown-linux-gnu:
     runs-on: ubuntu-latest
-    needs: [ deps ]
+    needs: [ setup ]
     steps:
       - uses: actions/checkout@v3
       - name: Get deps from cache
@@ -95,60 +95,34 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable
-      - name: Run tests
-        run: cargo test --verbose --workspace --all-features --locked
-      - name: Build
-        run: cargo auditable build --verbose --workspace --locked
-      - name: Artifact
-        uses: actions/upload-artifact@v3
         with:
-          name: x86_64-unknown-linux-gnu
-          path: |
-            target/debug/${{ env.bin-name }}
-
-  x86_64-apple-darwin:
-    runs-on: macos-latest
-    needs: [ deps ]
-    steps:
-      - uses: actions/checkout@v3
-      - name: Get deps from cache
-        uses: actions/cache@v3
-        with:
-          path: |
-            .cargo-store
-          key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
-          enableCrossOsArchive: true
-          fail-on-cache-miss: true
-      - name: Move deps
-        run: mv ./.cargo-store/* ~/.cargo
-      - uses: actions/cache@v3
-        with:
-          path: |
-            target
-          key: ${{ runner.os }}-x86_64-apple-darwin-${{ hashFiles('**/Cargo.lock') }}
-      - name: Update Rust
-        run: rustup update
-      - name: Rust Version
-        run: rustc --version
-      - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable
+          tools: cargo-auditable
       - name: Run tests
         run: cargo test --verbose --workspace --all-features --locked
       - name: Build
         run: cargo auditable build --verbose --workspace --locked
+      - name: Run cargo-prebuilt
+        run: |
+          target/debug/cargo-prebuilt just
+          just --version
       - name: Artifact
         uses: actions/upload-artifact@v3
         with:
-          name: x86_64-apple-darwin
+          name: x86_64-unknown-linux-gnu
           path: |
             target/debug/${{ env.bin-name }}
 
-  aarch64-apple-darwin:
+  apple-darwin:
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - target: x86_64-apple-darwin
+            can-test: true
+          - target: aarch64-apple-darwin
+            can-test: false
     runs-on: macos-latest
-    needs: [ deps ]
+    needs: [ setup ]
     steps:
       - uses: actions/checkout@v3
       - name: Get deps from cache
@@ -165,69 +139,46 @@ jobs:
         with:
           path: |
             target
-          key: ${{ runner.os }}-aarch64-apple-darwin-${{ hashFiles('**/Cargo.lock') }}
+          key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
       - name: Update Rust
         run: rustup update
       - name: Rust Version
         run: rustc --version
       - name: Add Rust target
-        run: rustup target add aarch64-apple-darwin
+        run: rustup target add ${{ matrix.target }}
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable
-      - name: Build
-        run: cargo auditable build --verbose --workspace --locked --target aarch64-apple-darwin
-      - name: Artifact
-        uses: actions/upload-artifact@v3
-        with:
-          name: aarch64-apple-darwin
-          path: |
-            target/aarch64-apple-darwin/debug/${{ env.bin-name }}
-
-  x86_64-pc-windows-msvc:
-    runs-on: windows-latest
-    needs: [ deps ]
-    steps:
-      - uses: actions/checkout@v3
-      - name: Change file endings in Cargo.lock
-        shell: pwsh
-        run: (Get-Content -Raw Cargo.lock) -replace "`r`n","`n" | Set-Content Cargo.lock -NoNewline
-      - name: Get deps from cache
-        uses: actions/cache@v3
-        with:
-          path: |
-            .cargo-store
-          key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
-          enableCrossOsArchive: true
-          fail-on-cache-miss: true
-      - name: Move deps
-        run: mv ./.cargo-store/* ~/.cargo
-      - uses: actions/cache@v3
         with:
-          path: |
-            target
-          key: ${{ runner.os }}-x86_64-pc-windows-msvc-${{ hashFiles('**/Cargo.lock') }}
-      - name: Update Rust
-        run: rustup update
-      - name: Rust Version
-        run: rustc --version
-      - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable
+          tools: cargo-auditable
       - name: Run tests
-        run: cargo test --verbose --workspace --all-features --locked
+        if: ${{ matrix.can-test }}
+        run: cargo test --verbose --workspace --all-features --locked --target ${{ matrix.target }}
       - name: Build
-        run: cargo auditable build --verbose --workspace --locked
+        run: cargo auditable build --verbose --workspace --locked --target ${{ matrix.target }}
+      - name: Run cargo-prebuilt
+        if: ${{ matrix.can-test }}
+        run: |
+          target/${{ matrix.target }}/debug/${{ env.bin-name }} just
+          just --version
       - name: Artifact
         uses: actions/upload-artifact@v3
         with:
-          name: x86_64-pc-windows-msvc
+          name: ${{ matrix.target }}
           path: |
-            target/debug/${{ env.bin-name }}.exe
+            target/${{ matrix.target }}/debug/${{ env.bin-name }}
 
-  aarch64-pc-windows-msvc:
+  pc-windows-msvc:
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - target: x86_64-pc-windows-msvc
+            can-test: true
+          - target: aarch64-pc-windows-msvc
+            can-test: false
+          - target: i686-pc-windows-msvc
+            can-test: true
     runs-on: windows-latest
-    needs: [ deps ]
+    needs: [ setup ]
     steps:
       - uses: actions/checkout@v3
       - name: Change file endings in Cargo.lock
@@ -247,100 +198,90 @@ jobs:
         with:
           path: |
             target
-          key: ${{ runner.os }}-aarch64-pc-windows-msvc-${{ hashFiles('**/Cargo.lock') }}
+          key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
       - name: Update Rust
         run: rustup update
       - name: Rust Version
         run: rustc --version
       - name: Add Rust target
-        run: rustup target add aarch64-pc-windows-msvc
+        run: rustup target add ${{ matrix.target }}
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable
-      - name: Build
-        run: cargo auditable build --verbose --workspace --locked --target aarch64-pc-windows-msvc
-      - name: Artifact
-        uses: actions/upload-artifact@v3
-        with:
-          name: aarch64-pc-windows-msvc
-          path: |
-            target/aarch64-pc-windows-msvc/debug/${{ env.bin-name }}.exe
-
-  i686-pc-windows-msvc:
-    runs-on: windows-latest
-    needs: [ deps ]
-    steps:
-      - uses: actions/checkout@v3
-      - name: Change file endings in Cargo.lock
-        shell: pwsh
-        run: (Get-Content -Raw Cargo.lock) -replace "`r`n","`n" | Set-Content Cargo.lock -NoNewline
-      - name: Get deps from cache
-        uses: actions/cache@v3
         with:
-          path: |
-            .cargo-store
-          key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
-          enableCrossOsArchive: true
-          fail-on-cache-miss: true
-      - name: Move deps
-        run: mv ./.cargo-store/* ~/.cargo
-      - uses: actions/cache@v3
-        with:
-          path: |
-            target
-          key: ${{ runner.os }}-i686-pc-windows-msvc-${{ hashFiles('**/Cargo.lock') }}
-      - name: Update Rust
-        run: rustup update
-      - name: Rust Version
-        run: rustc --version
-      - name: Add Rust target
-        run: rustup target add i686-pc-windows-msvc
-      - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable
+          tools: cargo-auditable
       - name: Run tests
-        run: cargo test --verbose --workspace --all-features --locked --target i686-pc-windows-msvc
+        if: ${{ matrix.can-test }}
+        run: cargo test --verbose --workspace --all-features --locked --target ${{ matrix.target }}
       - name: Build
-        run: cargo auditable build --verbose --workspace --locked --target i686-pc-windows-msvc
+        run: cargo auditable build --verbose --workspace --locked --target ${{ matrix.target }}
+      - name: Run cargo-prebuilt
+        if: ${{ matrix.can-test }}
+        run: |
+          target/${{ matrix.target }}/debug/${{ env.bin-name }} just
+          just --version
       - name: Artifact
         uses: actions/upload-artifact@v3
         with:
-          name: i686-pc-windows-msvc
+          name: ${{ matrix.target }}
           path: |
-            target/i686-pc-windows-msvc/debug/${{ env.bin-name }}.exe
+            target/${{ matrix.target }}/debug/${{ env.bin-name }}.exe
 
   cross:
     strategy:
       fail-fast: false
       matrix:
-        target:
-          - x86_64-unknown-linux-musl
-          - aarch64-unknown-linux-gnu
-          - aarch64-unknown-linux-musl
-          - x86_64-unknown-freebsd
-          - x86_64-unknown-netbsd
-          - x86_64-unknown-illumos
-          - x86_64-sun-solaris
-          - riscv64gc-unknown-linux-gnu
-          - powerpc64-unknown-linux-gnu
-          - powerpc64le-unknown-linux-gnu
-          - s390x-unknown-linux-gnu
-          - mips64-unknown-linux-gnuabi64
-          - mips64-unknown-linux-muslabi64
-          - mips64el-unknown-linux-gnuabi64
-          - mips64el-unknown-linux-muslabi64
-          - i686-unknown-linux-gnu
-          - i686-unknown-linux-musl
-          - i686-unknown-freebsd
-          - armv7-unknown-linux-gnueabihf
-          - armv7-unknown-linux-musleabihf
-          - powerpc-unknown-linux-gnu
-          - mips-unknown-linux-gnu
-          - mips-unknown-linux-musl
-          - mipsel-unknown-linux-gnu
-          - mipsel-unknown-linux-musl
+        include:
+          - target: x86_64-unknown-linux-musl
+            can-test: true
+          - target: aarch64-unknown-linux-gnu
+            can-test: true
+          - target: aarch64-unknown-linux-musl
+            can-test: true
+          - target: x86_64-unknown-freebsd
+            can-test: false
+          - target: x86_64-unknown-netbsd
+            can-test: false
+          - target: x86_64-unknown-illumos
+            can-test: false
+          - target: x86_64-sun-solaris
+            can-test: false
+          - target: riscv64gc-unknown-linux-gnu
+            can-test: true
+          - target: powerpc64-unknown-linux-gnu
+            can-test: true
+          - target: powerpc64le-unknown-linux-gnu
+            can-test: true
+          - target: s390x-unknown-linux-gnu
+            can-test: true
+          - target: mips64-unknown-linux-gnuabi64
+            can-test: true
+          - target: mips64-unknown-linux-muslabi64
+            can-test: true
+          - target: mips64el-unknown-linux-gnuabi64
+            can-test: true
+          - target: mips64el-unknown-linux-muslabi64
+            can-test: true
+          - target: i686-unknown-linux-gnu
+            can-test: false
+          - target: i686-unknown-linux-musl
+            can-test: false
+          - target: i686-unknown-freebsd
+            can-test: false
+          - target: armv7-unknown-linux-gnueabihf
+            can-test: true
+          - target: armv7-unknown-linux-musleabihf
+            can-test: true
+          - target: powerpc-unknown-linux-gnu
+            can-test: true
+          - target: mips-unknown-linux-gnu
+            can-test: true
+          - target: mips-unknown-linux-musl
+            can-test: true
+          - target: mipsel-unknown-linux-gnu
+            can-test: true
+          - target: mipsel-unknown-linux-musl
+            can-test: true
     runs-on: ubuntu-latest
-    needs: [ deps ]
+    needs: [ setup ]
     steps:
       - uses: actions/checkout@v3
       - name: Get deps from cache
@@ -363,10 +304,11 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: |
-          cargo prebuilt cross
-          cross --version
+        with:
+          tools: cross
+      - name: Run tests
+        if: ${{ matrix.can-test }}
+        run: cross test --verbose --workspace --all-features --locked --target ${{ matrix.target }}
       - name: Build
         run: cross build --verbose --workspace --locked --target ${{ matrix.target }}
       - name: Artifact
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index 5bbcf4a..b426269 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -1,7 +1,7 @@
 name: Rust Checks
 ## Name: Rust Checks
 ## Author: harmless-tech
-## Version: cache-based-1.0.0
+## Version: cache-based-1.2.0
 ## Git Repo: https://github.com/harmless-tech/rust-github-actions
 
 on:
@@ -12,7 +12,7 @@ on:
   workflow_dispatch:
 
 env:
-  CARGO_TERM_COLOR: always
+  CARGO_TERM_COLOR: never
 
 jobs:
   fmt-check:
@@ -22,9 +22,21 @@ jobs:
       - name: Install nightly
         run: rustup toolchain install nightly --allow-downgrade -c rustfmt
       - name: Rustfmt Check
-        run: cargo +nightly fmt --check
+        run: |
+          set -o pipefail
+          cargo +nightly fmt --check 2>&1 | tee .step-data.txt
+      - name: Put into summary (success)
+        if: success()
+        run: echo "Success" >> $GITHUB_STEP_SUMMARY
+      - name: Put into summary (failure)
+        if: failure()
+        run: |
+          echo "Failed!" >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`shell" >> $GITHUB_STEP_SUMMARY
+          cat .step-data.txt >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
 
-  clippy-check:
+  clippy-x86_64-unknown-linux-gnu:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
@@ -35,10 +47,82 @@ jobs:
             ~/.cargo/registry/cache
             ~/.cargo/git/db
             target
-          key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }}
+          key: ${{ runner.os }}-clippy-x86_64-unknown-linux-gnu-${{ hashFiles('**/Cargo.lock') }}
       - name: Update Rust
         run: rustup update
       - name: Rust Version
         run: rustc --version
       - name: Clippy Check
-        run: cargo clippy --all-targets --all-features --verbose --workspace --locked -- -D warnings
+        run: |
+          set -o pipefail
+          cargo clippy --all-targets --all-features --verbose --workspace --locked -- -D warnings 2>&1 | tee .step-data.txt
+      - name: Put into summary (success)
+        if: success()
+        run: echo "Success" >> $GITHUB_STEP_SUMMARY
+      - name: Put into summary (failure)
+        if: failure()
+        run: |
+          echo "Failed!" >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`shell" >> $GITHUB_STEP_SUMMARY
+          cat .step-data.txt >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+
+  clippy-x86_64-apple-darwin:
+    runs-on: macos-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/cache@v3
+        with:
+          path: |
+            ~/.cargo/registry/index
+            ~/.cargo/registry/cache
+            ~/.cargo/git/db
+            target
+          key: ${{ runner.os }}-clippy-x86_64-apple-darwin-${{ hashFiles('**/Cargo.lock') }}
+      - name: Update Rust
+        run: rustup update
+      - name: Rust Version
+        run: rustc --version
+      - name: Clippy Check
+        run: |
+          set -o pipefail
+          cargo clippy --all-targets --all-features --verbose --workspace --locked -- -D warnings 2>&1 | tee .step-data.txt
+      - name: Put into summary (success)
+        if: success()
+        run: echo "Success" >> $GITHUB_STEP_SUMMARY
+      - name: Put into summary (failure)
+        if: failure()
+        run: |
+          echo "Failed!" >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`shell" >> $GITHUB_STEP_SUMMARY
+          cat .step-data.txt >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+
+  clippy-x86_64-pc-windows-msvc:
+    runs-on: windows-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/cache@v3
+        with:
+          path: |
+            ~/.cargo/registry/index
+            ~/.cargo/registry/cache
+            ~/.cargo/git/db
+            target
+          key: ${{ runner.os }}-clippy-x86_64-pc-windows-msvc-${{ hashFiles('**/Cargo.lock') }}
+      - name: Update Rust
+        run: rustup update
+      - name: Rust Version
+        run: rustc --version
+      - name: Clippy Check
+        run: cargo clippy --all-targets --all-features --verbose --workspace --locked -- -D warnings 2>&1 | tee .step-data.txt
+      - name: Put into summary (success)
+        if: success()
+        run: echo "Success" >> $env:GITHUB_STEP_SUMMARY
+      - name: Put into summary (failure)
+        if: failure()
+        run: |
+          echo "Failed!" >> $env:GITHUB_STEP_SUMMARY
+          "``````powershell" >> $env:GITHUB_STEP_SUMMARY
+          cat .step-data.txt >> $env:GITHUB_STEP_SUMMARY
+          "``````" >> $env:GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ab2ca03..6e2ffec 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,7 +1,7 @@
 name: Rust Build, Test, and Release
 ## Name: Rust Build, Test, and Release
 ## Author: harmless-tech
-## Version: cache-based-1.0.1
+## Version: cache-based-1.2.0
 ## Git Repo: https://github.com/harmless-tech/rust-github-actions
 
 on:
@@ -11,8 +11,8 @@ on:
   workflow_dispatch:
 
 env:
-  CARGO_TERM_COLOR: always
   bin-name: cargo-prebuilt
+  CARGO_TERM_COLOR: never
 
 jobs:
   check-fmt:
@@ -22,13 +22,96 @@ jobs:
       - name: Install nightly
         run: rustup toolchain install nightly --allow-downgrade -c rustfmt
       - name: Rustfmt Check
-        run: cargo +nightly fmt --check
+        run: |
+          set -o pipefail
+          cargo +nightly fmt --check 2>&1 | tee .step-data.txt
+      - name: Put into summary (success)
+        if: success()
+        run: echo "Success" >> $GITHUB_STEP_SUMMARY
+      - name: Put into summary (failure)
+        if: failure()
+        run: |
+          echo "Failed!" >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`shell" >> $GITHUB_STEP_SUMMARY
+          cat .step-data.txt >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
 
-  check-clippy:
+  clippy-x86_64-unknown-linux-gnu:
     runs-on: ubuntu-latest
-    needs: [ deps ]
+    needs: [ setup ]
+    steps:
+      - uses: actions/checkout@v3
+      - name: Get deps from cache
+        uses: actions/cache@v3
+        with:
+          path: |
+            .cargo-store
+          key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
+          enableCrossOsArchive: true
+          fail-on-cache-miss: true
+      - name: Move deps
+        run: mv ./.cargo-store/* ~/.cargo
+      - name: Update Rust
+        run: rustup update
+      - name: Rust Version
+        run: rustc --version
+      - name: Clippy Check
+        run: |
+          set -o pipefail
+          cargo clippy --all-targets --all-features --verbose --workspace --release --locked -- -D warnings 2>&1 | tee .step-data.txt
+      - name: Put into summary (success)
+        if: success()
+        run: echo "Success" >> $GITHUB_STEP_SUMMARY
+      - name: Put into summary (failure)
+        if: failure()
+        run: |
+          echo "Failed!" >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`shell" >> $GITHUB_STEP_SUMMARY
+          cat .step-data.txt >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+          
+  clippy-x86_64-apple-darwin:
+    runs-on: macos-latest
+    needs: [ setup ]
+    steps:
+      - uses: actions/checkout@v3
+      - name: Get deps from cache
+        uses: actions/cache@v3
+        with:
+          path: |
+            .cargo-store
+          key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
+          enableCrossOsArchive: true
+          fail-on-cache-miss: true
+      - name: Move deps
+        run: mv ./.cargo-store/* ~/.cargo
+      - name: Update Rust
+        run: rustup update
+      - name: Rust Version
+        run: rustc --version
+      - name: Clippy Check
+        run: |
+          set -o pipefail
+          cargo clippy --all-targets --all-features --verbose --workspace --release --locked -- -D warnings 2>&1 | tee .step-data.txt
+      - name: Put into summary (success)
+        if: success()
+        run: echo "Success" >> $GITHUB_STEP_SUMMARY
+      - name: Put into summary (failure)
+        if: failure()
+        run: |
+          echo "Failed!" >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`shell" >> $GITHUB_STEP_SUMMARY
+          cat .step-data.txt >> $GITHUB_STEP_SUMMARY
+          echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+
+  clippy-x86_64-pc-windows-msvc:
+    runs-on: windows-latest
+    needs: [ setup ]
     steps:
       - uses: actions/checkout@v3
+      - name: Change file endings in Cargo.lock
+        shell: pwsh
+        run: (Get-Content -Raw Cargo.lock) -replace "`r`n","`n" | Set-Content Cargo.lock -NoNewline
       - name: Get deps from cache
         uses: actions/cache@v3
         with:
@@ -44,9 +127,19 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - name: Clippy Check
-        run: cargo clippy --all-targets --all-features --verbose --workspace --release --locked -- -D warnings
+        run: cargo clippy --all-targets --all-features --verbose --workspace --release --locked -- -D warnings 2>&1 | tee .step-data.txt
+      - name: Put into summary (success)
+        if: success()
+        run: echo "Success" >> $env:GITHUB_STEP_SUMMARY
+      - name: Put into summary (failure)
+        if: failure()
+        run: |
+          echo "Failed!" >> $env:GITHUB_STEP_SUMMARY
+          "``````powershell" >> $env:GITHUB_STEP_SUMMARY
+          cat .step-data.txt >> $env:GITHUB_STEP_SUMMARY
+          "``````" >> $env:GITHUB_STEP_SUMMARY
 
-  deps:
+  setup:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
@@ -72,8 +165,8 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-audit
+        with:
+          tools: cargo-audit
       - name: Download Deps
         if: ${{ !steps.cache.outputs.cache-hit }}
         run: cargo fetch --verbose --locked
@@ -107,7 +200,7 @@ jobs:
       name: ${{ github.ref_name }}
       prerelease: ${{ steps.regex-tag.outputs.match == '' }}
     runs-on: ubuntu-latest
-    needs: [ check-fmt, check-clippy ]
+    needs: [ check-fmt, clippy-x86_64-unknown-linux-gnu, clippy-x86_64-apple-darwin, clippy-x86_64-pc-windows-msvc ]
     steps:
       - uses: actions/checkout@v3
       - uses: KyoriPowered/action-regex-match@v3
@@ -118,7 +211,7 @@ jobs:
 
   publish:
     runs-on: ubuntu-latest
-    needs: [ release, check-fmt, check-clippy, x86_64-unknown-linux-gnu, x86_64-apple-darwin, aarch64-apple-darwin, x86_64-pc-windows-msvc, aarch64-pc-windows-msvc, i686-pc-windows-msvc, cross ]
+    needs: [ release, check-fmt, clippy-x86_64-unknown-linux-gnu, clippy-x86_64-apple-darwin, clippy-x86_64-pc-windows-msvc, x86_64-unknown-linux-gnu, apple-darwin, pc-windows-msvc, cross ]
     steps:
       - uses: actions/checkout@v3
       - name: Get deps from cache
@@ -142,7 +235,7 @@ jobs:
 
   x86_64-unknown-linux-gnu:
     runs-on: ubuntu-latest
-    needs: [ deps, release ]
+    needs: [ setup, release ]
     steps:
       - uses: actions/checkout@v3
       - name: Get deps from cache
@@ -160,12 +253,16 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable,coreutils
+        with:
+          tools: cargo-auditable,coreutils
       - name: Run tests
         run: cargo test --verbose --workspace --all-features --release --locked
       - name: Build
         run: cargo auditable build --verbose --workspace --release --locked
+      - name: Run cargo-prebuilt
+        run: |
+          target/release/cargo-prebuilt just
+          just --version
       - name: Artifact
         uses: actions/upload-artifact@v3
         with:
@@ -193,62 +290,17 @@ jobs:
           file_glob: true
           file: x86_64-unknown-linux-gnu.*
 
-  x86_64-apple-darwin:
-    runs-on: macos-latest
-    needs: [ deps, release ]
-    steps:
-      - uses: actions/checkout@v3
-      - name: Get deps from cache
-        uses: actions/cache@v3
-        with:
-          path: |
-            .cargo-store
-          key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
-          enableCrossOsArchive: true
-          fail-on-cache-miss: true
-      - name: Move deps
-        run: mv ./.cargo-store/* ~/.cargo
-      - name: Update Rust
-        run: rustup update
-      - name: Rust Version
-        run: rustc --version
-      - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable,coreutils
-      - name: Run tests
-        run: cargo test --verbose --workspace --all-features --release --locked
-      - name: Build
-        run: cargo auditable build --verbose --workspace --release --locked
-      - name: Artifact
-        uses: actions/upload-artifact@v3
-        with:
-          name: x86_64-apple-darwin
-          path: |
-            target/release/${{ env.bin-name }}
-      - name: Tar
-        run: tar czvf x86_64-apple-darwin.tar.gz -C ./target/release ${{ env.bin-name }}
-      - name: Hash
-        run: echo "$(coreutils sha256sum x86_64-apple-darwin.tar.gz)" > x86_64-apple-darwin.sha256
-      - name: Artifact
-        uses: actions/upload-artifact@v3
-        with:
-          name: x86_64-apple-darwin
-          path: |
-            x86_64-apple-darwin.tar.gz
-            x86_64-apple-darwin.sha256
-      - name: Release Artifact
-        uses: svenstaro/upload-release-action@2.5.0
-        with:
-          tag: ${{ needs.release.outputs.tag }}
-          release_name: ${{ needs.release.outputs.name }}
-          overwrite: true
-          prerelease: ${{ needs.release.outputs.prerelease }}
-          file_glob: true
-          file: x86_64-apple-darwin.*
-
-  aarch64-apple-darwin:
+  apple-darwin:
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - target: x86_64-apple-darwin
+            can-test: true
+          - target: aarch64-apple-darwin
+            can-test: false
     runs-on: macos-latest
-    needs: [ deps, release ]
+    needs: [ setup, release ]
     steps:
       - uses: actions/checkout@v3
       - name: Get deps from cache
@@ -266,88 +318,37 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - name: Add Rust target
-        run: rustup target add aarch64-apple-darwin
+        run: rustup target add ${{ matrix.target }}
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable,coreutils
-      - name: Build
-        run: cargo auditable build --verbose --workspace --release --locked --target aarch64-apple-darwin
-      - name: Artifact
-        uses: actions/upload-artifact@v3
         with:
-          name: aarch64-apple-darwin
-          path: |
-            target/aarch64-apple-darwin/release/${{ env.bin-name }}
-      - name: Tar
-        run: tar czvf aarch64-apple-darwin.tar.gz -C ./target/aarch64-apple-darwin/release ${{ env.bin-name }}
-      - name: Hash
-        run: echo "$(coreutils sha256sum aarch64-apple-darwin.tar.gz)" > aarch64-apple-darwin.sha256
-      - name: Artifact
-        uses: actions/upload-artifact@v3
-        with:
-          name: aarch64-apple-darwin
-          path: |
-            aarch64-apple-darwin.tar.gz
-            aarch64-apple-darwin.sha256
-      - name: Release Artifact
-        uses: svenstaro/upload-release-action@2.5.0
-        with:
-          tag: ${{ needs.release.outputs.tag }}
-          release_name: ${{ needs.release.outputs.name }}
-          overwrite: true
-          prerelease: ${{ needs.release.outputs.prerelease }}
-          file_glob: true
-          file: aarch64-apple-darwin.*
-
-  x86_64-pc-windows-msvc:
-    runs-on: windows-latest
-    needs: [ deps, release ]
-    steps:
-      - uses: actions/checkout@v3
-      - name: Change file endings in Cargo.lock
-        shell: pwsh
-        run: (Get-Content -Raw Cargo.lock) -replace "`r`n","`n" | Set-Content Cargo.lock -NoNewline
-      - name: Get deps from cache
-        uses: actions/cache@v3
-        with:
-          path: |
-            .cargo-store
-          key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
-          enableCrossOsArchive: true
-          fail-on-cache-miss: true
-      - name: Move deps
-        run: mv ./.cargo-store/* ~/.cargo
-      - name: Update Rust
-        run: rustup update
-      - name: Rust Version
-        run: rustc --version
-      - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable,coreutils
+          tools: cargo-auditable,coreutils
       - name: Run tests
-        run: cargo test --verbose --workspace --all-features --release --locked
+        if: ${{ matrix.can-test }}
+        run: cargo test --verbose --workspace --all-features --release --locked --target ${{ matrix.target }}
       - name: Build
-        run: cargo auditable build --verbose --workspace --release --locked
+        run: cargo auditable build --verbose --workspace --release --locked --target ${{ matrix.target }}
+      - name: Run cargo-prebuilt
+        if: ${{ matrix.can-test }}
+        run: |
+          target/${{ matrix.target }}/release/${{ env.bin-name }} just
+          just --version
       - name: Artifact
         uses: actions/upload-artifact@v3
         with:
-          name: x86_64-pc-windows-msvc
+          name: ${{ matrix.target }}
           path: |
-            target/release/${{ env.bin-name }}.exe
-      - name: Zip
-        uses: vimtor/action-zip@v1.1
-        with:
-          files: ./target/release/${{ env.bin-name }}.exe
-          dest: x86_64-pc-windows-msvc.zip
+            target/${{ matrix.target }}/release/${{ env.bin-name }}
+      - name: Tar
+        run: tar czvf ${{ matrix.target }}.tar.gz -C ./target/${{ matrix.target }}/release ${{ env.bin-name }}
       - name: Hash
-        run: echo "$(coreutils sha256sum x86_64-pc-windows-msvc.zip)" > x86_64-pc-windows-msvc.sha256
+        run: echo "$(coreutils sha256sum ${{ matrix.target }}.tar.gz)" > ${{ matrix.target }}.sha256
       - name: Artifact
         uses: actions/upload-artifact@v3
         with:
-          name: x86_64-pc-windows-msvc
+          name: ${{ matrix.target }}
           path: |
-            x86_64-pc-windows-msvc.zip
-            x86_64-pc-windows-msvc.sha256
+            ${{ matrix.target }}.tar.gz
+            ${{ matrix.target }}.sha256
       - name: Release Artifact
         uses: svenstaro/upload-release-action@2.5.0
         with:
@@ -356,11 +357,21 @@ jobs:
           overwrite: true
           prerelease: ${{ needs.release.outputs.prerelease }}
           file_glob: true
-          file: x86_64-pc-windows-msvc.*
+          file: ${{ matrix.target }}.*
 
-  aarch64-pc-windows-msvc:
+  pc-windows-msvc:
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - target: x86_64-pc-windows-msvc
+            can-test: true
+          - target: aarch64-pc-windows-msvc
+            can-test: false
+          - target: i686-pc-windows-msvc
+            can-test: true
     runs-on: windows-latest
-    needs: [ deps, release ]
+    needs: [ setup, release ]
     steps:
       - uses: actions/checkout@v3
       - name: Change file endings in Cargo.lock
@@ -381,93 +392,40 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - name: Add Rust target
-        run: rustup target add aarch64-pc-windows-msvc
+        run: rustup target add ${{ matrix.target }}
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable,coreutils
-      - name: Build
-        run: cargo auditable build --verbose --workspace --release --locked --target aarch64-pc-windows-msvc
-      - name: Artifact
-        uses: actions/upload-artifact@v3
-        with:
-          name: aarch64-pc-windows-msvc
-          path: |
-            target/aarch64-pc-windows-msvc/release/${{ env.bin-name }}.exe
-      - name: Zip
-        uses: vimtor/action-zip@v1.1
-        with:
-          files: ./target/aarch64-pc-windows-msvc/release/${{ env.bin-name }}.exe
-          dest: aarch64-pc-windows-msvc.zip
-      - name: Hash
-        run: echo "$(coreutils sha256sum aarch64-pc-windows-msvc.zip)" > aarch64-pc-windows-msvc.sha256
-      - name: Artifact
-        uses: actions/upload-artifact@v3
-        with:
-          name: aarch64-pc-windows-msvc
-          path: |
-            aarch64-pc-windows-msvc.zip
-            aarch64-pc-windows-msvc.sha256
-      - name: Release Artifact
-        uses: svenstaro/upload-release-action@2.5.0
         with:
-          tag: ${{ needs.release.outputs.tag }}
-          release_name: ${{ needs.release.outputs.name }}
-          overwrite: true
-          prerelease: ${{ needs.release.outputs.prerelease }}
-          file_glob: true
-          file: aarch64-pc-windows-msvc.*
-
-  i686-pc-windows-msvc:
-    runs-on: windows-latest
-    needs: [ deps, release ]
-    steps:
-      - uses: actions/checkout@v3
-      - name: Change file endings in Cargo.lock
-        shell: pwsh
-        run: (Get-Content -Raw Cargo.lock) -replace "`r`n","`n" | Set-Content Cargo.lock -NoNewline
-      - name: Get deps from cache
-        uses: actions/cache@v3
-        with:
-          path: |
-            .cargo-store
-          key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
-          enableCrossOsArchive: true
-          fail-on-cache-miss: true
-      - name: Move deps
-        run: mv ./.cargo-store/* ~/.cargo
-      - name: Update Rust
-        run: rustup update
-      - name: Rust Version
-        run: rustc --version
-      - name: Add Rust target
-        run: rustup target add i686-pc-windows-msvc
-      - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: cargo prebuilt cargo-auditable,coreutils
+          tools: cargo-auditable,coreutils
       - name: Run tests
-        run: cargo test --verbose --workspace --all-features --release --locked --target i686-pc-windows-msvc
+        if: ${{ matrix.can-test }}
+        run: cargo test --verbose --workspace --all-features --release --locked --target ${{ matrix.target }}
       - name: Build
-        run: cargo auditable build --verbose --workspace --release --locked --target i686-pc-windows-msvc
+        run: cargo auditable build --verbose --workspace --release --locked --target ${{ matrix.target }}
+      - name: Run cargo-prebuilt
+        if: ${{ matrix.can-test }}
+        run: |
+          target/${{ matrix.target }}/release/${{ env.bin-name }} just
+          just --version
       - name: Artifact
         uses: actions/upload-artifact@v3
         with:
-          name: i686-pc-windows-msvc
+          name: ${{ matrix.target }}
           path: |
-            target/i686-pc-windows-msvc/release/${{ env.bin-name }}.exe
+            target/${{ matrix.target }}/release/${{ env.bin-name }}.exe
       - name: Zip
         uses: vimtor/action-zip@v1.1
         with:
-          files: ./target/i686-pc-windows-msvc/release/${{ env.bin-name }}.exe
-          dest: i686-pc-windows-msvc.zip
+          files: ./target/${{ matrix.target }}/release/${{ env.bin-name }}.exe
+          dest: ${{ matrix.target }}.zip
       - name: Hash
-        run: echo "$(coreutils sha256sum i686-pc-windows-msvc.zip)" > i686-pc-windows-msvc.sha256
+        run: echo "$(coreutils sha256sum ${{ matrix.target }}.zip)" > ${{ matrix.target }}.sha256
       - name: Artifact
         uses: actions/upload-artifact@v3
         with:
-          name: i686-pc-windows-msvc
+          name: ${{ matrix.target }}
           path: |
-            i686-pc-windows-msvc.zip
-            i686-pc-windows-msvc.sha256
+            ${{ matrix.target }}.zip
+            ${{ matrix.target }}.sha256
       - name: Release Artifact
         uses: svenstaro/upload-release-action@2.5.0
         with:
@@ -476,40 +434,65 @@ jobs:
           overwrite: true
           prerelease: ${{ needs.release.outputs.prerelease }}
           file_glob: true
-          file: i686-pc-windows-msvc.*
+          file: ${{ matrix.target }}.*
 
   cross:
     strategy:
       fail-fast: false
       matrix:
-        target:
-          - x86_64-unknown-linux-musl
-          - aarch64-unknown-linux-gnu
-          - aarch64-unknown-linux-musl
-          - x86_64-unknown-freebsd
-          - x86_64-unknown-netbsd
-          - x86_64-unknown-illumos
-          - x86_64-sun-solaris
-          - riscv64gc-unknown-linux-gnu
-          - powerpc64-unknown-linux-gnu
-          - powerpc64le-unknown-linux-gnu
-          - s390x-unknown-linux-gnu
-          - mips64-unknown-linux-gnuabi64
-          - mips64-unknown-linux-muslabi64
-          - mips64el-unknown-linux-gnuabi64
-          - mips64el-unknown-linux-muslabi64
-          - i686-unknown-linux-gnu
-          - i686-unknown-linux-musl
-          - i686-unknown-freebsd
-          - armv7-unknown-linux-gnueabihf
-          - armv7-unknown-linux-musleabihf
-          - powerpc-unknown-linux-gnu
-          - mips-unknown-linux-gnu
-          - mips-unknown-linux-musl
-          - mipsel-unknown-linux-gnu
-          - mipsel-unknown-linux-musl
+        include:
+          - target: x86_64-unknown-linux-musl
+            can-test: true
+          - target: aarch64-unknown-linux-gnu
+            can-test: true
+          - target: aarch64-unknown-linux-musl
+            can-test: true
+          - target: x86_64-unknown-freebsd
+            can-test: false
+          - target: x86_64-unknown-netbsd
+            can-test: false
+          - target: x86_64-unknown-illumos
+            can-test: false
+          - target: x86_64-sun-solaris
+            can-test: false
+          - target: riscv64gc-unknown-linux-gnu
+            can-test: true
+          - target: powerpc64-unknown-linux-gnu
+            can-test: true
+          - target: powerpc64le-unknown-linux-gnu
+            can-test: true
+          - target: s390x-unknown-linux-gnu
+            can-test: true
+          - target: mips64-unknown-linux-gnuabi64
+            can-test: true
+          - target: mips64-unknown-linux-muslabi64
+            can-test: true
+          - target: mips64el-unknown-linux-gnuabi64
+            can-test: true
+          - target: mips64el-unknown-linux-muslabi64
+            can-test: true
+          - target: i686-unknown-linux-gnu
+            can-test: false
+          - target: i686-unknown-linux-musl
+            can-test: false
+          - target: i686-unknown-freebsd
+            can-test: false
+          - target: armv7-unknown-linux-gnueabihf
+            can-test: true
+          - target: armv7-unknown-linux-musleabihf
+            can-test: true
+          - target: powerpc-unknown-linux-gnu
+            can-test: true
+          - target: mips-unknown-linux-gnu
+            can-test: true
+          - target: mips-unknown-linux-musl
+            can-test: true
+          - target: mipsel-unknown-linux-gnu
+            can-test: true
+          - target: mipsel-unknown-linux-musl
+            can-test: true
     runs-on: ubuntu-latest
-    needs: [ deps, release ]
+    needs: [ setup, release ]
     steps:
       - uses: actions/checkout@v3
       - name: Get deps from cache
@@ -527,10 +510,11 @@ jobs:
       - name: Rust Version
         run: rustc --version
       - uses: crow-rest/cargo-prebuilt-action@v1
-      - name: Install tools
-        run: |
-          cargo prebuilt cross,coreutils
-          cross --version
+        with:
+          tools: cross,coreutils
+      - name: Run tests
+        if: ${{ matrix.can-test }}
+        run: cross test --verbose --workspace --all-features --release --locked --target ${{ matrix.target }}
       - name: Build
         run: cross build --verbose --workspace --release --locked --target ${{ matrix.target }}
       - name: Artifact
diff --git a/Cargo.lock b/Cargo.lock
index 8dca6b7..0f30ef6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -43,10 +43,11 @@ dependencies = [
 
 [[package]]
 name = "cargo-prebuilt"
-version = "0.4.0"
+version = "0.4.1"
 dependencies = [
  "flate2",
  "hex",
+ "home",
  "native-tls",
  "sha2",
  "tar",
@@ -211,6 +212,15 @@ version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
 
+[[package]]
+name = "home"
+version = "0.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408"
+dependencies = [
+ "winapi",
+]
+
 [[package]]
 name = "idna"
 version = "0.3.0"
@@ -232,9 +242,9 @@ dependencies = [
 
 [[package]]
 name = "io-lifetimes"
-version = "1.0.5"
+version = "1.0.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
+checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3"
 dependencies = [
  "libc",
  "windows-sys 0.45.0",
diff --git a/Cargo.toml b/Cargo.toml
index f9b65e4..9c50de1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cargo-prebuilt"
-version = "0.4.0"
+version = "0.4.1"
 edition = "2021"
 authors = ["harmless-tech"]
 description = "Download prebuilt crate binaries for many different platforms"
@@ -22,6 +22,7 @@ exclude = [
 [dependencies]
 flate2 = "1.0.25"
 hex = "0.4.3"
+home = "0.5.4"
 native-tls = { version = "0.2.11", features = ["vendored"] }
 sha2 = "0.10.6"
 tar = "0.4.38"
diff --git a/README.md b/README.md
index d09e69f..55883da 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ To download a version of a crate:
 To download multiple crates with versions:
 ```cargo prebuilt CRATE_1@V1,CRATE_2,CRATE_3@V3,...```
 
-Crates will always be installed into the $CARGO_HOME/bin directory, unless you do:
+Crates will always be installed into the $CARGO_HOME/bin directory, unless you do then it will be installed to $CARGO_HOME:
 ```CARGO_HOME=DIR cargo prebuilt --no-bin CRATES```
 
 To install crates that are different from the host target do:
@@ -35,6 +35,9 @@ To install crates that are different from the host target do:
 For CI systems (This disables all reports):
 ```cargo prebuilt --ci CRATES```
 
+To disallow the creation of missing dirs (except for reports):
+```cargo prebuilt --no-create CRATES```
+
 To select reports:
 ```cargo prebuilt --reports=CSV CRATES```
 
@@ -58,5 +61,6 @@ You can download prebuilt binaries of cargo-prebuilt [here](https://github.com/c
 
 ## Current Limitations
 
+- Cargo detection has not been tested on windows.
 - When using a crate version it must be the exact semver version.
 - Does not use *cargo install* as a backup.
diff --git a/rustfmt.toml b/rustfmt.toml
index 34e8f93..a5faf38 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,6 +1,7 @@
 unstable_features = true
 newline_style = "Native"
-reorder_imports = true
 control_brace_style = "ClosingNextLine"
+single_line_if_else_max_width = 100
+reorder_imports = true
 imports_granularity = "Crate"
 edition = "2021"
diff --git a/src/main.rs b/src/main.rs
index 9c6b6ae..f9497a4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,11 +1,16 @@
+#[cfg(test)]
+mod test;
+
 use flate2::read::GzDecoder;
 use sha2::{Digest, Sha256};
 use std::{
-    convert::Into,
     env,
+    ffi::OsString,
+    fs,
     fs::{create_dir_all, File},
     io::{Read, Write},
     path::{Path, PathBuf},
+    process::Command,
     str,
     string::ToString,
     sync::Arc,
@@ -45,6 +50,7 @@ fn main() -> Result<(), String> {
     let mut target = TARGET.to_string();
     let mut no_bin = false;
     let mut ci = false;
+    let mut no_create_ch = false;
     let mut reports = vec!["license-dl".to_string()];
     for mut arg in args {
         if arg.starts_with("--") {
@@ -58,6 +64,9 @@ fn main() -> Result<(), String> {
             else if arg.eq("--ci") {
                 ci = true;
             }
+            else if arg.eq("--no-create") {
+                no_create_ch = true;
+            }
             else if arg.starts_with("--reports=") {
                 arg.replace_range(0..10, "");
                 reports = arg
@@ -93,30 +102,15 @@ fn main() -> Result<(), String> {
     let no_bin = no_bin;
 
     // Get location to install binaries to
-    let mut cargo_home = PathBuf::from(env::var_os("CARGO_HOME").unwrap_or_else(|| {
-        #[rustfmt::skip]
-        let ext = if TARGET.contains("windows") { ".exe" } else { "" };
-        match File::open(format!("~/.cargo/bin/cargo{ext}")) {
-            Ok(_) => {
-                println!("Detected cargo in ~/.cargo/bin/. Will install here.");
-                "~/.cargo".into()
-            }
-            Err(_) => match File::open(format!("/usr/local/cargo/bin/cargo{ext}")) {
-                Ok(_) => {
-                    println!("Detected cargo in /usr/local/cargo/bin/. Will install here.");
-                    "/usr/local/cargo".into()
-                }
-                Err(_) => {
-                    println!("Could not detect cargo, please set the CARGO_HOME env variable.");
-                    std::process::exit(-22);
-                }
-            },
-        }
-    }));
-    if !no_bin {
+    let mut cargo_home = detect_cargo();
+    if !no_bin && !cargo_home.ends_with("bin") {
         cargo_home.push("bin");
     }
     let cargo_bin = cargo_home;
+    if !no_create_ch && create_dir_all(&cargo_bin).is_err() {
+        println!("Could not create the dirs {cargo_bin:?}.");
+        std::process::exit(-44);
+    }
 
     let agent = ureq::AgentBuilder::new()
         .tls_connector(Arc::new(
@@ -181,53 +175,53 @@ fn main() -> Result<(), String> {
         let base_url = format!("{DOWNLOAD_URL}/{id}-{version}/");
         let pre_url = format!("{base_url}{target}");
 
-        let mut tar_bytes: Vec<u8> = Vec::new();
-        println!("Downloading {id} {version} from {pre_url}.tar.gz");
-        match agent.get(&format!("{pre_url}.tar.gz")).call() {
+        let sha_hash = match agent.get(&format!("{pre_url}.sha256")).call() {
             Ok(response) => {
-                response
-                    .into_reader()
-                    .read_to_end(&mut tar_bytes)
-                    .expect("Failed when reading in tar.gz bytes.");
+                let s = response.into_string().expect("Malformed hash string.");
+                s.trim().to_string()
             }
             Err(Error::Status(code, _)) => {
                 if code == 404 {
-                    println!("Crate {id}, version {version}, and target {target} was not found!");
-                    std::process::exit(-6);
+                    println!(
+                        "Crate {id}, version {version}, and target {target} was not found! (Hash)",
+                    );
+                    std::process::exit(-9);
                 }
                 else {
                     println!("Error {code} for crate {id}.");
-                    std::process::exit(-7);
+                    std::process::exit(-10);
                 }
             }
             Err(_) => {
                 println!("Connection error.");
-                std::process::exit(-8);
+                std::process::exit(-11);
             }
-        }
+        };
 
-        let sha_hash = match agent.get(&format!("{pre_url}.sha256")).call() {
+        let mut tar_bytes: Vec<u8> = Vec::new();
+        println!("Downloading {id} {version} from {pre_url}.tar.gz");
+        match agent.get(&format!("{pre_url}.tar.gz")).call() {
             Ok(response) => {
-                let s = response.into_string().expect("Malformed hash string.");
-                s.trim().to_string()
+                response
+                    .into_reader()
+                    .read_to_end(&mut tar_bytes)
+                    .expect("Failed when reading in tar.gz bytes.");
             }
             Err(Error::Status(code, _)) => {
                 if code == 404 {
-                    println!(
-                        "Crate {id}, version {version}, and target {target} was not found! (Hash)",
-                    );
-                    std::process::exit(-9);
+                    println!("Crate {id}, version {version}, and target {target} was not found!");
+                    std::process::exit(-6);
                 }
                 else {
                     println!("Error {code} for crate {id}.");
-                    std::process::exit(-10);
+                    std::process::exit(-7);
                 }
             }
             Err(_) => {
                 println!("Connection error.");
-                std::process::exit(-11);
+                std::process::exit(-8);
             }
-        };
+        }
 
         // Check hash
         let mut hasher = Sha256::new();
@@ -255,7 +249,9 @@ fn main() -> Result<(), String> {
 
                     e.unpack(&path)
                         .expect("Could not extract binaries from downloaded tar archive");
-                    println!("Added {path:?}.");
+
+                    let abs = fs::canonicalize(path).expect("Could not canonicalize install path");
+                    println!("Added {abs:?}.");
                 }
             }
             Err(_) => {
@@ -276,7 +272,7 @@ fn main() -> Result<(), String> {
             let audit_dl = reports.contains(&REPORT_FLAGS[5].to_string());
 
             let mut report_path = cargo_bin.clone();
-            report_path.push(format!("prebuilt/reports/{id}/{version}"));
+            report_path.push(format!(".prebuilt/reports/{id}/{version}"));
             let report_path = report_path;
 
             // license.report
@@ -311,6 +307,81 @@ fn main() -> Result<(), String> {
     Ok(())
 }
 
+fn detect_cargo() -> PathBuf {
+    // Use CARGO_HOME env var.
+    if let Some(home) = env::var_os("CARGO_HOME") {
+        return PathBuf::from(home);
+    }
+
+    // Try to find CARGO_HOME by searching for cargo executable in common paths.
+    let ext = if TARGET.contains("windows") { ".exe" } else { "" };
+    let mut home_cargo_dir = home::home_dir().unwrap_or_else(|| PathBuf::from("~"));
+    home_cargo_dir.push(".cargo/bin/cargo");
+    for path in [
+        home_cargo_dir,
+        PathBuf::from(format!("/usr/local/cargo/bin/cargo{ext}")),
+    ]
+    .iter_mut()
+    {
+        if File::open(&path).is_ok() {
+            let abs = fs::canonicalize(&path).expect("Could not canonicalize cargo path");
+            println!("Detected cargo at {abs:?}. Will install into this folder.");
+
+            path.pop(); // Remove cargo executable.
+            if path.ends_with("bin") {
+                // Remove bin if the folder is appended.
+                path.pop();
+            }
+            return path.clone();
+        }
+    }
+
+    // Try to find CARGO_HOME by using which/where.exe to get where the cargo executable is.
+    #[cfg(target_family = "unix")]
+    {
+        use std::os::unix::ffi::OsStringExt;
+
+        println!("WARN: Using which to find cargo and then deduce CARGO_HOME.");
+
+        let out = Command::new("sh")
+            .args(["-c", "which cargo"])
+            .output()
+            .expect("Could not use which to detect where cargo is.");
+        if out.status.success() {
+            let mut path = PathBuf::from(OsString::from_vec(out.stdout));
+            path.pop(); // Remove cargo executable.
+            if path.ends_with("bin") {
+                // Remove bin if the folder is appended.
+                path.pop();
+            }
+            return path;
+        }
+    }
+    #[cfg(target_family = "windows")]
+    {
+        use std::os::windows::ffi::OsStringExt;
+
+        println!("WARN: Using where.exe to find cargo and then deduce CARGO_HOME.");
+
+        let out = Command::new("cmd")
+            .args(["/C", "where.exe cargo.exe"])
+            .output()
+            .expect("Could not use where.exe to detect where cargo is.");
+        if out.status.success() {
+            let p_vec: Vec<u16> = out.stdout.iter().map(|a| *a as u16).collect();
+            let mut path = PathBuf::from(OsString::from_wide(&p_vec));
+            path.pop(); // Remove cargo executable.
+            if path.ends_with("bin") {
+                path.pop();
+            } // Remove bin if the folder is appended.
+            return path;
+        }
+    }
+
+    println!("Platform does not support which/where.exe detection of cargo. Please set the CARGO_HOME env var.");
+    std::process::exit(-122);
+}
+
 fn handle_report(
     agent: &Agent,
     name: &str,
@@ -329,6 +400,7 @@ fn handle_report(
                         if out {
                             println!("{name}.report:\n{s}");
                         }
+
                         if dl {
                             let mut dir = report_path.to_path_buf();
                             match create_dir_all(&dir) {


Test patch:
diff --git a/src/test.rs b/src/test.rs
new file mode 100644
index 0000000..8ab1fbe
--- /dev/null
+++ b/src/test.rs
@@ -0,0 +1,4 @@
+#[test]
+fn test() {
+    assert_eq!(1, 1)
+}