1name: ci 2on: 3 pull_request: 4 push: 5 branches: 6 - master 7 schedule: 8 - cron: '00 01 * * *' 9jobs: 10 test: 11 name: test 12 env: 13 # For some builds, we use cross to test on 32-bit and big-endian 14 # systems. 15 CARGO: cargo 16 # When CARGO is set to CROSS, TARGET is set to `--target matrix.target`. 17 TARGET: 18 runs-on: ${{ matrix.os }} 19 strategy: 20 matrix: 21 build: 22 - pinned 23 - stable 24 - stable-32 25 - stable-mips 26 - beta 27 - nightly 28 - macos 29 - win-msvc 30 - win-gnu 31 include: 32 - build: pinned 33 os: ubuntu-18.04 34 rust: 1.41.1 35 - build: stable 36 os: ubuntu-18.04 37 rust: stable 38 - build: stable-32 39 os: ubuntu-18.04 40 rust: stable 41 target: i686-unknown-linux-gnu 42 - build: stable-mips 43 os: ubuntu-18.04 44 rust: stable 45 target: mips64-unknown-linux-gnuabi64 46 - build: beta 47 os: ubuntu-18.04 48 rust: beta 49 - build: nightly 50 os: ubuntu-18.04 51 rust: nightly 52 - build: macos 53 os: macos-latest 54 rust: stable 55 - build: win-msvc 56 os: windows-2019 57 rust: stable 58 - build: win-gnu 59 os: windows-2019 60 rust: stable-x86_64-gnu 61 steps: 62 - name: Checkout repository 63 uses: actions/checkout@v1 64 with: 65 fetch-depth: 1 66 67 - name: Install Rust 68 uses: actions-rs/toolchain@v1 69 with: 70 toolchain: ${{ matrix.rust }} 71 profile: minimal 72 override: true 73 74 - name: Use Cross 75 if: matrix.target != '' 76 run: | 77 # FIXME: to work around bugs in latest cross release, install master. 78 # See: https://github.com/rust-embedded/cross/issues/357 79 cargo install --git https://github.com/rust-embedded/cross 80 echo "CARGO=cross" >> $GITHUB_ENV 81 echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV 82 83 - name: Show command used for Cargo 84 run: | 85 echo "cargo command is: ${{ env.CARGO }}" 86 echo "target flag is: ${{ env.TARGET }}" 87 88 - name: Show CPU info for debugging 89 if: matrix.os == 'ubuntu-18.04' 90 run: lscpu 91 92 - name: Build 93 run: ${{ env.CARGO }} build --verbose $TARGET 94 95 - name: Build (no default) 96 run: ${{ env.CARGO }} build --verbose $TARGET --no-default-features 97 98 - name: Build docs 99 run: ${{ env.CARGO }} doc --verbose $TARGET 100 101 # Our dev dependencies evolve more rapidly than we'd like, so only run 102 # tests when we aren't pinning the Rust version. 103 - name: Tests 104 if: matrix.build != 'pinned' 105 run: ${{ env.CARGO }} test --verbose $TARGET 106 107 - name: Tests (no default, lib only) 108 if: matrix.build != 'pinned' 109 run: ${{ env.CARGO }} test --verbose --no-default-features --lib $TARGET 110 111 - name: Tests (i128) 112 if: matrix.build != 'pinned' 113 run: ${{ env.CARGO }} test --verbose --features i128 $TARGET 114 115 - name: Tests (no default, lib only, i128) 116 if: matrix.build != 'pinned' 117 run: ${{ env.CARGO }} test --verbose --no-default-features --features i128 --lib $TARGET 118 119 - name: Compile benchmarks 120 if: matrix.build == 'nightly' 121 run: cargo bench --verbose --no-run $TARGET 122 123 - name: Compile benchmarks (no default) 124 if: matrix.build == 'nightly' 125 run: cargo bench --verbose --no-run --no-default-features $TARGET 126 127 - name: Compile benchmarks (i128) 128 if: matrix.build == 'nightly' 129 run: cargo bench --verbose --no-run --features i128 $TARGET 130 131 - name: Compile benchmarks (no default, i128) 132 if: matrix.build == 'nightly' 133 run: cargo bench --verbose --no-run --no-default-features --features i128 $TARGET 134 135 rustfmt: 136 name: rustfmt 137 runs-on: ubuntu-18.04 138 steps: 139 - name: Checkout repository 140 uses: actions/checkout@v1 141 with: 142 fetch-depth: 1 143 - name: Install Rust 144 uses: actions-rs/toolchain@v1 145 with: 146 toolchain: stable 147 override: true 148 profile: minimal 149 components: rustfmt 150 - name: Check formatting 151 run: cargo fmt -- --check 152