Skip to content

Commit e947e8d

Browse files
authored
Revert "[PM-29567] Pin binary cargo tools via cargo-run-bin (#1143)"
This reverts commit a2734ac.
1 parent a2734ac commit e947e8d

13 files changed

Lines changed: 59 additions & 131 deletions

File tree

.github/renovate.json5

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,14 @@
55
enabledManagers: ["cargo", "dockerfile", "github-actions", "npm", "nuget", "custom.regex"],
66
regexManagers: [
77
{
8-
// Pinned binary cargo tools declared in [workspace.metadata.bin].
9-
// Matches only crates.io-sourced entries (git-pinned tools have `git =`
10-
// immediately after the version field, so they are skipped here and
11-
// remain manually managed).
12-
fileMatch: ["^Cargo\\.toml$"],
13-
matchStrings: [
14-
'(?<depName>[a-z][a-z0-9_-]*)\\s*=\\s*\\{\\s*version\\s*=\\s*"=?(?<currentValue>\\d+\\.\\d+\\.\\d+)"\\s*,\\s*locked\\s*=\\s*true',
15-
],
16-
datasourceTemplate: "crate",
17-
versioningTemplate: "cargo",
18-
},
19-
{
20-
// Bootstrap pin for cargo-run-bin in CI workflows.
218
fileMatch: ["^\\.github/workflows/.*\\.ya?ml$"],
229
matchStrings: [
23-
"cargo install (?<depName>cargo-run-bin) --locked --version (?<currentValue>\\d+\\.\\d+\\.\\d+)",
10+
"cargo install (?<depName>cargo-dylint) (?:[\\w-]+ )?--version (?<currentValue>\\d+\\.\\d+\\.\\d+) --locked",
11+
"cargo install (?<depName>dylint-link) (?:[\\w-]+ )?--version (?<currentValue>\\d+\\.\\d+\\.\\d+) --locked",
12+
"cargo install (?<depName>cargo-sort) --version (?<currentValue>\\d+\\.\\d+\\.\\d+) --locked",
13+
"cargo install (?<depName>cargo-udeps) --version (?<currentValue>\\d+\\.\\d+\\.\\d+) --locked",
2414
],
25-
datasourceTemplate: "crate",
15+
datasourceTemplate: "cargo",
2616
versioningTemplate: "cargo",
2717
},
2818
],

.github/workflows/build-android.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ jobs:
4747
with:
4848
key: ${{ matrix.settings.target }}-cargo
4949

50-
- name: Install cargo-run-bin
51-
run: cargo install cargo-run-bin --locked --version 1.7.4
50+
- name: Install Cross
51+
run: cargo install cross --locked --git https://github.com/cross-rs/cross.git --rev 185398b1b885820515a212de720a306b08e2c8c9
5252

5353
- name: Build
5454
env:
5555
TARGET: ${{ matrix.settings.target }}
56-
run: cargo bin cross build -p bitwarden-uniffi --release --target=${{ matrix.settings.target }}
56+
run: cross build -p bitwarden-uniffi --release --target=${{ matrix.settings.target }}
5757

5858
- name: Upload artifact
5959
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0

.github/workflows/build-rust-crates.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ jobs:
7373
- name: Cache cargo registry
7474
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
7575

76-
- name: Install cargo-run-bin
77-
run: cargo install cargo-run-bin --locked --version 1.7.4
76+
- name: Install cargo-release
77+
run: cargo install cargo-release --version 0.25.20 --locked
7878

7979
- name: Cargo release dry run
80-
run: cargo bin cargo-release release publish --no-publish -p bitwarden-api-api -p bitwarden-api-identity -p bitwarden
80+
run: cargo-release release publish --no-publish -p bitwarden-api-api -p bitwarden-api-identity -p bitwarden

.github/workflows/check-powerset.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ jobs:
3737
- name: Cache cargo registry
3838
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
3939

40-
- name: Install cargo-run-bin
41-
run: cargo install cargo-run-bin --locked --version 1.7.4
40+
- name: Install cargo-hack
41+
run: cargo install cargo-hack --version 0.6.33 --locked
4242

4343
- name: Build
44-
run: cargo bin cargo-hack check --workspace --feature-powerset --no-dev-deps
44+
run: cargo hack check --workspace --feature-powerset --no-dev-deps
4545
env:
4646
RUSTFLAGS: "-D warnings"

