Skip to content

Commit

Permalink
modernize code base and CI
Browse files Browse the repository at this point in the history
also adds `-F` shorthand
  • Loading branch information
Emilgardis committed Sep 21, 2023
1 parent 7abd594 commit 50bf217
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 198 deletions.
59 changes: 25 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
rust:
# MSRV
- 1.60.0
- "1.72.1"
- stable
os: [ubuntu-latest, macos-latest, windows-latest]
experimental: [false]
Expand All @@ -24,54 +24,45 @@ jobs:
experimental: true

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: llvm-tools-preview
- uses: actions/checkout@v4
- name: Setup Rust
shell: bash
run: |
rustup toolchain install ${{ matrix.rust }} --profile minimal
rustup default ${{ matrix.rust }}
rustup component add llvm-tools-preview clippy rustfmt
echo "::add-matcher::.github/workflows/rust.json"
- name: Clippy
run: cargo clippy -- -D warnings

- name: rustfmt
run: cargo fmt --all -- --check

- name: Build and install cargo-binutils
uses: actions-rs/cargo@v1
with:
command: install
args: --path . -f
run: cargo install --path . -f

- name: Run cargo-nm
uses: actions-rs/cargo@v1
with:
command: nm
args: --bin cargo-nm -- --undefined-only
run: cargo nm --bin cargo-nm -- --undefined-only

- name: Run cargo-objdump
uses: actions-rs/cargo@v1
with:
command: objdump
args: --bin cargo-objdump -- -h
run: cargo objdump --bin cargo-objdump -- -h

- name: Run cargo-objcopy (on Linux only)
if: matrix.os == 'ubuntu-latest'
uses: actions-rs/cargo@v1
with:
command: objcopy
args: --bin cargo-objdump -v -- -O binary objdump.bin
run: cargo objcopy --bin cargo-objdump -v -- -O binary objdump.bin

- name: Run cargo-size
uses: actions-rs/cargo@v1
with:
command: size
args: --bin cargo-size -v
run: cargo size --bin cargo-size -v

- name: Run cargo-strip (on Linux only)
if: matrix.os == 'ubuntu-latest'
uses: actions-rs/cargo@v1
with:
command: strip
args: --bin cargo-strip -v
run: cargo strip --bin cargo-strip -v

conclusion:
runs-on: ubuntu-latest
needs: ci
if: always()
steps:
- name: Result
run: exit 0
- name: Done
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
20 changes: 0 additions & 20 deletions .github/workflows/clippy.yml

This file was deleted.

16 changes: 4 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,12 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # 2023-02-02
with:
toolchain: stable
profile: minimal
target: ${{ matrix.target }}
override: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release
uses: Swatinem/rust-cache@v2
- run: cargo build --target ${{ matrix.target }} --release

- name: (Not Windows) Move executables and compress
if: ${{ matrix.os != 'windows-latest' }}
Expand Down Expand Up @@ -73,7 +65,7 @@ jobs:
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- id: changelog-reader
uses: mindsers/changelog-reader-action@v2.0.0
uses: mindsers/changelog-reader-action@v2.2.2
with:
version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }}

Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/rust.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"problemMatcher": [
{
"owner": "rust",
"pattern": [
{
"regexp": "^(warning|warn|error)(\\[(.*)\\])?: (.*)$",
"severity": 1,
"message": 4,
"code": 3
},
{
"regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$",
"file": 2,
"line": 3,
"column": 4
}
]
}
]
}
23 changes: 0 additions & 23 deletions .github/workflows/rustfmt.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- MSRV Changed to 1.60
- Bump `rust-cfg` to 0.5 and `cargo_metadata` to 0.15
- MSRV Changed to 1.64
- Bump `rust-cfg` to 0.5, `cargo_metadata` to 0.15, `clap` to 4.1.4 and `toml` to 0.7.1

### Fixed

Expand Down
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
edition = "2018"
edition = "2021"
authors = [
"The Embedded WG Tools Team <[email protected]>",
"Jorge Aparicio <[email protected]>",
Expand All @@ -13,14 +13,15 @@ name = "cargo-binutils"
readme = "README.md"
repository = "https://github.com/rust-embedded/cargo-binutils/"
version = "0.3.6"
rust-version = "1.72.1"

[dependencies]
cargo_metadata = "0.15"
clap = "2.34"
clap = { version = "4.1.4", features = ["cargo", "wrap_help", "string"] }
regex = "1.5"
rustc-cfg = "0.5"
rustc-demangle = "0.1"
rustc_version = "0.4"
serde = "1.0"
toml = "0.5"
toml = "0.7.1"
anyhow = "1.0"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ linker = "rust-lld"

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.60.0 and up. It *might*
This crate is guaranteed to compile on stable Rust 1.64.0 and up. It *might*
compile with older versions but that may change in any new patch release.

## License
Expand Down
Loading

0 comments on commit 50bf217

Please sign in to comment.