name: Rust
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
build_test:
name: build_test (${{ matrix.name }})
runs-on: ubicloud-standard-2
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- name: custom
cargo_args: '--no-default-features --features "serde concurrent cdc multimap"'
- name: superslice
cargo_args: '--no-default-features --features "serde concurrent cdc multimap superslice-binary-search"'
- name: hybrid
cargo_args: '--features "serde concurrent cdc multimap"'
- name: std
cargo_args: '--no-default-features --features "serde concurrent cdc multimap std-binary-search"'
- name: all-features
cargo_args: '--all-features'
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- name: Format
run: cargo fmt --all -- --check
- name: Build all targets
run: cargo build --all-targets ${{ matrix.cargo_args }}
- name: Test composed search-feature precedence
if: matrix.name == 'all-features'
run: >
cargo test --no-default-features
--features "concurrent custom-binary-search std-binary-search wt-slice-binary-search superslice-binary-search"
configured_search_implementation_matches_precedence --lib
- name: Test fast tier
run: >
cargo test ${{ matrix.cargo_args }} --lib --tests --
--skip test_concurrent_insert
--skip test_concurrent_multimap_remove_reinsert_stress
--skip test_remove_stress
--skip parallel_iter_and_mut
--skip test_concurrent_cdc_no_gaps
--skip concurrent_first_writers_preserve_disjoint_ranges
--skip mixed_structural_and_node_lock_paths_complete_without_deadlock
clippy:
runs-on: ubicloud-standard-2
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- name: Clippy (custom binary search, deny new warnings)
run: cargo clippy --no-default-features --all-targets --features "serde concurrent cdc multimap" -- -D warnings
- name: Clippy (superslice binary search, deny new warnings)
run: cargo clippy --no-default-features --all-targets --features "serde concurrent cdc multimap superslice-binary-search" -- -D warnings
- name: Clippy (default wt-slice hybrid binary search, deny new warnings)
run: cargo clippy --all-targets --features "serde concurrent cdc multimap" -- -D warnings
- name: Clippy (std binary search, deny new warnings)
run: cargo clippy --no-default-features --all-targets --features "serde concurrent cdc multimap std-binary-search" -- -D warnings
- name: Clippy (explicit custom override and all features, deny new warnings)
run: cargo clippy --all-targets --all-features -- -D warnings
publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [build_test, clippy]
runs-on: ubicloud-standard-2
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Publish when master carries a new version
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
if [ -z "$CARGO_REGISTRY_TOKEN" ]; then echo "CARGO_REGISTRY_TOKEN not set; skipping publish"; exit 0; fi
v=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1)
if curl -fsSL "https://index.crates.io/wo/rk/worktablesindex" | sed -n 's/.*"vers":"\([^"]*\)".*/\1/p' | grep -qx "$v"; then
echo "WorkTablesIndex $v is already on crates.io; nothing to publish"
exit 0
fi
cargo publish -p WorkTablesIndex