Skip to content

Commit f33cc6a

Browse files
committed
ci: mold linker + pre-push hook + clippy/fmt fixes
- Add .cargo/config.toml: mold linker via clang for ~3-5x faster linking - All CI workflows install mold+clang and pass -C link-arg=-fuse-ld=mold - Add scripts/pre-push hook: cargo fmt --check + clippy before every push - Fix all nightly clippy errors (needless_update, large_enum_variant, sort_by_key, field_reassign_with_default, unnecessary if let, dead_code) - cargo +nightly fmt applied to all files
1 parent abb075d commit f33cc6a

31 files changed

+561
-303
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[target.x86_64-unknown-linux-gnu]
2+
linker = "clang"
3+
rustflags = ["-C", "link-arg=-fuse-ld=mold"]

.github/workflows/ci.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ concurrency:
1313
env:
1414
CARGO_TERM_COLOR: always
1515
CARGO_INCREMENTAL: 0
16-
RUSTFLAGS: "-C debuginfo=0 -D warnings"
1716
CARGO_NET_RETRY: 10
1817
RUST_BACKTRACE: short
1918

@@ -27,6 +26,9 @@ jobs:
2726
steps:
2827
- uses: actions/checkout@v4
2928

29+
- name: Install mold linker
30+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
31+
3032
- name: Install Rust nightly
3133
uses: dtolnay/rust-toolchain@nightly
3234
with:
@@ -50,14 +52,17 @@ jobs:
5052
run: cargo +nightly clippy --all-targets --all-features -- -D warnings
5153

5254
# ──────────────────────────────────────────────
53-
# Build (release profile, nightly, max parallelism)
55+
# Build (release profile, nightly, max parallelism, mold)
5456
# ──────────────────────────────────────────────
5557
build:
5658
name: Build (nightly, release)
5759
runs-on: blacksmith-32vcpu-ubuntu-2404
5860
steps:
5961
- uses: actions/checkout@v4
6062

63+
- name: Install mold linker
64+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
65+
6166
- name: Install Rust nightly
6267
uses: dtolnay/rust-toolchain@nightly
6368

@@ -75,7 +80,7 @@ jobs:
7580
- name: Build release
7681
run: cargo +nightly build --release -j $(nproc)
7782
env:
78-
RUSTFLAGS: "-C debuginfo=0 -C target-cpu=native -D warnings"
83+
RUSTFLAGS: "-C debuginfo=0 -C target-cpu=native -C link-arg=-fuse-ld=mold -D warnings"
7984

8085
- name: Upload binary
8186
uses: actions/upload-artifact@v4
@@ -85,14 +90,17 @@ jobs:
8590
retention-days: 7
8691

8792
# ──────────────────────────────────────────────
88-
# Tests (parallel, nightly, 32 vCPU)
93+
# Tests (parallel, nightly, 32 vCPU, mold)
8994
# ──────────────────────────────────────────────
9095
test:
9196
name: Tests
9297
runs-on: blacksmith-32vcpu-ubuntu-2404
9398
steps:
9499
- uses: actions/checkout@v4
95100

101+
- name: Install mold linker
102+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
103+
96104
- name: Install Rust nightly
97105
uses: dtolnay/rust-toolchain@nightly
98106

@@ -121,6 +129,9 @@ jobs:
121129
steps:
122130
- uses: actions/checkout@v4
123131

132+
- name: Install mold linker
133+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
134+
124135
- name: Install Rust nightly
125136
uses: dtolnay/rust-toolchain@nightly
126137

.github/workflows/nightly.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313

1414
jobs:
1515
# ──────────────────────────────────────────────
16-
# Full nightly build + test matrix
16+
# Full nightly build + test matrix (mold linker)
1717
# ──────────────────────────────────────────────
1818
nightly-build:
1919
name: Nightly (${{ matrix.toolchain }})
@@ -25,6 +25,9 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727

28+
- name: Install mold linker
29+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
30+
2831
- name: Install Rust ${{ matrix.toolchain }}
2932
uses: dtolnay/rust-toolchain@master
3033
with:
@@ -45,7 +48,7 @@ jobs:
4548
- name: Build
4649
run: cargo build --release -j $(nproc)
4750
env:
48-
RUSTFLAGS: "-C debuginfo=0 -C target-cpu=native"
51+
RUSTFLAGS: "-C debuginfo=0 -C target-cpu=native -C link-arg=-fuse-ld=mold"
4952

5053
- name: Test
5154
run: cargo test --release -j $(nproc) -- --test-threads=$(nproc)
@@ -57,14 +60,17 @@ jobs:
5760
if: matrix.toolchain == 'nightly'
5861

5962
# ──────────────────────────────────────────────
60-
# Optimized release binary (nightly + LTO)
63+
# Optimized release binary (nightly + fat LTO + mold)
6164
# ──────────────────────────────────────────────
6265
release-binary:
6366
name: Release binary (LTO)
6467
runs-on: blacksmith-32vcpu-ubuntu-2404
6568
steps:
6669
- uses: actions/checkout@v4
6770

