Skip to content

Commit

Permalink
Use cargo hakari to automate workspace-hack (#2472)
Browse files Browse the repository at this point in the history
This PR integrates workspace-hack (via [cargo hakari](https://crates.io/crates/cargo-hakari)), this fixes the huge space amplification that we had with rocksdb builds, and it building/checking individual crates becomes significantly faster after the initial build.

The cost of this:
- Slightly longer initial build time (but I didn't really notice much difference on my machine)
- I removed io-uring optional feature (easy to add back when we decide to give it another try) from rocksdb
- After adding new third-party dependencies, make sure you run `cargo hakari generate`, don't worry, CI will catch if you didn't.

This is a non-destructive change, and running with `cargo hakari` disable should still work if this is needed.
  • Loading branch information
AhmedSoliman authored Jan 8, 2025
1 parent b506fc6 commit e6d1917
Show file tree
Hide file tree
Showing 53 changed files with 576 additions and 10 deletions.
21 changes: 21 additions & 0 deletions .config/hakari.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file contains settings for `cargo hakari`.
# See https://docs.rs/cargo-hakari/latest/cargo_hakari/config for a full list of options.

hakari-package = "workspace-hack"

# Format version for hakari's output. Version 4 requires cargo-hakari 0.9.22 or above.
dep-format-version = "4"
resolver = "2"

# Add triples corresponding to platforms commonly used by developers here.
# https://doc.rust-lang.org/rustc/platform-support.html
platforms = [
"x86_64-unknown-linux-gnu",
"aarch64-apple-darwin",
]

# Write out exact versions rather than a semver range. (Defaults to false.)
# exact-versions = true

[traversal-excludes]
workspace-members = ["service-protocol-wireshark-dissector"]
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ on:
- main

jobs:
workspace-hack-check:
name: Check workspace-hack
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-hakari
uses: taiki-e/install-action@v2
with:
tool: cargo-hakari
- name: Check workspace-hack Cargo.toml is up-to-date
run: cargo hakari generate --diff
- name: Check all crates depend on workspace-hack
run: cargo hakari manage-deps --dry-run
build-and-test:
name: Build and test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand All @@ -23,8 +39,9 @@ jobs:
env:
RUST_BACKTRACE: full
steps:
- name: Install liburing
run: sudo apt-get update && sudo apt-get install -y liburing-dev
# Disabled as uring is not used in production yet.
# - name: Install liburing
# run: sudo apt-get update && sudo apt-get install -y liburing-dev

- uses: actions/checkout@v4

Expand Down
Loading

0 comments on commit e6d1917

Please sign in to comment.