| name: ci |
| on: |
| pull_request: |
| push: |
| branches: |
| - master |
| schedule: |
| - cron: '00 01 * * *' |
| jobs: |
| test: |
| name: test |
| env: |
| # For some builds, we use cross to test on 32-bit and big-endian |
| # systems. |
| CARGO: cargo |
| # When CARGO is set to CROSS, TARGET is set to `--target matrix.target`. |
| TARGET: |
| runs-on: ${{ matrix.os }} |
| strategy: |
| matrix: |
| build: |
| - pinned |
| - stable |
| - stable-32 |
| - stable-mips |
| - beta |
| - nightly |
| - macos |
| - win-msvc |
| - win-gnu |
| include: |
| - build: pinned |
| os: ubuntu-18.04 |
| rust: 1.28.0 |
| - build: stable |
| os: ubuntu-18.04 |
| rust: stable |
| - build: stable-32 |
| os: ubuntu-18.04 |
| rust: stable |
| target: i686-unknown-linux-gnu |
| - build: stable-mips |
| os: ubuntu-18.04 |
| rust: stable |
| target: mips64-unknown-linux-gnuabi64 |
| - build: beta |
| os: ubuntu-18.04 |
| rust: beta |
| - build: nightly |
| os: ubuntu-18.04 |
| rust: nightly |
| - build: macos |
| os: macos-latest |
| rust: stable |
| - build: win-msvc |
| os: windows-2019 |
| rust: stable |
| - build: win-gnu |
| os: windows-2019 |
| rust: stable-x86_64-gnu |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v1 |
| with: |
| fetch-depth: 1 |
| - name: Install Rust |
| uses: actions-rs/toolchain@v1 |
| with: |
| toolchain: ${{ matrix.rust }} |
| profile: minimal |
| override: true |
| - name: Use Cross |
| if: matrix.target != '' |
| run: | |
| # FIXME: to work around bugs in latest cross release, install master. |
| # See: https://github.com/rust-embedded/cross/issues/357 |
| cargo install --git https://github.com/rust-embedded/cross |
| echo "::set-env name=CARGO::cross" |
| echo "::set-env name=TARGET::--target ${{ matrix.target }}" |
| - name: Show command used for Cargo |
| run: | |
| echo "cargo command is: ${{ env.CARGO }}" |
| echo "target flag is: ${{ env.TARGET }}" |
| - name: Show CPU info for debugging |
| if: matrix.os == 'ubuntu-18.04' |
| run: lscpu |
| - run: ${{ env.CARGO }} build --verbose $TARGET |
| - run: ${{ env.CARGO }} build --verbose $TARGET --no-default-features |
| - run: ${{ env.CARGO }} doc --verbose $TARGET |
| # Our dev dependencies evolve more rapidly than we'd like, so only run |
| # tests when we aren't pinning the Rust version. |
| - if: matrix.build != 'pinned' |
| name: Show byte order for debugging |
| run: ${{ env.CARGO }} test --verbose $TARGET byte_order -- --nocapture |
| - if: matrix.build != 'pinned' |
| run: ${{ env.CARGO }} test --verbose $TARGET |
| - if: matrix.build == 'stable' |
| name: Run under different SIMD configurations |
| run: | |
| set -x |
| |
| # Enable libc while using SIMD, libc won't be used. |
| # (This is to ensure valid logic in the picking process.) |
| cargo test --verbose --features libc |
| |
| preamble="--cfg memchr_disable_auto_simd" |
| |
| # Force use of fallback without libc. |
| RUSTFLAGS="$preamble" cargo test --verbose |
| |
| # Force use of libc. |
| RUSTFLAGS="$preamble" cargo test --verbose --features libc |
| |
| preamble="$preamble --cfg memchr_runtime_simd" |
| # Force use of fallback even when SIMD is enabled. |
| RUSTFLAGS="$preamble" cargo test --verbose |
| |
| # For some reason, cargo seems to get confused which results in |
| # link errors. So wipe the slate clean. |
| cargo clean |
| # Force use of sse2 only |
| RUSTFLAGS="$preamble --cfg memchr_runtime_sse2" cargo test --verbose |
| |
| # ... and wipe it again. So weird. |
| cargo clean |
| # Force use of avx only |
| RUSTFLAGS="$preamble --cfg memchr_runtime_avx" cargo test --verbose |
| - if: matrix.build == 'nightly' |
| name: Run benchmarks as tests |
| run: cargo bench --manifest-path bench/Cargo.toml --verbose -- --test |
| |
| build-for-non_sse-target: |
| name: build for non-SSE target |
| runs-on: ubuntu-18.04 |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v1 |
| with: |
| fetch-depth: 1 |
| - name: Install Rust |
| uses: actions-rs/toolchain@v1 |
| with: |
| toolchain: nightly |
| profile: minimal |
| override: true |
| components: rust-src |
| - run: cargo build -Z build-std=core --target=src/tests/x86_64-soft_float.json --verbose --no-default-features |
| |
| test-with-miri: |
| name: test with miri |
| runs-on: ubuntu-18.04 |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v1 |
| with: |
| fetch-depth: 1 |
| - name: Install Rust |
| uses: actions-rs/toolchain@v1 |
| with: |
| toolchain: nightly |
| profile: minimal |
| override: true |
| components: miri |
| - name: Show CPU info for debugging |
| run: lscpu |
| - run: cargo miri test --verbose |
| - run: cargo miri test --verbose --no-default-features |
| - run: cargo miri test --verbose --features libc |
| |
| rustfmt: |
| name: rustfmt |
| runs-on: ubuntu-18.04 |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v1 |
| with: |
| fetch-depth: 1 |
| - name: Install Rust |
| uses: actions-rs/toolchain@v1 |
| with: |
| toolchain: stable |
| override: true |
| profile: minimal |
| components: rustfmt |
| - name: Check formatting |
| run: | |
| cargo fmt -- --check |
| - name: Check formatting on benchmarks |
| run: | |
| cargo fmt --manifest-path bench/Cargo.toml -- --check |