CI #1012
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "00 01 * * *" | |
env: | |
RUST_BACKTRACE: short | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
RUSTFLAGS: -Dwarnings | |
RUSTDOCFLAGS: -Dwarnings | |
jobs: | |
# Test on stable and MSRV | |
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 | |
# - msrv | |
- beta | |
- nightly | |
- arm32 | |
- arm64 | |
- mips32 | |
- mips64 | |
include: | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
- build: macos | |
os: macos-latest | |
rust: stable | |
- build: win64-msvc | |
os: windows-2019 | |
rust: stable | |
- build: win64-gnu | |
os: windows-2019 | |
rust: stable-x86_64-gnu | |
- build: win32-msvc | |
os: windows-2019 | |
rust: stable-i686-msvc | |
- build: win32-gnu | |
os: windows-2019 | |
rust: stable-i686-gnu | |
# TODO: re-enable this I guess. I get inscrutable errors like | |
# `error reading from the zlib stream; class=Zlib (5)` in CI | |
# that don't repro locally, and I'm tired of getting an email | |
# about this every day. | |
# | |
# - build: msrv | |
# os: ubuntu-latest | |
# rust: "1.43.0" | |
- build: beta | |
os: ubuntu-latest | |
rust: beta | |
- build: nightly | |
os: ubuntu-latest | |
rust: nightly | |
- build: linux32 | |
os: ubuntu-latest | |
rust: stable | |
target: i686-unknown-linux-gnu | |
# These should prob. be more generic arm targets and not android. | |
- build: arm32 | |
os: ubuntu-latest | |
rust: stable | |
target: armv7-unknown-linux-gnueabihf | |
- build: arm64 | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-gnu | |
# Mips is big endian. Nothing currently in here cares... but will if I | |
# ever get around to that `key` stuff. | |
- build: mips32 | |
os: ubuntu-latest | |
rust: stable | |
target: mips-unknown-linux-gnu | |
- build: mips64 | |
os: ubuntu-latest | |
rust: stable | |
target: mips64-unknown-linux-gnuabi64 | |
# Requested by a user not sure if it adds anything we aren't already | |
# testing but it's easy enough so *shrug*. | |
- build: riscv | |
os: ubuntu-latest | |
rust: stable | |
target: riscv64gc-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
- uses: taiki-e/install-action@cross | |
if: matrix.target != '' | |
- if: matrix.target != '' | |
run: | | |
echo "CARGO=cross" >> $GITHUB_ENV | |
echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV | |
# We have some tests that make sure functionality not present in old | |
# versions behaves as expected (for example, `arcstr::format!("{foo}")`) | |
# To test this, we put them behind `#[cfg(not(msrv))]`. | |
- if: matrix.build == 'msrv' | |
run: echo "RUSTFLAGS=--cfg msrv" >> $GITHUB_ENV | |
- run: | | |
echo "cargo command is: ${{ env.CARGO }}" | |
echo "target flag is: ${{ env.TARGET }}" | |
echo "rustflags are: ${{ env.RUSTFLAGS }}" | |
- run: ${{ env.CARGO }} test --no-default-features --verbose ${{ env.TARGET }} | |
- run: ${{ env.CARGO }} test --verbose ${{ env.TARGET }} | |
- run: ${{ env.CARGO }} test --verbose --features="serde substr std" ${{ env.TARGET }} | |
- run: ${{ env.CARGO }} test --all-features --verbose ${{ env.TARGET }} | |
loom: | |
name: Loom tests | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: --cfg loom -Dwarnings | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- run: cargo test --all-features --lib | |
- run: cargo test --no-default-features --lib | |
miri: | |
name: Miri | |
runs-on: ubuntu-latest | |
env: | |
MIRIFLAGS: -Zmiri-tag-raw-pointers | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: miri, rust-src | |
override: true | |
- run: cargo miri test --all-features | |
- run: cargo miri test --features="std serde substr" | |
- run: cargo miri test | |
cargo-clippy: | |
name: Lint | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: -Dwarnings | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy | |
minimal: true | |
override: true | |
- run: cargo clippy --workspace --all-targets --verbose | |
- run: cargo clippy --workspace --all-targets --verbose --all-features | |
- run: cargo clippy --workspace --all-targets --verbose --features="serde std substr" | |
- run: cargo clippy --workspace --all-targets --verbose --no-default-features | |
# Ensure patch is formatted. | |
fmt: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
minimal: true | |
override: true | |
- run: cargo fmt --all -- --check | |
# Check doc reference links are all valid. | |
doc: | |
name: Doc check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
minimal: true | |
override: true | |
- run: cargo doc --features="serde std substr" | |
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, thread, memory] | |
# could do this instead of repeating 3x in the test invocation, but lets not be wasteful | |
# test_flags: ['--features="std serde substr"', '--no-default-features', '--all-features'] | |
include: | |
- sanitizer: memory | |
extra_rustflags: "-Zsanitizer-memory-track-origins" | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 --features="std serde substr" | |
cargo -Zbuild-std test --target=x86_64-unknown-linux-gnu --all-features | |
cargo -Zbuild-std test --target=x86_64-unknown-linux-gnu --no-default-features | |
codecov: | |
name: Generate code coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Run cargo-tarpaulin | |
uses: actions-rs/tarpaulin@v0.1 | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v1 |