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
80 changes: 65 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@ name: build
permissions:
contents: read

on: [push, pull_request]
on:
pull_request:
push:
branches:
- master

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
build:
permissions:
contents: none
name: CI
needs: [test, lockfile, rustfmt, clippy]
needs: [test, msrv, lockfile, rustfmt, clippy]
runs-on: ubuntu-latest
if: "always()"
steps:
Expand All @@ -30,58 +38,100 @@ jobs:
rust: ["stable"]
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
env:
# Reduce amount of data cached
CARGO_PROFILE_DEV_DEBUG: line-tables-only
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Initialize cache
uses: Swatinem/rust-cache@v2.9.1
- name: Install cargo-hack
uses: taiki-e/install-action@v2.75.4
with:
tool: cargo-hack
- name: Build
run: cargo test --no-run
run: cargo test --workspace --no-run
- name: Test
run: cargo test
run: cargo hack test --each-feature --workspace
msrv:
name: "Check MSRV"
strategy:
matrix:
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
- name: Initialize cache
uses: Swatinem/rust-cache@v2.9.1
- name: Install cargo-hack
uses: taiki-e/install-action@v2.75.4
with:
tool: cargo-hack
- name: Default features
run: cargo hack check --each-feature --locked --rust-version --ignore-private --workspace --all-targets --keep-going
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Initialize cache
uses: Swatinem/rust-cache@v2.9.1
- name: "Is lockfile updated?"
run: cargo update --workspace --locked
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Initialize cache
uses: Swatinem/rust-cache@v2.9.1
- name: Check formatting
run: cargo fmt --all -- --check
run: cargo fmt --check
clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
security-events: write # to upload sarif results
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Initialize cache
uses: Swatinem/rust-cache@v2.9.1
- name: Install SARIF tools
run: cargo install clippy-sarif --locked
- name: Install SARIF tools
Expand All @@ -94,9 +144,9 @@ jobs:
| sarif-fmt
continue-on-error: true
- name: Upload
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v4.35.1
with:
sarif_file: clippy-results.sarif
wait-for-processing: true
- name: Report status
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated
run: cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings --allow deprecated
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ readme = "README.md"
repository = "https://github.com/killercup/cargo-edit"
version = "0.13.10"
edition = "2024"
rust-version = "1.92"

[package.metadata.release]
pre-release-replacements = [
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ Ensure that you have a fairly recent version of rust/cargo installed. On Ubuntu
$ cargo install cargo-edit
```

*Compiler support: requires rustc 1.44+*

(Please check [`cargo`'s documentation](http://doc.crates.io/) to learn how `cargo install` works and how to set up your system so it finds binaries installed by `cargo`.)

Install a sub-set of the commands with `cargo install -f --no-default-features --features "<COMMANDS>"`, where `<COMMANDS>` is a space-separated list of commands; i.e. `add rm upgrade` for the full set.
Expand Down
1 change: 1 addition & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl From<anyhow::Error> for CliError {
}
}

#[cfg(feature = "clap")]
impl From<clap::Error> for CliError {
fn from(err: clap::Error) -> CliError {
#[allow(clippy::bool_to_int_with_if)]
Expand Down
Loading