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
5 changes: 4 additions & 1 deletion .github/workflows/test-ffi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ jobs:
include:
- platform: "ubuntu-latest"
flags: "-C relocation-model=pic"
profile: "release-ci"
- platform: "macos-15"
flags: "-C relocation-model=pic"
profile: "release"
- platform: "windows-latest"
flags: "-C target-feature=+crt-static"
profile: "release-ci"
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
Expand Down Expand Up @@ -126,7 +129,7 @@ jobs:
if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then
git config --global core.longpaths true
fi
cargo run --bin release --release -- --out $LIBDD_OUTPUT_FOLDER
cargo run --bin release --profile ${{ matrix.profile }} -- --profile ${{ matrix.profile }} --out $LIBDD_OUTPUT_FOLDER
- name: 'Publish libdatadog'
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
if: success() || failure()
Expand Down
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ debug = "line-tables-only"
lto = true
opt-level = "s" # optimize for size

# CI-only verification profile. Same shape as `release`, but ThinLTO and 16
# codegen units so builds that exist purely to prove the tree compiles are not
# paying for fat LTO's single-threaded codegen. Anything actually shipped stays
# on [profile.release].
[profile.release-ci]
inherits = "release"
lto = "thin"
codegen-units = 16

[profile.bench]
codegen-units = 1
debug = false
Expand Down
7 changes: 6 additions & 1 deletion builder/src/bin/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ use builder::utils::project_root;
struct ReleaseArgs {
pub out_dir: Option<String>,
pub target: Option<String>,
pub profile: Option<String>,
}

impl From<pico_args::Arguments> for ReleaseArgs {
fn from(mut args: pico_args::Arguments) -> Self {
let release_args = ReleaseArgs {
out_dir: args.value_from_str("--out").ok(),
target: args.value_from_str("--target").ok(),
profile: args.value_from_str("--profile").ok(),
};

args.finish();
Expand All @@ -40,7 +42,10 @@ pub fn main() {
..
} = determine_paths();

let profile = env::var("PROFILE").unwrap();
let profile = args
.profile
.clone()
.unwrap_or_else(|| env::var("PROFILE").unwrap());
let version = env::var("CARGO_PKG_VERSION").unwrap();
let host = env::var("TARGET").unwrap();
let out_dir = if let Some(out) = args.out_dir {
Expand Down
8 changes: 6 additions & 2 deletions builder/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,12 @@ impl Module for Profiling {
&self.arch,
];

if self.profile.as_ref() == "release" {
cargo_args.push("--release");
match self.profile.as_ref() {
"debug" | "dev" => {}
profile => {
cargo_args.push("--profile");
cargo_args.push(profile);
}
}

// Parse profiling-ffi manifest in order to get the crate-type array.
Expand Down
Loading