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

fix: cross-platform build #244

Merged
merged 13 commits into from
Dec 19, 2021
85 changes: 83 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install libusb (for Ledger)
run: sudo apt update && sudo apt install pkg-config libudev-dev

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -57,3 +57,84 @@ jobs:

- name: cargo clippy
run: cargo +nightly clippy --all --all-features -- -D warnings


build:
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
- { target: x86_64-apple-darwin , os: macos-10.15 }
- { target: i686-pc-windows-msvc , os: windows-2019 }
- { target: x86_64-pc-windows-gnu , os: windows-2019 }
- { target: x86_64-pc-windows-msvc , os: windows-2019 }

steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Install prerequisites
shell: bash
run: |
case ${{ matrix.job.target }} in
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
esac

- name: Install packages (Ubuntu)
if: matrix.job.os == 'ubuntu-20.04'
run: |
sudo apt update
sudo apt install libudev-dev pkg-config

- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.job.target }}
override: true
profile: minimal

- name: Show installed version information (Rust, cargo, GCC,...)
shell: bash
run: |
gcc --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V

- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: Build foundry and call crates
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --verbose --workspace

- name: Run forge
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: run
args: -p foundry-cli --bin forge -- --help

- name: Run tests without --default-features to avoid solc-asm being used
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: test
args: --verbose --workspace
Loading