1name: ci 2on: 3 pull_request: 4 branches: 5 - master 6 push: 7 branches: 8 - master 9 schedule: 10 - cron: '00 01 * * *' 11jobs: 12 test: 13 name: test 14 env: 15 # For some builds, we use cross to test on 32-bit and big-endian 16 # systems. 17 CARGO: cargo 18 # When CARGO is set to CROSS, TARGET is set to `--target matrix.target`. 19 TARGET: 20 # Make quickcheck run more tests for hopefully better coverage. 21 QUICKCHECK_TESTS: 100000 22 runs-on: ${{ matrix.os }} 23 strategy: 24 matrix: 25 build: 26 - pinned 27 - stable 28 - stable-32 29 - stable-mips 30 - wasm 31 - beta 32 - nightly 33 - macos 34 - win-msvc 35 - win-gnu 36 include: 37 - build: pinned 38 os: ubuntu-18.04 39 rust: 1.41.1 40 - build: stable 41 os: ubuntu-18.04 42 rust: stable 43 - build: stable-32 44 os: ubuntu-18.04 45 rust: stable 46 target: i686-unknown-linux-gnu 47 - build: stable-mips 48 os: ubuntu-18.04 49 rust: stable 50 target: mips64-unknown-linux-gnuabi64 51 - build: beta 52 os: ubuntu-18.04 53 rust: beta 54 - build: nightly 55 os: ubuntu-18.04 56 rust: nightly 57 - build: macos 58 os: macos-latest 59 rust: stable 60 - build: win-msvc 61 os: windows-2019 62 rust: stable 63 - build: win-gnu 64 os: windows-2019 65 rust: stable-x86_64-gnu 66 - build: wasm 67 os: ubuntu-18.04 68 rust: stable-x86_64-gnu 69 wasm: true 70 steps: 71 - name: Checkout repository 72 uses: actions/checkout@v1 73 with: 74 fetch-depth: 1 75 - name: Install Rust 76 uses: actions-rs/toolchain@v1 77 with: 78 toolchain: ${{ matrix.rust }} 79 profile: minimal 80 override: true 81 - name: Use Cross 82 if: matrix.target != '' 83 run: | 84 # FIXME: to work around bugs in latest cross release, install master. 85 # See: https://github.com/rust-embedded/cross/issues/357 86 cargo install --git https://github.com/rust-embedded/cross 87 echo "CARGO=cross" >> $GITHUB_ENV 88 echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV 89 - name: Download Wasmtime 90 if: matrix.wasm 91 run: | 92 rustup target add wasm32-wasi 93 echo "CARGO_BUILD_TARGET=wasm32-wasi" >> $GITHUB_ENV 94 echo "RUSTFLAGS=-Ctarget-feature=+simd128" >> $GITHUB_ENV 95 curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-linux.tar.xz 96 tar xvf wasmtime-v0.32.0-x86_64-linux.tar.xz 97 echo `pwd`/wasmtime-v0.32.0-x86_64-linux >> $GITHUB_PATH 98 echo "CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime run --wasm-features simd --" >> $GITHUB_ENV 99 - name: Show command used for Cargo 100 run: | 101 echo "cargo command is: ${{ env.CARGO }}" 102 echo "target flag is: ${{ env.TARGET }}" 103 - name: Show CPU info for debugging 104 if: matrix.os == 'ubuntu-18.04' 105 run: lscpu 106 - run: ${{ env.CARGO }} build --verbose $TARGET 107 - run: ${{ env.CARGO }} build --verbose $TARGET --no-default-features 108 - run: ${{ env.CARGO }} doc --verbose $TARGET 109 # Our dev dependencies evolve more rapidly than we'd like, so only run 110 # tests when we aren't pinning the Rust version. 111 - if: matrix.build != 'pinned' 112 name: Show byte order for debugging 113 run: ${{ env.CARGO }} test --verbose $TARGET byte_order -- --nocapture 114 - if: matrix.build != 'pinned' 115 run: ${{ env.CARGO }} test --verbose $TARGET 116 - if: matrix.build == 'stable' 117 name: Run under different SIMD configurations 118 run: | 119 set -x 120 121 # Enable libc while using SIMD, libc won't be used. 122 # (This is to ensure valid logic in the picking process.) 123 cargo test --verbose --features libc 124 125 preamble="--cfg memchr_disable_auto_simd" 126 127 # Force use of fallback without libc. 128 RUSTFLAGS="$preamble" cargo test --verbose 129 130 # Force use of libc. 131 RUSTFLAGS="$preamble" cargo test --verbose --features libc 132 133 preamble="$preamble --cfg memchr_runtime_simd" 134 # Force use of fallback even when SIMD is enabled. 135 RUSTFLAGS="$preamble" cargo test --verbose 136 137 # For some reason, cargo seems to get confused which results in 138 # link errors. So wipe the slate clean. 139 cargo clean 140 # Force use of sse2 only 141 RUSTFLAGS="$preamble --cfg memchr_runtime_sse2" cargo test --verbose 142 143 # ... and wipe it again. So weird. 144 cargo clean 145 # Force use of avx only 146 RUSTFLAGS="$preamble --cfg memchr_runtime_avx" cargo test --verbose 147 - if: matrix.build == 'nightly' 148 name: Run benchmarks as tests 149 run: cargo bench --manifest-path bench/Cargo.toml --verbose -- --test 150 151 build-for-non_sse-target: 152 name: build for non-SSE target 153 runs-on: ubuntu-18.04 154 steps: 155 - name: Checkout repository 156 uses: actions/checkout@v1 157 with: 158 fetch-depth: 1 159 - name: Install Rust 160 uses: actions-rs/toolchain@v1 161 with: 162 toolchain: nightly 163 profile: minimal 164 override: true 165 components: rust-src 166 - run: cargo build -Z build-std=core --target=src/tests/x86_64-soft_float.json --verbose --no-default-features 167 168 test-with-miri: 169 name: test with miri 170 runs-on: ubuntu-18.04 171 steps: 172 - name: Checkout repository 173 uses: actions/checkout@v1 174 with: 175 fetch-depth: 1 176 - name: Install Rust 177 uses: actions-rs/toolchain@v1 178 with: 179 toolchain: nightly 180 profile: minimal 181 override: true 182 components: miri 183 - name: Show CPU info for debugging 184 run: lscpu 185 - run: cargo miri test --verbose 186 - run: cargo miri test --verbose --no-default-features 187 - run: cargo miri test --verbose --features libc 188 189 rustfmt: 190 name: rustfmt 191 runs-on: ubuntu-18.04 192 steps: 193 - name: Checkout repository 194 uses: actions/checkout@v1 195 with: 196 fetch-depth: 1 197 - name: Install Rust 198 uses: actions-rs/toolchain@v1 199 with: 200 toolchain: stable 201 override: true 202 profile: minimal 203 components: rustfmt 204 - name: Check formatting 205 run: | 206 cargo fmt -- --check 207 - name: Check formatting on benchmarks 208 run: | 209 cargo fmt --manifest-path bench/Cargo.toml -- --check 210