limbo/.github/workflows/rust.yml

210 lines
6.5 KiB
YAML

name: Rust
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
CARGO_NET_RETRY: 10
jobs:
cargo-fmt-check:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Check formatting
run: cargo fmt --check
- name: Check formatting (fuzz)
run: cd fuzz && cargo fmt --check
build-native:
timeout-minutes: 30
strategy:
matrix:
os: [blacksmith-4vcpu-ubuntu-2404, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Setup mold linker
if: runner.os == 'Linux'
uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"
cache-on-failure: true
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Set up Python 3.10
uses: useblacksmith/setup-python@v6
with:
python-version: "3.10"
- name: Build
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: cargo build --verbose --locked --all-features
- name: Test (nextest)
env:
RUST_LOG: ${{ runner.debug && 'turso_core::storage=trace' || '' }}
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: cargo nextest run --workspace --all-features --locked --no-fail-fast -E 'not test(/^fuzz_tests::/)'
timeout-minutes: 20
- name: Test doctests
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: cargo test --workspace --all-features --doc --locked
clippy:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"
cache-on-failure: true
- name: Clippy
run: |
cargo clippy --workspace --all-features --all-targets --locked -- --deny=warnings
simulator:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 35
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Setup mold linker
uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"
cache-on-failure: true
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
# Run these with for loops (instead of --loop flag in sim) so that each iteration gets a separate seed -- this produces much easier-to-debug traces when there's a failure since we don't have to potentially
# run 10 iterations of the same seed to get to the failure
- name: Simulator default
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: |
for i in {1..10}; do
./scripts/run-sim --maximum-tests 1000 --min-tick 10 --max-tick 50 --io-backend=memory || exit 1
done
- name: Simulator InsertHeavy
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: |
for i in {1..5}; do
./scripts/run-sim --maximum-tests 1000 --min-tick 10 --max-tick 50 --profile write_heavy --io-backend=memory || exit 1
done
- name: Simulator InsertHeavySpill
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: |
for i in {1..5}; do
./scripts/run-sim --maximum-tests 1000 --min-tick 10 --max-tick 50 --profile write_heavy_spill --io-backend=memory || exit 1
done
- name: Simulator Faultless
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: |
for i in {1..10}; do
./scripts/run-sim --maximum-tests 1000 --min-tick 10 --max-tick 50 --profile faultless --io-backend=memory || exit 1
done
- name: Simulator IOUring InsertHeavySpill
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: |
for i in {1..5}; do
./scripts/run-sim --io-backend=io-uring --maximum-tests 1000 --profile=write_heavy_spill || exit 1
done
- name: Simulator IOUring Differential
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: |
for i in {1..10}; do
./scripts/run-sim --io-backend=io-uring --maximum-tests 1000 --differential || exit 1
done
- name: Simulator Differential
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: |
for i in {1..10}; do
./scripts/run-sim --maximum-tests 1000 --differential --io-backend=memory || exit 1
done
test-limbo:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Setup mold linker
uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"
cache-on-failure: true
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install uv
uses: useblacksmith/setup-uv@v4
with:
enable-cache: true
- name: Set up Python
run: uv python install
- uses: "./.github/shared/install_sqlite"
- name: Test
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: make test
timeout-minutes: 20
- name: Test mvcc
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
run: make test-compat-mvcc
timeout-minutes: 10
test-sqlite:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: "./.github/shared/install_sqlite"
- name: build SQLite test extensions
run: cargo build --package limbo_sqlite_test_ext --locked
- name: Test
run: SQLITE_EXEC="sqlite3" make test-compat