|
| 1 | +name: Rust |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build on ${{ matrix.os }} |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + os: [ubuntu-18.04, windows-latest, macOS-latest] |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + - name: Set up Rust nightly |
| 20 | + uses: actions-rs/toolchain@v1 |
| 21 | + with: |
| 22 | + profile: minimal |
| 23 | + toolchain: nightly |
| 24 | + override: true |
| 25 | + - name: Cache cargo build |
| 26 | + uses: actions/cache@v1 |
| 27 | + env: |
| 28 | + cache-name: cargo-build-target |
| 29 | + with: |
| 30 | + path: target |
| 31 | + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} |
| 32 | + restore-keys: | |
| 33 | + ${{ runner.os }}-${{ env.cache-name }}- |
| 34 | + - name: Build |
| 35 | + run: cargo build --workspace --verbose |
| 36 | + - name: Run tests |
| 37 | + run: cargo test --workspace --verbose |
| 38 | + - name: Run tests with coverage |
| 39 | + if: startsWith(matrix.os, 'ubuntu') |
| 40 | + run: | |
| 41 | + sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev binutils-dev |
| 42 | + cargo install --force cargo-kcov; |
| 43 | + cargo kcov --print-install-kcov-sh | sh; |
| 44 | + cargo kcov --all --verbose; |
| 45 | + bash <(curl -s https://codecov.io/bash); |
| 46 | +
|
| 47 | +
|
| 48 | + build-android: |
| 49 | + name: Build for Android |
| 50 | + runs-on: ubuntu-18.04 |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v2 |
| 53 | + - name: Set up Rust nightly |
| 54 | + uses: actions-rs/toolchain@v1 |
| 55 | + with: |
| 56 | + profile: minimal |
| 57 | + toolchain: nightly |
| 58 | + override: true |
| 59 | + - name: Cache cargo build |
| 60 | + uses: actions/cache@v1 |
| 61 | + env: |
| 62 | + cache-name: cargo-build-target-android |
| 63 | + with: |
| 64 | + path: target |
| 65 | + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} |
| 66 | + restore-keys: | |
| 67 | + ${{ runner.os }}-${{ env.cache-name }}- |
| 68 | + - name: Install NDK |
| 69 | + run: | |
| 70 | + ./install-ndk.sh |
| 71 | + - name: Build |
| 72 | + run: | |
| 73 | + export ANDROID_NDK_HOME=`pwd`/NDK |
| 74 | + ./compile-android.sh |
| 75 | +
|
| 76 | + lint: |
| 77 | + runs-on: ubuntu-18.04 |
| 78 | + |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v2 |
| 81 | + - name: Set up Rust nightly |
| 82 | + uses: actions-rs/toolchain@v1 |
| 83 | + with: |
| 84 | + profile: minimal |
| 85 | + toolchain: nightly |
| 86 | + components: clippy, rustfmt |
| 87 | + override: true |
| 88 | + - name: Check formatting |
| 89 | + if: always() |
| 90 | + run: cargo fmt -- --check |
| 91 | + - name: Run clippy # Doesn't fail build |
| 92 | + if: always() |
| 93 | + run: cargo clippy |
0 commit comments