@@ -82,14 +82,14 @@ jobs:
8282 cd algorithms/huffman/go
8383 go vet ./...
8484 go test ./...
85- go build -o huffman_go .
85+ go build -o huffman_go ./cmd
8686
8787 - name : Build Arithmetic Go
8888 run : |
8989 cd algorithms/arithmetic/go
9090 go vet ./...
9191 go test ./...
92- go build -o arithmetic_go .
92+ go build -o arithmetic_go ./cmd
9393
9494 - name : Build Range coder Go
9595 run : |
@@ -103,7 +103,7 @@ jobs:
103103 cd algorithms/rle/go
104104 go vet ./...
105105 go test ./...
106- go build -o rle_go .
106+ go build -o rle_go ./cmd
107107
108108 # Build and check Rust implementations
109109 build-rust :
@@ -121,42 +121,39 @@ jobs:
121121
122122 - name : Check Rust formatting
123123 run : |
124- for file in algorithms/huffman/rust/main.rs algorithms/arithmetic/rust/main.rs algorithms/rle/rust/main.rs; do
125- if [ -f "$file" ]; then
126- rustfmt --check "$file" || exit 1
127- fi
128- done
129- if [ -f "algorithms/range/rust/Cargo.toml" ]; then
130- cd algorithms/range/rust && cargo fmt --check
131- fi
124+ cargo fmt --manifest-path algorithms/huffman/rust/Cargo.toml --check
125+ cargo fmt --manifest-path algorithms/arithmetic/rust/Cargo.toml --check
126+ cargo fmt --manifest-path algorithms/range/rust/Cargo.toml --check
127+ cargo fmt --manifest-path algorithms/rle/rust/Cargo.toml --check
128+ cargo fmt --manifest-path algorithms/shared/rust/Cargo.toml --check
132129
133130 - name : Build Huffman Rust
134131 run : |
135132 cd algorithms/huffman/rust
136- rustc -O main.rs -o huffman_rust
137- rustc -- test main.rs -o huffman_rust_test
138- ./huffman_rust_test
133+ cargo clippy --all-targets -- -D warnings
134+ cargo test
135+ cargo build --bin huffman_rust --release
139136
140137 - name : Build Arithmetic Rust
141138 run : |
142139 cd algorithms/arithmetic/rust
143- rustc -O main.rs -o arithmetic_rust
144- rustc -- test main.rs -o arithmetic_rust_test
145- ./arithmetic_rust_test
140+ cargo clippy --all-targets -- -D warnings
141+ cargo test
142+ cargo build --bin arithmetic_rust --release
146143
147144 - name : Build and check Range coder Rust
148145 run : |
149146 cd algorithms/range/rust
150- cargo clippy -- -D warnings
147+ cargo clippy --all-targets -- -D warnings
151148 cargo test
152149 cargo build --release
153150
154151 - name : Build RLE Rust
155152 run : |
156153 cd algorithms/rle/rust
157- rustc -O main.rs -o rle_rust
158- rustc -- test main.rs -o rle_rust_test
159- ./rle_rust_test
154+ cargo clippy --all-targets -- -D warnings
155+ cargo test
156+ cargo build --bin rle_rust --release
160157
161158 # Verify encode/decode correctness across languages
162159 test-correctness :
@@ -200,10 +197,10 @@ jobs:
200197 (cd algorithms/rle/go && go build -o rle_go ./cmd)
201198
202199 # Rust
203- (cd algorithms/huffman/rust && rustc -O main.rs -o huffman_rust)
204- (cd algorithms/arithmetic/rust && rustc -O main.rs -o arithmetic_rust)
200+ (cd algorithms/huffman/rust && cargo build --bin huffman_rust --release )
201+ (cd algorithms/arithmetic/rust && cargo build --bin arithmetic_rust --release )
205202 (cd algorithms/range/rust && cargo build --bin rangecoder --release)
206- (cd algorithms/rle/rust && rustc -O main.rs -o rle_rust)
203+ (cd algorithms/rle/rust && cargo build --bin rle_rust --release )
207204
208205 - name : Test Huffman correctness
209206 run : |
@@ -220,16 +217,16 @@ jobs:
220217 diff "$TEST_FILE" /tmp/huf_go.dec
221218
222219 echo "Testing Huffman Rust..."
223- ./algorithms/huffman/rust/huffman_rust encode "$TEST_FILE" /tmp/huf_rust.enc
224- ./algorithms/huffman/rust/huffman_rust decode /tmp/huf_rust.enc /tmp/huf_rust.dec
220+ ./algorithms/huffman/rust/target/release/ huffman_rust encode "$TEST_FILE" /tmp/huf_rust.enc
221+ ./algorithms/huffman/rust/target/release/ huffman_rust decode /tmp/huf_rust.enc /tmp/huf_rust.dec
225222 diff "$TEST_FILE" /tmp/huf_rust.dec
226223
227224 echo "Testing cross-language (C++ encode -> Go decode)..."
228225 ./algorithms/huffman/go/huffman_go decode /tmp/huf_cpp.enc /tmp/huf_cross_go.dec
229226 diff "$TEST_FILE" /tmp/huf_cross_go.dec
230227
231228 echo "Testing cross-language (C++ encode -> Rust decode)..."
232- ./algorithms/huffman/rust/huffman_rust decode /tmp/huf_cpp.enc /tmp/huf_cross_rust.dec
229+ ./algorithms/huffman/rust/target/release/ huffman_rust decode /tmp/huf_cpp.enc /tmp/huf_cross_rust.dec
233230 diff "$TEST_FILE" /tmp/huf_cross_rust.dec
234231
235232 echo "Huffman tests passed!"
@@ -249,16 +246,16 @@ jobs:
249246 diff "$TEST_FILE" /tmp/arith_go.dec
250247
251248 echo "Testing Arithmetic Rust..."
252- ./algorithms/arithmetic/rust/arithmetic_rust encode "$TEST_FILE" /tmp/arith_rust.enc
253- ./algorithms/arithmetic/rust/arithmetic_rust decode /tmp/arith_rust.enc /tmp/arith_rust.dec
249+ ./algorithms/arithmetic/rust/target/release/ arithmetic_rust encode "$TEST_FILE" /tmp/arith_rust.enc
250+ ./algorithms/arithmetic/rust/target/release/ arithmetic_rust decode /tmp/arith_rust.enc /tmp/arith_rust.dec
254251 diff "$TEST_FILE" /tmp/arith_rust.dec
255252
256253 echo "Testing cross-language (C++ encode -> Go decode)..."
257254 ./algorithms/arithmetic/go/arithmetic_go decode /tmp/arith_cpp.enc /tmp/arith_cross_go.dec
258255 diff "$TEST_FILE" /tmp/arith_cross_go.dec
259256
260257 echo "Testing cross-language (C++ encode -> Rust decode)..."
261- ./algorithms/arithmetic/rust/arithmetic_rust decode /tmp/arith_cpp.enc /tmp/arith_cross_rust.dec
258+ ./algorithms/arithmetic/rust/target/release/ arithmetic_rust decode /tmp/arith_cpp.enc /tmp/arith_cross_rust.dec
262259 diff "$TEST_FILE" /tmp/arith_cross_rust.dec
263260
264261 echo "Arithmetic tests passed!"
@@ -315,16 +312,16 @@ jobs:
315312 diff "$TEST_FILE" /tmp/rle_go.dec
316313
317314 echo "Testing RLE Rust..."
318- ./algorithms/rle/rust/rle_rust encode "$TEST_FILE" /tmp/rle_rust.enc
319- ./algorithms/rle/rust/rle_rust decode /tmp/rle_rust.enc /tmp/rle_rust.dec
315+ ./algorithms/rle/rust/target/release/ rle_rust encode "$TEST_FILE" /tmp/rle_rust.enc
316+ ./algorithms/rle/rust/target/release/ rle_rust decode /tmp/rle_rust.enc /tmp/rle_rust.dec
320317 diff "$TEST_FILE" /tmp/rle_rust.dec
321318
322319 echo "Testing cross-language (C++ encode -> Go decode)..."
323320 ./algorithms/rle/go/rle_go decode /tmp/rle_cpp.enc /tmp/rle_cross_go.dec
324321 diff "$TEST_FILE" /tmp/rle_cross_go.dec
325322
326323 echo "Testing cross-language (C++ encode -> Rust decode)..."
327- ./algorithms/rle/rust/rle_rust decode /tmp/rle_cpp.enc /tmp/rle_cross_rust.dec
324+ ./algorithms/rle/rust/target/release/ rle_rust decode /tmp/rle_cpp.enc /tmp/rle_cross_rust.dec
328325 diff "$TEST_FILE" /tmp/rle_cross_rust.dec
329326
330327 echo "RLE tests passed!"
0 commit comments