Skip to content

Commit

Permalink
Add backhand-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
wcampbell0x2a committed Nov 12, 2023
1 parent 625bcd7 commit 3b5d575
Show file tree
Hide file tree
Showing 48 changed files with 697 additions and 478 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
target: ${{ matrix.targets }}
- run: cargo install cargo-quickinstall
- run: cargo quickinstall cross@0.2.5 --force
- run: cross build --bins --locked --target ${{ matrix.targets }} --profile=dist
- run: cross build -p backhand-cli --bins --locked --target ${{ matrix.targets }} --profile=dist

- name: archive
run: |
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,34 @@ jobs:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
toolchain:
- stable

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Populate cache
uses: ./.github/workflows/cache

- run: sudo apt-get install -y squashfs-tools
- name: Install Rust
run: rustup update stable

- uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # master
with:
toolchain: ${{ matrix.toolchain }}

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@e8c64729e2a2a2c3cfa6751fa496b34ca19f390c # cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --workspace --codecov --output-path codecov.json --features __test_unsquashfs --release

# generate release builds of the testable binaries
# this is meant to actually run the binary, so this will fail but the binary will be built
- run: cargo llvm-cov run --bin replace --no-clean --release || true
- run: cargo llvm-cov run --bin add --no-clean --release || true
- run: cargo llvm-cov run --bin unsquashfs --no-clean --release || true

# run coverage on tests
- run: cargo llvm-cov --workspace --codecov --output-path codecov.json --all-features --release --no-clean -- --skip slow

- name: Upload coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- armv7-unknown-linux-musleabi
toolchain:
- stable
# msrv
# msrv of backhand-cli
- 1.73.0
features:
# default features
Expand All @@ -46,19 +46,21 @@ jobs:
# install cross
- run: cargo install cargo-quickinstall
- run: cargo quickinstall cross@0.2.5 --force
# build with cross
- run: cross build ${{ matrix.features }} --target ${{ matrix.target }} --locked --lib
# build lib and bins with cross
- run: cross build ${{ matrix.features }} --target ${{ matrix.target }} --release --locked --workspace
# test with cross
- run: CROSS_CONTAINER_OPTS="--network host" RUST_LOG=info cross test --release ${{ matrix.features }} --target ${{ matrix.target }} --locked -- --skip slow
- run: CROSS_CONTAINER_OPTS="--network host" RUST_LOG=info cross test --workspace --release ${{ matrix.features }} --target ${{ matrix.target }} --locked -- --skip slow

# build/test all supported on native(musl) arch for library and bins (all tests)
build-test-native:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
toolchain:
- stable
# msrv
# msrv of backhand-cli
- 1.73.0
features:
- --no-default-features --features xz
Expand All @@ -74,7 +76,13 @@ jobs:
- uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # master
with:
toolchain: ${{ matrix.toolchain }}
- run: RUST_LOG=info cargo test --release ${{ matrix.features }} --locked --features __test_unsquashfs
# install cross
- run: cargo install cargo-quickinstall
- run: cargo quickinstall cross@0.2.5 --force
# build bins
- run: cross build ${{ matrix.features }} --target ${{ matrix.target }} --release --locked --workspace
# run tests with native unsquashfs on x86_64-unknown-linux-musl (using Cross.toml)
- run: CROSS_CONTAINER_OPTS="--network host" RUST_LOG=info cross test --workspace --release ${{ matrix.features }} --target ${{ matrix.target }} --locked --features __test_unsquashfs -- --skip slow


# benchmark
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule: [cron: "40 1 * * *"]

name: Check MSRV of backhand
jobs:
build-test:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-feature=+crt-static"
strategy:
# By default, this is set to `true`, which means that a single CI job
# failure will cause all outstanding jobs to be canceled. This slows down
# development because it means that errors need to be encountered and
# fixed one at a time.
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-musl
toolchain:
# msrv of backhand
- 1.67.1

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Populate cache
uses: ./.github/workflows/cache

- uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # master
with:
toolchain: ${{ matrix.toolchain }}
- run: cargo install cargo-quickinstall
- run: cargo quickinstall cross@0.2.5 --force
- run: cross check --all-features --target ${{ matrix.target }} --locked -p backhand
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/test-assets
**/target
**/test-assets
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### backhand
### `backhand`
#### Changes
- Following changes were done to allow multi-threaded applications ([#278](https://github.com/wcampbell0x2a/backhand/pull/278))
- Change `RefCell<Box<T>>` into `Arc<Mutex<T>>`
Expand All @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Change `BufReadSeek: BufRead + Seek {}` to `BufReadSeek: BufRead + Seek + Send {}`
- Allow user provided read/write files to not be static ([@rbran](https://github.com/rbran)) ([#285](https://github.com/wcampbell0x2a/backhand/pull/285))
- Bump flate2 from 1.0.26 to 1.0.28 ([#307](https://github.com/wcampbell0x2a/backhand/pull/307))
- Bump MSRV to `1.67.1`

#### Bug Fix
- When creating an empty image using `FilesystemWriter::default()`, correctly create the ID table for UID and GID entries. Reported: ([@hwittenborn](https://github.com/hwittenborn)) ([!250](https://github.com/wcampbell0x2a/backhand/issues/275)), Fixed: ([#275](https://github.com/wcampbell0x2a/backhand/pull/275))
Expand All @@ -25,18 +26,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Security
- Only allow root and simple filenames into `DirEntry` ([@rbran](https://github.com/rbran)) ([#271](https://github.com/wcampbell0x2a/backhand/pull/271))

### All binaries
#### Changes
### `backhand-cli`
#### Changes to All
- `strip` and `LTO` are enabled for release binaries
- Fix macOS builds ([#260](https://github.com/wcampbell0x2a/backhand/pull/260))
- Bump jemallocator from 0.5.0 to 0.5.4 ([#305](https://github.com/wcampbell0x2a/backhand/pull/305))
- Bump thiserror from 1.0.40 to 1.0.50 ([#304](https://github.com/wcampbell0x2a/backhand/pull/304))
- Bump MSRV to `1.73.0` to use now stabilized `std::os::unix::fs::lchown`

### unsquashfs
#### unsquashfs
- Add progress bar for a cleaner output when extracting files ([#272](https://github.com/wcampbell0x2a/backhand/pull/272))
- Add `--quiet` for not displaying progress bar and RUST_LOG output ([#272](https://github.com/wcampbell0x2a/backhand/pull/272))
- Add multiple threads for extracing files, giving us the same performance in most cases as `squashfs-tools/unsquashfs`! ([#278](https://github.com/wcampbell0x2a/backhand/pull/278))
- Bump MSRV to `1.73.0` to use now stabilized `std::os::unix::fs::lchown`

### ci
- Add testing and release binaries for the following platforms:([#259](https://github.com/wcampbell0x2a/backhand/pull/259))
Expand Down
Loading

0 comments on commit 3b5d575

Please sign in to comment.