.github/workflows/lint.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ jobs:
4242
needs_rust: true
4343
- check: sort
4444
needs_rust: true
45+
install: cargo install cargo-sort --version 2.0.2 --locked
4546
- check: udeps
4647
needs_rust: true
4748
needs_rust_nightly: true
49+
install: cargo install cargo-udeps --version 0.1.57 --locked
4850
- check: dylint
4951
needs_rust: true
52+
install: cargo install cargo-dylint dylint-link --version 5.0.0 --locked
5053
- check: doc
5154
needs_rust: true
5255
- check: prettier
@@ -97,32 +100,20 @@ jobs:
97100
if: matrix.needs_rust
98101
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
99102

100-
# Cache cargo-run-bin's built tools (.bin) separately from rust-cache. The
101-
# tools depend only on their pinned versions (Cargo.toml) and the toolchain,
102-
# not on Cargo.lock, so this key avoids rust-cache's lockfile rotation. Keyed
103-
# per check so each one caches only the tools it builds, with no contention
104-
# (rust-cache keys all matrix checks under one shared job-based key).
105-
- name: Cache cargo-run-bin tools
106-
if: matrix.needs_rust
107-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
108-
with:
109-
path: .bin
110-
key: cargo-bin-${{ runner.os }}-${{ matrix.check }}-${{ hashFiles('Cargo.toml', 'rust-toolchain.toml') }}
111-
restore-keys: |
112-
cargo-bin-${{ runner.os }}-${{ matrix.check }}-
103+
- name: Install per-check cargo tool
104+
if: matrix.install
105+
run: ${{ matrix.install }}
113106

114-
- name: Install cargo-run-bin
115-
if: matrix.needs_rust
116-
run: cargo install cargo-run-bin --locked --version 1.7.4
107+
- name: Install clippy-sarif and sarif-fmt
108+
if: matrix.check == 'clippy'
109+
run: cargo install clippy-sarif sarif-fmt --locked --git https://github.com/psastras/sarif-rs.git --rev 11c33a53f6ffeaed736856b86fb6b7b09fabdfd8
117110

118111
- name: Run clippy with SARIF output
119112
if: matrix.check == 'clippy'
120-
# Pass `-D warnings` to clippy directly rather than via RUSTFLAGS so the
121-
# deny level applies only to the linted crates, not to the from-source
122-
# builds of clippy-sarif/sarif-fmt that `cargo bin` triggers in this step
123-
# (some of their transitive deps emit warnings we don't control).
124-
run: cargo clippy --all-features --all-targets --message-format=json -- -D warnings |
125-
cargo bin clippy-sarif | tee clippy_result.sarif | cargo bin sarif-fmt
113+
env:
114+
RUSTFLAGS: "-D warnings"
115+
run: cargo clippy --all-features --all-targets --message-format=json |
116+
clippy-sarif | tee clippy_result.sarif | sarif-fmt
126117

127118
- name: Upload clippy results to GitHub
128119
if: matrix.check == 'clippy'

.github/workflows/rust-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ jobs:
105105
- name: Cache cargo registry
106106
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
107107

108-
- name: Install cargo-run-bin
109-
run: cargo install cargo-run-bin --locked --version 1.7.4
108+
- name: Install cargo-llvm-cov
109+
run: cargo install cargo-llvm-cov --version 0.5.38 --locked
110110

111111
- name: Generate coverage
112-
run: cargo bin cargo-llvm-cov --all-features --lcov --output-path lcov.info --ignore-filename-regex "crates/bitwarden-api-"
112+
run: cargo llvm-cov --all-features --lcov --output-path lcov.info --ignore-filename-regex "crates/bitwarden-api-"
113113

114114
- name: Upload to codecov.io
115115
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0

.github/workflows/version-bump.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
- name: Cache cargo registry
3636
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
3737

38-
- name: Install cargo-run-bin
39-
run: cargo install cargo-run-bin --locked --version 1.7.4
38+
- name: Install cargo-release
39+
run: cargo install cargo-edit --locked
4040

4141
- name: Log in to Azure
4242
uses: bitwarden/gh-actions/azure-login@main
@@ -95,14 +95,14 @@ jobs:
9595
if: ${{ inputs.project == 'bitwarden-core' }}
9696
env:
9797
VERSION_NUMBER: ${{ inputs.version_number }}
98-
run: cargo bin cargo-set-version -p bitwarden-core "$VERSION_NUMBER"
98+
run: cargo set-version -p bitwarden-core "$VERSION_NUMBER"
9999

