Skip to content

Commit

Permalink
Add ci.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvc94ch committed Nov 30, 2020
1 parent c11b354 commit e2673a2
Showing 1 changed file with 109 additions and 0 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
on: [push, pull_request]

name: Rust IPLD

jobs:
ci:
strategy:
fail-fast: false
matrix:
toolchain:
- rust: stable
#- rust: nightly
platform:
- target: x86_64-unknown-linux-gnu
host: ubuntu-latest
cross: false

- target: x86_64-apple-darwin
host: macos-latest
cross: false

- target: x86_64-pc-windows-msvc
host: windows-latest
cross: false

- target: armv7-linux-androideabi
host: ubuntu-latest
cross: true
- target: aarch64-linux-android
host: ubuntu-latest
cross: true

- target: aarch64-apple-ios
host: macos-latest
cross: true
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
LLVM_CONFIG_PATH: /usr/local/opt/llvm/bin/llvm-config
NDK_HOME: /usr/local/lib/android/sdk/ndk-bundle

runs-on: ${{ matrix.platform.host }}
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Cache cargo folder
uses: actions/cache@v1
with:
path: ~/.cargo
key: ${{ matrix.platform.target }}-cargo-${{ matrix.toolchain.rust }}

- name: Install dependencies ubuntu
if: matrix.platform.host == 'ubuntu-latest'
run: sudo apt-get install llvm-dev

- name: Install dependencies macos
if: matrix.platform.host == 'macos-latest'
run: brew install llvm

- name: Install dependencies windows
if: matrix.platform.host == 'windows-latest'
run: choco install llvm

- name: Install rust toolchain
uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.toolchain.rust }}
targets: ${{ matrix.platform.target }}

- name: Install cargo-ndk
if: contains(matrix.platform.target, 'android')
run: cargo install cargo-ndk

- name: Build
if: contains(matrix.platform.target, 'android') == false
run: cargo build --workspace --all-features --target ${{ matrix.platform.target }}

- name: Build android
if: contains(matrix.platform.target, 'android')
run: cargo ndk --android-platform 29 --target ${{ matrix.platform.target }} build --workspace --all-features

- name: Rust tests
if: matrix.platform.cross == false
run: cargo test --workspace --all-features

lint-rust:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Cache cargo folder
uses: actions/cache@v1
with:
path: ~/.cargo
key: lint-cargo

- name: Install rust toolchain
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
components: clippy, rustfmt

- name: cargo fmt
run: cargo fmt --all -- --check

- name: cargo clippy
run: cargo clippy --workspace --all-features --examples --tests -- -D warnings

0 comments on commit e2673a2

Please sign in to comment.