Skip to content

Rename build to init_with #1142

Rename build to init_with

Rename build to init_with #1142

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
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
- ppc32
- ppc64
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
- build: msrv
os: ubuntu-latest
rust: "1.57.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
# PPC is big endian. Nothing currently in here cares... but will if I
# ever get around to that `key` stuff.
- build: ppc32
os: ubuntu-latest
rust: stable
target: powerpc-unknown-linux-gnu
- build: ppc64
os: ubuntu-latest
rust: stable
target: powerpc64-unknown-linux-gnu
# 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@v4
- uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ matrix.rust }}
- 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@v4
- uses: hecrj/setup-rust-action@v2
- run: cargo test --all-features --lib
- run: cargo test --no-default-features --lib
miri:
name: Miri
runs-on: ubuntu-latest
env:
# the tests for `ArcStr::leak` intentionally leak memory.
MIRIFLAGS: -Zmiri-ignore-leaks
steps:
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
with:
rust-version: nightly
components: miri, rust-src
- run: cargo miri test --all-features
- run: cargo miri test --features="std serde substr"
- run: cargo miri test
cargo-check:
name: Lint
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
- run: cargo check --workspace --all-targets --verbose
- run: cargo check --workspace --all-targets --verbose --all-features
- run: cargo check --workspace --all-targets --verbose --features="serde std substr"
- run: cargo check --workspace --all-targets --verbose --no-default-features
# Ensure patch is formatted.
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
- run: cargo fmt --all -- --check
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
LSAN_OPTIONS: "suppressions=lsan_suppressions.txt"
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"
- sanitizer: address
# to disable the ArcStr::leak test (can't get suppressions to work in CI)
extra_rustflags: "--cfg=asan"
steps:
- uses: actions/checkout@v4
- 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-tarpaulin:
name: coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v4
- run: cargo tarpaulin --verbose --doc --all-features --all-targets --engine llvm --out xml
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
semver-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: obi1kenobi/cargo-semver-checks-action@v2