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.28.0 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 - name: Install Rust 67 uses: actions-rs/toolchain@v1 68 with: 69 toolchain: ${{ matrix.rust }} 70 profile: minimal 71 override: true 72 - name: Use Cross 73 if: matrix.target != '' 74 run: | 75 # FIXME: to work around bugs in latest cross release, install master. 76 # See: https://github.com/rust-embedded/cross/issues/357 77 cargo install --git https://github.com/rust-embedded/cross 78 echo "::set-env name=CARGO::cross" 79 echo "::set-env name=TARGET::--target ${{ matrix.target }}" 80 - name: Show command used for Cargo 81 run: | 82 echo "cargo command is: ${{ env.CARGO }}" 83 echo "target flag is: ${{ env.TARGET }}" 84 - name: Show CPU info for debugging 85 if: matrix.os == 'ubuntu-18.04' 86 run: lscpu 87 - run: ${{ env.CARGO }} build --verbose $TARGET 88 - run: ${{ env.CARGO }} build --verbose $TARGET --no-default-features 89 - run: ${{ env.CARGO }} doc --verbose $TARGET 90 # Our dev dependencies evolve more rapidly than we'd like, so only run 91 # tests when we aren't pinning the Rust version. 92 - if: matrix.build != 'pinned' 93 name: Show byte order for debugging 94 run: ${{ env.CARGO }} test --verbose $TARGET byte_order -- --nocapture 95 - if: matrix.build != 'pinned' 96 run: ${{ env.CARGO }} test --verbose $TARGET 97 - if: matrix.build == 'stable' 98 name: Run under different SIMD configurations 99 run: | 100 set -x 101 102 # Enable libc while using SIMD, libc won't be used. 103 # (This is to ensure valid logic in the picking process.) 104 cargo test --verbose --features libc 105 106 preamble="--cfg memchr_disable_auto_simd" 107 108 # Force use of fallback without libc. 109 RUSTFLAGS="$preamble" cargo test --verbose 110 111 # Force use of libc. 112 RUSTFLAGS="$preamble" cargo test --verbose --features libc 113 114 preamble="$preamble --cfg memchr_runtime_simd" 115 # Force use of fallback even when SIMD is enabled. 116 RUSTFLAGS="$preamble" cargo test --verbose 117 118 # For some reason, cargo seems to get confused which results in 119 # link errors. So wipe the slate clean. 120 cargo clean 121 # Force use of sse2 only 122 RUSTFLAGS="$preamble --cfg memchr_runtime_sse2" cargo test --verbose 123 124 # ... and wipe it again. So weird. 125 cargo clean 126 # Force use of avx only 127 RUSTFLAGS="$preamble --cfg memchr_runtime_avx" cargo test --verbose 128 - if: matrix.build == 'nightly' 129 name: Run benchmarks as tests 130 run: cargo bench --manifest-path bench/Cargo.toml --verbose -- --test 131 132 build-for-non_sse-target: 133 name: build for non-SSE target 134 runs-on: ubuntu-18.04 135 steps: 136 - name: Checkout repository 137 uses: actions/checkout@v1 138 with: 139 fetch-depth: 1 140 - name: Install Rust 141 uses: actions-rs/toolchain@v1 142 with: 143 toolchain: nightly 144 profile: minimal 145 override: true 146 components: rust-src 147 - run: cargo build -Z build-std=core --target=src/tests/x86_64-soft_float.json --verbose --no-default-features 148 149 test-with-miri: 150 name: test with miri 151 runs-on: ubuntu-18.04 152 steps: 153 - name: Checkout repository 154 uses: actions/checkout@v1 155 with: 156 fetch-depth: 1 157 - name: Install Rust 158 uses: actions-rs/toolchain@v1 159 with: 160 toolchain: nightly 161 profile: minimal 162 override: true 163 components: miri 164 - name: Show CPU info for debugging 165 run: lscpu 166 - run: cargo miri test --verbose 167 - run: cargo miri test --verbose --no-default-features 168 - run: cargo miri test --verbose --features libc 169 170 rustfmt: 171 name: rustfmt 172 runs-on: ubuntu-18.04 173 steps: 174 - name: Checkout repository 175 uses: actions/checkout@v1 176 with: 177 fetch-depth: 1 178 - name: Install Rust 179 uses: actions-rs/toolchain@v1 180 with: 181 toolchain: stable 182 override: true 183 profile: minimal 184 components: rustfmt 185 - name: Check formatting 186 run: | 187 cargo fmt -- --check 188 - name: Check formatting on benchmarks 189 run: | 190 cargo fmt --manifest-path bench/Cargo.toml -- --check 191