100100
### bitwarden-sm
101101
- name: Bump bitwarden-sm crate Version
102102
if: ${{ inputs.project == 'bitwarden-sm' }}
103103
env:
104104
VERSION_NUMBER: ${{ inputs.version_number }}
105-
run: cargo bin cargo-set-version -p bitwarden-sm "$VERSION_NUMBER"
105+
run: cargo set-version -p bitwarden-sm "$VERSION_NUMBER"
106106

107107
############################
108108
# VERSION BUMP SECTION END #

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/target
2-
# cargo-run-bin per-tool build cache
3-
/.bin
42
.DS_Store
53
.pytest_cache
64
.vscode/c_cpp_properties.json

Cargo.toml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,6 @@ unexpected_cfgs = { level = "warn", check-cfg = [
143143
[workspace.metadata.dylint]
144144
libraries = [{ path = "support/lints" }]
145145

146-
# Pinned binary cargo tools used by CI and `scripts/lint.sh`.
147-
# Install the runner once with `cargo install cargo-run-bin --locked`, then
148-
# invoke any tool via `cargo bin <tool> <args>`. See README for details.
149-
[workspace.metadata.bin]
150-
cargo-sort = { version = "2.0.2", locked = true }
151-
cargo-udeps = { version = "0.1.57", locked = true }
152-
cargo-hack = { version = "0.6.33", locked = true }
153-
cargo-llvm-cov = { version = "0.5.38", locked = true }
154-
cargo-release = { version = "0.25.20", locked = true }
155-
cargo-edit = { version = "0.13.6", locked = true, bins = ["cargo-set-version"] }
156-
cargo-dylint = { version = "5.0.0", locked = true }
157-
dylint-link = { version = "5.0.0", locked = true }
158-
cross = { version = "0.2.5", git = "https://github.com/cross-rs/cross.git", rev = "185398b1b885820515a212de720a306b08e2c8c9", locked = true }
159-
clippy-sarif = { version = "0.4.2", git = "https://github.com/psastras/sarif-rs.git", rev = "11c33a53f6ffeaed736856b86fb6b7b09fabdfd8", locked = true }
160-
sarif-fmt = { version = "0.4.2", git = "https://github.com/psastras/sarif-rs.git", rev = "11c33a53f6ffeaed736856b86fb6b7b09fabdfd8", locked = true }
161-
162146
# Turn on a small amount of optimisation in development mode. This might interfere when trying to use a debugger
163147
# if the compiler decides to optimize some code away, if that's the case, it can be set to 0 or commented out
164148
[profile.dev]

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -454,17 +454,8 @@ The command is implemented in [scripts/lint.sh](./scripts/lint.sh) and mirrors
454454

455455
### Installation
456456

457-
Binary cargo tools (cargo-sort, cargo-udeps, cargo-dylint, etc.) are pinned in the root `Cargo.toml`
458-
under `[workspace.metadata.bin]` and installed lazily by
459-
[`cargo-run-bin`](https://crates.io/crates/cargo-run-bin), so dev and CI versions stay in sync.
460-
Bootstrap once:
461-
462-
```bash
463-
cargo install cargo-run-bin --locked
464-
```
465-
466-
After that, `npm run lint` (or `scripts/lint.sh` directly) handles installation of any missing tool
467-
on first invocation. The underlying tools are:
457+
The tools each check needs (and pinned versions) are installed in the lint workflow above. The
458+
underlying tools are:
468459

469460
- Nightly [cargo fmt](https://github.com/rust-lang/rustfmt) and
470461
[cargo udeps](https://github.com/est31/cargo-udeps)
@@ -473,7 +464,7 @@ on first invocation. The underlying tools are:
473464
- [cargo sort](https://github.com/DevinR528/cargo-sort)
474465
- [prettier](https://github.com/prettier/prettier)
475466

476-
If `cargo-run-bin` itself is missing locally, `npm run lint` will tell you how to install it.
467+
If a tool is missing locally, `npm run lint` will tell you which one and how to install it.
477468

478469
## Documentation
479470

0 commit comments

Comments
 (0)