name: ci
on:
pull_request:
push:
branches:
- main
jobs:
test:
name: test
env:
CARGO: cargo
TARGET_FLAGS:
TARGET_DIR: ./target
RUST_BACKTRACE: 1
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- stable
- beta
- nightly
- musl
- gnu-32
- musl-32
- mips
- arm
- aarch
- macos
- win-msvc
- win-gnu
include:
- build: stable
os: ubuntu-18.04
rust: stable
- build: beta
os: ubuntu-18.04
rust: beta
- build: nightly
os: ubuntu-18.04
rust: nightly
- build: musl
os: ubuntu-18.04
rust: stable
target: x86_64-unknown-linux-musl
- build: gnu-32
os: ubuntu-18.04
rust: stable
target: i686-unknown-linux-gnu
- build: musl-32
os: ubuntu-18.04
rust: stable
target: i686-unknown-linux-musl
- build: mips
os: ubuntu-18.04
rust: stable
target: mips64-unknown-linux-gnuabi64
- build: arm
os: ubuntu-18.04
rust: stable
target: arm-unknown-linux-gnueabihf
- build: aarch
os: ubuntu-18.04
rust: stable
target: aarch64-unknown-linux-gnu
- build: macos
os: macos-latest
rust: stable
- build: win-msvc
os: windows-2019
rust: stable
- build: win-gnu
os: windows-2019
rust: stable-x86_64-gnu
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup cmake
uses: lukka/get-cmake@latest
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Use Cross
if: matrix.target != ''
run: |
# FIXME: to work around bugs in latest cross release, install master.
# See: https://github.com/rust-embedded/cross/issues/357
cargo install --git https://github.com/rust-embedded/cross
echo "::set-env name=CARGO::cross"
echo "::set-env name=TARGET_FLAGS::--target ${{ matrix.target }}"
echo "::set-env name=TARGET_DIR::./target/${{ matrix.target }}"
- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET_FLAGS }}"
- name: Build sc_extract
run: ${{ env.CARGO }} build --verbose --all ${{ env.TARGET_FLAGS }}
- name: Run tests
run: ${{ env.CARGO }} test --verbose --all ${{ env.TARGET_FLAGS }}
rustfmt:
name: rustfmt
runs-on: ubuntu-18.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Check formatting
run: |
cargo fmt --all -- --check