71+
- name: Install mold linker
72+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
73+
6874
- name: Install Rust nightly
6975
uses: dtolnay/rust-toolchain@nightly
7076

@@ -86,7 +92,7 @@ jobs:
8692
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "1"
8793
CARGO_PROFILE_RELEASE_OPT_LEVEL: "3"
8894
CARGO_PROFILE_RELEASE_STRIP: "symbols"
89-
RUSTFLAGS: "-C target-cpu=native"
95+
RUSTFLAGS: "-C target-cpu=native -C link-arg=-fuse-ld=mold"
9096

9197
- name: Binary size
9298
run: ls -lh target/release/dataforge

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v4
2020

21+
- name: Install mold linker
22+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
23+
2124
- name: Install Rust nightly
2225
uses: dtolnay/rust-toolchain@nightly
2326

@@ -39,7 +42,7 @@ jobs:
3942
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "1"
4043
CARGO_PROFILE_RELEASE_OPT_LEVEL: "3"
4144
CARGO_PROFILE_RELEASE_STRIP: "symbols"
42-
RUSTFLAGS: "-C target-cpu=x86-64-v3"
45+
RUSTFLAGS: "-C target-cpu=x86-64-v3 -C link-arg=-fuse-ld=mold"
4346

4447
- name: Package
4548
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ generated-datasets/
3232
/test-run-hard/
3333
*.jsonl
3434

35+
test-verify/

scripts/pre-push

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "=== pre-push: checking fmt ==="
5+
cargo +nightly fmt --all -- --check
6+
echo "=== pre-push: checking clippy ==="
7+
cargo +nightly clippy --all-targets --all-features -- -D warnings
8+
echo "=== pre-push: all checks passed ==="

src/agents/collector_agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ mod tests {
782782
let p1 = PrioritizedTask::new(task1, 0.5, 0.5, 0.5, "Medium priority");
783783
let p2 = PrioritizedTask::new(task2, 0.9, 0.9, 0.9, "High priority");
784784

785-
let mut tasks = vec![p1, p2];
785+
let mut tasks = [p1, p2];
786786
tasks.sort_by(|a, b| {
787787
b.priority_score
788788
.partial_cmp(&a.priority_score)

src/agents/docker_validator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ mod tests {
546546

547547
#[test]
548548
fn test_determine_base_image_python() {
549-
let config = DockerValidatorConfig::default();
549+
let _config = DockerValidatorConfig::default();
550550
// We can't test the agent without Docker, but we can test image selection logic
551551
// by checking the category parsing
552552
let task = create_test_task();

src/agents/synthetic_workspace/orchestrator.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,8 +1047,7 @@ edition = "2021"
10471047
.map(|d| format!(
10481048
"{} = \"{}\"",
10491049
d.name,
1050-
d.version
1051-
.trim_start_matches(['>', '=', '^'])
1050+
d.version.trim_start_matches(['>', '=', '^'])
10521051
))
10531052
.collect::<Vec<_>>()
10541053
.join("\n")

src/agents/test_designer.rs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ impl TestDesignerAgent {
514514
Ok(j) => j,
515515
Err(_) => {
516516
return Err(AgentError::ResponseParseError(format!(
517-
"Failed to parse LLM response: {}", first_err
517+
"Failed to parse LLM response: {}",
518+
first_err
518519
)));
519520
}
520521
};
@@ -526,14 +527,16 @@ impl TestDesignerAgent {
526527
if let Some(cmds) = extract_test_commands_from_value(&val) {
527528
cmds
528529
} else {
529-
return Err(AgentError::ResponseParseError(
530-
format!("Invalid JSON: {}", e)
531-
));
530+
return Err(AgentError::ResponseParseError(format!(
531+
"Invalid JSON: {}",
532+
e
533+
)));
532534
}
533535
} else {
534-
return Err(AgentError::ResponseParseError(
535-
format!("Invalid JSON: {}", e)
536-
));
536+
return Err(AgentError::ResponseParseError(format!(
537+
"Invalid JSON: {}",
538+
e
539+
)));
537540
}
538541
}
539542
}
@@ -733,9 +736,19 @@ fn extract_test_commands_from_value(val: &serde_json::Value) -> Option<TestDesig
733736
/// Response structure from LLM test design.
734737
#[derive(Debug, Deserialize)]
735738
struct TestDesignResponse {
736-
#[serde(default, alias = "fail_tests", alias = "failing_tests", alias = "tests_fail_to_pass")]
739+
#[serde(
740+
default,
741+
alias = "fail_tests",
742+
alias = "failing_tests",
743+
alias = "tests_fail_to_pass"
744+
)]
737745
fail_to_pass: Vec<TestCommandResponse>,
738-
#[serde(default, alias = "pass_tests", alias = "passing_tests", alias = "tests_pass_to_pass")]
746+
#[serde(
747+
default,
748+
alias = "pass_tests",
749+
alias = "passing_tests",
750+
alias = "tests_pass_to_pass"
751+
)]
739752
pass_to_pass: Vec<TestCommandResponse>,
740753
#[serde(default)]
741754
setup_commands: Vec<String>,

0 commit comments

Comments
 (0)