name: CI on: push: branches: - master pull_request: branches: - master env: RUST_BACKTRACE: 1 jobs: test: name: Test Rust - ${{ matrix.build }} runs-on: ${{ matrix.os }} env: CARGO: cargo TARGET: "" strategy: fail-fast: false matrix: build: - macos - linux - linux32 - win64-msvc - win64-gnu - win32-msvc - win32-gnu - arm32 - arm64 - mips32 - mips64 include: - build: linux os: ubuntu-latest rust: nightly - build: macos os: macos-latest rust: nightly - build: win64-msvc os: windows-2019 rust: nightly - build: win64-gnu os: windows-2019 rust: nightly-x86_64-gnu - build: win32-msvc os: windows-2019 rust: nightly-i686-msvc - build: win32-gnu os: windows-2019 rust: nightly-i686-gnu - build: linux32 os: ubuntu-latest rust: nightly target: i686-unknown-linux-gnu # These should prob. be more generic arm targets and not android. - build: arm32 os: ubuntu-latest rust: nightly target: armv7-linux-androideabi - build: arm64 os: ubuntu-latest rust: nightly target: aarch64-linux-android # Mips is big endian. - build: mips32 os: ubuntu-latest rust: nightly target: mips-unknown-linux-gnu - build: mips64 os: ubuntu-latest rust: nightly target: mips64-unknown-linux-gnuabi64 - build: riscv os: ubuntu-latest rust: nightly target: riscv64gc-unknown-linux-gnu steps: - uses: actions/checkout@v2 - name: Install Rust uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} profile: minimal override: true - name: Setup cross if needed if: matrix.target != '' run: | cargo install cross echo "CARGO=cross" >> $GITHUB_ENV echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV - name: Show command used for Cargo run: | echo "cargo command is: ${{ env.CARGO }}" echo "target flag is: ${{ env.TARGET }}" - name: Test run: ${{ env.CARGO }} test --verbose ${{ env.TARGET }} miri: name: Miri runs-on: ubuntu-latest env: RUSTFLAGS: "-Zrandomize-layout" MIRIFLAGS: "" steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: hecrj/setup-rust-action@v1 with: rust-version: nightly components: miri - name: Run tests run: cargo miri test cargo-clippy: name: Lint runs-on: ubuntu-latest env: RUSTFLAGS: -Dwarnings steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: dtolnay/rust-toolchain@nightly - name: Run cargo clippy (default features) run: cargo clippy --all-targets --verbose -- -D clippy::all # Ensure patch is formatted. fmt: name: Format runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: dtolnay/rust-toolchain@nightly - name: Check formatting run: cargo fmt --all -- --check # Check doc reference links are all valid. doc: name: Doc check runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: dtolnay/rust-toolchain@nightly - name: Check docs # Note: needs cargo rustdoc, not cargo doc. run: cargo rustdoc --all-features -- -D warnings sanitizers: name: Test sanitizer ${{ matrix.sanitizer }} runs-on: ubuntu-latest env: RUST_BACKTRACE: 0 # only used by asan, but we set it for all of them cuz its easy ASAN_OPTIONS: detect_stack_use_after_return=1 strategy: fail-fast: false matrix: sanitizer: [address, memory] include: - sanitizer: memory extra_rustflags: "-Zsanitizer-memory-track-origins" steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly override: true components: rust-src - name: Test with sanitizer env: RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }} ${{ matrix.extra_rustflags }} RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }} ${{ matrix.extra_rustflags }} run: | echo "note: RUSTFLAGS='$RUSTFLAGS'" cargo -Zbuild-std test --target=x86_64-unknown-linux-gnu