Skip to content

Random subset of features #5002

Random subset of features

Random subset of features #5002

name: Random subset of features
on:
workflow_dispatch:
schedule:
# run hourly
- cron: '0 * * * *'
jobs:
test:
name: Build and test crate
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
rust:
- stable
- beta
- nightly
- 1.81.0 # MSRV
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Rust toolchain with rustup
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
targets: thumbv6m-none-eabi
- name: Use cache
uses: actions/cache@v4
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: cargo build/test (std)
run: |
FEATURES=('arbitrary' 'bincode' 'bitcode' 'borsh' 'bytemuck' 'postcard' 'rkyv' 'rkyv-safe' 'serde' 'speedy')
NUM_SELECTED=$(shuf -i 2-${#FEATURES[@]} -n 1)
SELECTED=$(shuf -e ${FEATURES[@]} -n $NUM_SELECTED | paste -sd, -)
echo "Randomly selected '$SELECTED'"
cargo build --features $SELECTED
cargo test --features $SELECTED
- name: cargo build (no_std)
run: |
FEATURES=('bincode' 'borsh' 'bytemuck' 'postcard' 'rkyv' 'rkyv-safe' 'serde')
NUM_SELECTED=$(shuf -i 2-${#FEATURES[@]} -n 1)
SELECTED=$(shuf -e ${FEATURES[@]} -n $NUM_SELECTED | paste -sd, -)
echo "Randomly selected '$SELECTED'"
cargo build --target thumbv6m-none-eabi --features $SELECTED