Skip to content

Commit

Permalink
Merge pull request #259 from wcampbell0x2a/test-more-archs
Browse files Browse the repository at this point in the history
ci: Test more archs
  • Loading branch information
wcampbell0x2a authored Jul 2, 2023
2 parents 3cc9bf6 + 16cd7e6 commit 2c53a1f
Show file tree
Hide file tree
Showing 27 changed files with 420 additions and 338 deletions.
2 changes: 1 addition & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# - https://github.com/wcampbell0x2a/backhand/issues/150
# - https://github.com/alexcrichton/xz2-rs/issues/105
# - https://github.com/alexcrichton/xz2-rs/pull/111
CFLAGS = "-D NDEBUG=1 -D HAVE_DECODER_ARM=1 -D HAVE_ENCODER_ARM=1 -D HAVE_DECODER_ARM64=1 -D HAVE_ENCODER_ARM64=1 -D HAVE_DECODER_ARMTHUMB=1 -D HAVE_ENCODER_ARMTHUMB=1"
CFLAGS = "-D NDEBUG=1 -D HAVE_DECODER_ARM=1 -D HAVE_ENCODER_ARM=1 -D HAVE_DECODER_ARM64=1 -D HAVE_ENCODER_ARM64=1 -D HAVE_DECODER_ARMTHUMB=1 -D HAVE_ENCODER_ARMTHUMB=1 -D HAVE_DECODER_IA64=1 -D HAVE_ENCODER_IA64=1"

[target."x86_64-unknown-linux-musl"]
rustflags = ["-C", "target-feature=+crt-static"]
28 changes: 16 additions & 12 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,44 @@ on:
pull_request:
branches: [ master ]

env:
BINS: "add unsquashfs replace"

name: binaries

jobs:
# release binaries
release-bins:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-feature=+crt-static"
strategy:
matrix:
targets:
- x86_64-unknown-linux-musl
bins:
- unsquashfs
- add
- replace
- aarch64-unknown-linux-musl
- arm-unknown-linux-musleabi
- mips-unknown-linux-musl
- mipsel-unknown-linux-musl

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.targets }}
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-quickinstall
- run: cargo quickinstall [email protected] --force
- run: cross build --bin ${{ matrix.bins }} --locked --release --target ${{ matrix.targets }}
- run: cross build --bins --locked --release --target ${{ matrix.targets }}

- name: archive
run: |
tar -czvf ${{ matrix.bins }}-${{ matrix.targets }}.tar.gz \
-C target/${{ matrix.targets }}/release/ ${{ matrix.bins }}
tar -czvf backhand-${{ matrix.targets }}.tar.gz \
-C target/${{ matrix.targets }}/release/ $BINS
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.bins }}-${{ matrix.targets }}.tar.gz
path: ${{ matrix.bins }}-${{ matrix.targets }}.tar.gz
name: backhand-${{ matrix.targets }}.tar.gz
path: backhand-${{ matrix.targets }}.tar.gz

# check semvar before release!
- name: Check semver
Expand All @@ -50,7 +54,7 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.bins }}-${{ matrix.targets }}.tar.gz
asset_name: ${{ matrix.bins }}-${{ matrix.targets }}.tar.gz
file: backhand-${{ matrix.targets }}.tar.gz
asset_name: backhand-${{ matrix.targets }}.tar.gz
tag: ${{ github.ref }}
overwrite: true
47 changes: 40 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,42 @@ on:
name: ci

jobs:
# build, test all supported targets
# build/test all supported targets for library and bins (skipping slow and squashfs-tools tests)
build-test:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-feature=+crt-static"
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- arm-unknown-linux-musleabi
- armv7-unknown-linux-musleabi
toolchain:
- stable
# msrv
- 1.65.0
features:
# default features
-

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
# install cross
- run: cargo install cargo-quickinstall
- run: cargo quickinstall [email protected] --force
# build with cross
- run: cross build ${{ matrix.features }} --target ${{ matrix.target }} --locked --lib
# test with cross
- run: CROSS_CONTAINER_OPTS="--network host" RUST_LOG=info cross test --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:
Expand All @@ -33,10 +67,9 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo build ${{ matrix.features }}
- run: RUST_LOG=info cargo test --release ${{ matrix.features }}
- run: RUST_LOG=info cargo test --release ${{ matrix.features }} --locked --features __test_unsquashfs


# benchmark
benchmark:
Expand All @@ -54,15 +87,15 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo bench

# fmt and clippy on nightly builds
fmt-clippy-nightly:
# fmt and clippy on stable
fmt-clippy-stable:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2

Expand Down
9 changes: 0 additions & 9 deletions .rustfmt.toml

This file was deleted.

Loading

0 comments on commit 2c53a1f

Please sign in to comment.