Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
run: cargo fmt --all -- --check

- name: Lint Rust
run: cargo clippy --workspace --all-targets --locked -- -D warnings
run: cargo clippy --profile ci --workspace --all-targets --locked -- -D warnings

- name: Build Native Binding
run: pnpm --filter rstack build:native
run: pnpm --filter rstack build:native:ci

- name: Check
run: node --run check
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reusable-native-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ jobs:
export MACOSX_DEPLOYMENT_TARGET=11.0
;;
i686-pc-windows-msvc)
# Reduce peak link time and memory usage for the constrained 32-bit target.
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=32
export CARGO_PROFILE_RELEASE_LTO=false
;;
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
run: node --run build

- name: Run Rust Tests
run: cargo test --workspace --locked
run: cargo test --profile ci --workspace --locked

- name: Build Native Binding
run: pnpm --filter rstack build:native:release
run: pnpm --filter rstack build:native:ci

- name: Check Generated Native Files
run: git diff --exit-code -- packages/rstack/binding.cjs packages/rstack/binding.d.cts
Expand Down
32 changes: 30 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,34 @@ napi-derive = "3.6.2"
pathdiff = "0.2.3"
rstack-ignore = { path = "crates/rstack-ignore" }

# Local development: 16 codegen units are sufficient for this small workspace while preserving
# parallel compilation and full debugging support.
[profile.dev]
codegen-units = 16
debug = 2
incremental = true
panic = "unwind"
split-debuginfo = "unpacked"

# CI: 256 codegen units favor clean-build parallelism, while disabling cross-crate LTO avoids the
# release-only linking cost.
[profile.ci]
codegen-units = 256
debug = false
incremental = false
inherits = "release"
lto = false
opt-level = 2
# Cargo tests require unwinding, so keep the CI native build consistent.
panic = "unwind"
strip = false

# Release: one codegen unit and fat LTO maximize optimization; abort prevents unwinding across the
# NAPI FFI boundary.
[profile.release]
lto = true
strip = "symbols"
codegen-units = 1
debug = false
lto = "fat"
opt-level = 3
panic = "abort"
strip = true
1 change: 1 addition & 0 deletions packages/rstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"scripts": {
"build": "rslib",
"build:native": "napi build --config-path napi.json --platform --manifest-path ../../Cargo.toml --package rstack-binding --package-json-path package.json --output-dir . --js binding.cjs --dts binding.d.cts",
"build:native:ci": "napi build --config-path napi.json --platform --profile ci --manifest-path ../../Cargo.toml --package rstack-binding --package-json-path package.json --output-dir . --js binding.cjs --dts binding.d.cts",
"build:native:release": "napi build --config-path napi.json --platform --release --manifest-path ../../Cargo.toml --package rstack-binding --package-json-path package.json --output-dir . --js binding.cjs --dts binding.d.cts",
"dev": "rslib -w",
"package:native": "napi create-npm-dirs --config-path napi.json",
Expand Down