Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for arm targets #21

Merged
merged 5 commits into from
May 12, 2020
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
72 changes: 72 additions & 0 deletions .github/workflows/aarch64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI - Linux - AArch64

on:
push:
branches:
- master
pull_request:

jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- 1.38.0 # MSRV
- stable
- nightly

name: Test ${{ matrix.version }} - aarch64-unknown-linux-gnu
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-
target: aarch64-unknown-linux-gnu
profile: minimal
override: true
default: true

- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ matrix.version }}-aarch64-unknown-linux-gnu-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ matrix.version }}-aarch64-unknown-linux-gnu-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ matrix.version }}-aarch64-unknown-linux-gnu-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Check build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: check
args: --target aarch64-unknown-linux-gnu --release --all --bins --examples --tests

- name: Tests
uses: actions-rs/cargo@v1
timeout-minutes: 10
with:
use-cross: true
command: test
args: --target aarch64-unknown-linux-gnu --release --all --all-features --no-fail-fast -- --nocapture

- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache
72 changes: 72 additions & 0 deletions .github/workflows/armv7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI - Linux - ARMv7

on:
push:
branches:
- master
pull_request:

jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- 1.38.0 # MSRV
- stable
- nightly

name: Test ${{ matrix.version }} - armv7-unknown-linux-gnueabihf
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-
target: armv7-unknown-linux-gnueabihf
profile: minimal
override: true
default: true

- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ matrix.version }}-armv7-unknown-linux-gnueabihf-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ matrix.version }}-armv7-unknown-linux-gnueabihf-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ matrix.version }}-armv7-unknown-linux-gnueabihf-cargo-build-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Check build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: check
args: --target armv7-unknown-linux-gnueabihf --release --all --bins --examples --tests

- name: Tests
uses: actions-rs/cargo@v1
timeout-minutes: 10
with:
use-cross: true
command: test
args: --target armv7-unknown-linux-gnueabihf --release --all --all-features --no-fail-fast -- --nocapture

- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache
8 changes: 6 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI (Linux)
name: CI - Linux - x86_64

on:
push:
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
args: --all --all-features --no-fail-fast -- --nocapture
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads'
RUSTFLAGS: '-Zprofile -Zpanic_abort_tests -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort'
- id: coverage
if: matrix.version == 'nightly'
uses: actions-rs/grcov@master
Expand All @@ -88,6 +88,10 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}
- name: Clear the coverage files from cache
if: matrix.version == 'nightly'
run: |
find target/ -name "*.gcda" -exec rm {} +

- name: Clear the cargo caches
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI (macOS)
name: CI - macOS - x86_64

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI (Windows)
name: CI - Windows - x86_64

on:
push:
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

[#19]: https://github.com/OSSystems/compress-tools-rs/pull/16

### Changed

* Lower required version of libarchive to 3 instead of 3.2.2 [#21]

[#21]: https://github.com/OSSystems/compress-tools-rs/pull/21

## [0.4.0] 2020-04-17

### Added
Expand Down
5 changes: 5 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.armv7-unknown-linux-gnueabihf]
image = "jonathasossystems/cross-armv7-libarchive:latest"

[target.aarch64-unknown-linux-gnu]
image = "jonathasossystems/cross-aarch64-libarchive:latest"
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ functionalities.

| Platform | Build Status |
| -------- | ------------ |
| Linux | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20(Linux)/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
| macOS | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20(macOS)/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
| Windows | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20(Windows)/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
| Linux - x86_64 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20Linux%20-%20x86_64/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
| Linux - AArch64 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20Linux%20-%20AArch64/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
| Linux - ARMv7 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20Linux%20-%20ARMv7/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
| macOS - x86_64 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20macOS%20-%20x86_64/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
| Windows - x86_64 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20Windows%20-%20x86_64/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |

---

Expand Down
6 changes: 6 additions & 0 deletions docker/Dockerfile.cross-aarch64-libarchive
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM rustembedded/cross:aarch64-unknown-linux-gnu
RUN dpkg --add-architecture arm64
RUN apt-get update
RUN apt-get install --assume-yes --no-install-recommends libarchive-dev:arm64

ENV PKG_CONFIG=aarch64-linux-gnu-pkg-config
6 changes: 6 additions & 0 deletions docker/Dockerfile.cross-armv7-libarchive
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM rustembedded/cross:armv7-unknown-linux-gnueabihf
RUN dpkg --add-architecture armhf
RUN apt-get update
RUN apt-get install --assume-yes --no-install-recommends libarchive-dev:armhf

ENV PKG_CONFIG=arm-linux-gnueabihf-pkg-config
16 changes: 8 additions & 8 deletions src/build.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
fn main() {
if !find_libarchive() {
panic!("Unable to find libarchive");
}
find_libarchive()
}

#[cfg(not(windows))]
fn find_libarchive() -> bool {
fn find_libarchive() {
pkg_config::Config::new()
.atleast_version("3.2.2")
.atleast_version("3")
.probe("libarchive")
.is_ok()
.expect("Unable to find libarchive");
}

#[cfg(windows)]
fn find_libarchive() -> bool {
vcpkg::Config::new().find_package("libarchive").is_ok()
fn find_libarchive() {
vcpkg::Config::new()
.find_package("libarchive")
.expect("Unable to find libarchive");
}
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
//!
//! | Platform | Build Status |
//! | -------- | ------------ |
//! | Linux | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20(Linux)/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
//! | macOS | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20(macOS)/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
//! | Windows | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20(Windows)/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
//! | Linux - x86_64 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20Linux%20-%20x86_64/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
//! | Linux - AArch64 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20Linux%20-%20AArch64/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
//! | Linux - ARMv7 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20Linux%20-%20ARMv7/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
//! | macOS - x86_64 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20macOS%20-%20x86_64/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
//! | Windows - x86_64 | [![build status](https://github.com/OSSystems/compress-tools-rs/workflows/CI%20-%20Windows%20-%20x86_64/badge.svg)](https://github.com/OSSystems/compress-tools-rs/actions) |
//!
//! ---
//!
Expand Down