reactivate ci targets for arm linux and windows mingw

This commit is contained in:
figsoda 2022-10-14 10:12:51 -04:00
parent bda6c27062
commit 628e14f281
3 changed files with 75 additions and 21 deletions

View File

@ -6,55 +6,94 @@ jobs:
build:
name: build
runs-on: ${{ matrix.os }}
env:
CARGO: cargo
strategy:
matrix:
include:
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
no-zstd-thin: true
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
no-zstd-thin: true
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
no-zstd-thin: true
- target: armv7-unknown-linux-musleabihf
os: ubuntu-latest
no-zstd-thin: true
- target: x86_64-apple-darwin
os: macos-latest
# - target: x86_64-pc-windows-gnu
# os: windows-latest
# ext: .exe
- target: x86_64-pc-windows-gnu
os: windows-latest
no-zstd-thin: true
ext: .exe
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install dependencies (musl)
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
- name: Install cross (non-x86_64 linux)
if: "!contains(matrix.target, 'x86_64') && runner.os == 'Linux'"
run: |
pushd "$(mktemp -d)"
wget https://github.com/cross-rs/cross/releases/download/v0.2.4/cross-x86_64-unknown-linux-musl.tar.gz
tar xf cross-x86_64-unknown-linux-musl.tar.gz
cp cross ~/.cargo/bin
popd
echo CARGO=cross >> $GITHUB_ENV
- name: Install dependencies (x86_64-unknown-linux-musl)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install help2man musl-tools
sudo apt-get install musl-tools
- name: Build and test on stable
- name: Set up extra cargo flags
if: matrix.no-zstd-thin
run: |
rustup toolchain install stable --profile minimal -t ${{ matrix.target }}
cargo +stable build --target ${{ matrix.target }}
cargo +stable test --target ${{ matrix.target }}
echo "EXTRA_CARGO_FLAGS=--no-default-features --features flate2/zlib,zip/deflate-zlib" >> $GITHUB_ENV
- name: Install Rust
run: |
rustup toolchain install stable nightly --profile minimal -t ${{ matrix.target }}
- name: Test on stable
run: |
${{ env.CARGO }} +stable test --target ${{ matrix.target }} $EXTRA_CARGO_FLAGS
- name: Release on nightly
run: |
rustup toolchain install nightly --profile minimal -t ${{ matrix.target }}
cargo +nightly build --release --target ${{ matrix.target }}
${{ env.CARGO }} +nightly build --release --target ${{ matrix.target }} $EXTRA_CARGO_FLAGS
env:
OUCH_ARTIFACTS_FOLDER: artifacts
RUSTFLAGS: -C strip=symbols
- name: Upload bianry
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ouch-${{ matrix.target }}${{ matrix.ext }}
path: target/${{ matrix.target }}/release/ouch${{ matrix.ext }}
- name: Upload artifacts (musl)
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
uses: actions/upload-artifact@v2
if: matrix.target == 'x86_64-unknown-linux-musl'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts
@ -64,7 +103,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: "Cargo: clippy, fmt"
run: |

2
Cross.toml Normal file
View File

@ -0,0 +1,2 @@
[build.env]
passthrough = ["RUSTFLAGS"]

View File

@ -1,18 +1,31 @@
use std::{io::Write, path::PathBuf};
use std::{env, io::Write, path::PathBuf};
use assert_cmd::Command;
use fs_err as fs;
use rand::{Rng, RngCore};
#[macro_export]
macro_rules! ouch {
($($e:expr),*) => {
::assert_cmd::Command::cargo_bin("ouch")
.expect("Failed to find ouch executable")
$crate::utils::cargo_bin()
$(.arg($e))*
.unwrap();
}
}
pub fn cargo_bin() -> Command {
env::vars()
.find_map(|(k, v)| {
(k.starts_with("CARGO_TARGET_") && k.ends_with("_RUNNER")).then(|| {
let mut runner = v.split_whitespace();
let mut cmd = Command::new(runner.next().unwrap());
cmd.args(runner).arg(assert_cmd::cargo::cargo_bin("ouch"));
cmd
})
})
.unwrap_or_else(|| Command::cargo_bin("ouch").expect("Failed to find ouch executable"))
}
// write random content to a file
pub fn write_random_content(file: &mut impl Write, rng: &mut impl RngCore) {
let mut data = Vec::new();