Skip to content
Open
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
121 changes: 121 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,127 @@ jobs:
- name: Run tests
run: cargo test --all-features --workspace

cross-compile-aarch64:
runs-on: ubuntu-latest
name: Cross-compile for aarch64

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
targets: aarch64-unknown-linux-gnu

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "cross-compile-aarch64"
cache-on-failure: true

- name: Install cross
run: cargo install cross --locked

- name: Build library for aarch64
run: cross build --lib --target aarch64-unknown-linux-gnu

- name: Build tests for aarch64
run: cross build --tests --target aarch64-unknown-linux-gnu

- name: Verify aarch64 build
run: |
echo "✓ aarch64-unknown-linux-gnu build succeeded"
echo " - Architecture separation validated"
echo " - x86_64 backends: hasher_input, md5x2_scalar, md5x2_sse2,"
echo " md5x2_bmi1, md5x2_avx512"
echo " - aarch64 backends: md5x2_scalar, md5x2_neon, crc_armcrc"
echo " - Shared: md5x2 trait"

build-windows-binaries:
runs-on: windows-latest
name: Build Windows binaries
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
targets: x86_64-pc-windows-msvc

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "build-windows-binaries"
cache-on-failure: true

- name: Build release binaries
run: cargo build --release --bins --target x86_64-pc-windows-msvc

- name: Package Windows binaries
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist | Out-Null
Compress-Archive `
-Path `
target/x86_64-pc-windows-msvc/release/par2.exe, `
target/x86_64-pc-windows-msvc/release/par2create.exe, `
target/x86_64-pc-windows-msvc/release/par2repair.exe, `
target/x86_64-pc-windows-msvc/release/par2verify.exe `
-DestinationPath dist/par2rs-windows-x86_64.zip

- name: Upload Windows binaries
uses: actions/upload-artifact@v4
with:
name: par2rs-windows-x86_64
path: |
dist/par2rs-windows-x86_64.zip
target/x86_64-pc-windows-msvc/release/par2.exe
target/x86_64-pc-windows-msvc/release/par2create.exe
target/x86_64-pc-windows-msvc/release/par2repair.exe
target/x86_64-pc-windows-msvc/release/par2verify.exe

build-linux-x86_64-binaries:
runs-on: ubuntu-latest
name: Build Linux x86_64 binaries
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
targets: x86_64-unknown-linux-gnu

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "build-linux-x86_64-binaries"
cache-on-failure: true

- name: Build release binaries
run: cargo build --release --bins --target x86_64-unknown-linux-gnu

- name: Package Linux x86_64 binaries
run: |
mkdir -p dist
tar -C target/x86_64-unknown-linux-gnu/release -czf \
dist/par2rs-linux-x86_64-nightly.tar.gz \
par2 par2create par2repair par2verify

- name: Upload Linux x86_64 binaries
uses: actions/upload-artifact@v4
with:
name: par2rs-linux-x86_64-nightly
path: |
dist/par2rs-linux-x86_64-nightly.tar.gz
target/x86_64-unknown-linux-gnu/release/par2
target/x86_64-unknown-linux-gnu/release/par2create
target/x86_64-unknown-linux-gnu/release/par2repair
target/x86_64-unknown-linux-gnu/release/par2verify

coverage:
runs-on: ubuntu-latest

Expand Down
81 changes: 79 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 49 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
name = "par2rs"
version = "0.1.0"
edition = "2021"
license = "GPL-3.0-only"
license = "GPL-2.0-or-later"

[features]
# Feature flag to skip tests that are unsuitable in Nix builds
nix-build = []
# Feature for ParPar C++ FFI comparison (benchmarks only, adds build time)
parpar-compare = []

[dependencies]
binrw = "*"
Expand All @@ -24,6 +26,10 @@ rustc-hash = "2.1"
thiserror = "2.0.17"
anyhow = "1.0"
smallvec = { version = "1.15.1", features = ["const_generics"] }
libc = "0.2"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = ["Win32_System_Memory", "Win32_System_SystemInformation"] }

# Binaries
[[bin]]
Expand All @@ -42,6 +48,10 @@ path = "src/bin/par2repair.rs"
name = "par2create"
path = "src/bin/par2create.rs"

[build-dependencies]
# C++ compiler for conditional ParPar FFI compilation
cc = "1.0"

[dev-dependencies]
# Temporary directory management for tests
tempfile = "3"
Expand All @@ -53,6 +63,8 @@ iai-callgrind = "0.16"
proptest = "1.5"
# Random number generation for tests
rand = "0.9"
# CRC32 alternative under evaluation vs crc32fast (bench-only for now)
crc-fast = "1.4"

[[bench]]
name = "repair_benchmark"
Expand All @@ -78,6 +90,42 @@ harness = false
name = "iai_simd"
harness = false

[[bench]]
name = "fused_hashing"
harness = false

[[bench]]
name = "crc_compare"
harness = false

[[bench]]
name = "md5x2_crc_fused"
harness = false

[[bench]]
name = "parpar_hasher_input"
harness = false

[[bench]]
name = "iai_hasher_input"
harness = false

[[bench]]
name = "compare_with_parpar"
harness = false

[[bench]]
name = "iai_parpar_comparison"
harness = false

[[bench]]
name = "par2verify_compare"
harness = false

[[bench]]
name = "iai_par2verify_compare"
harness = false

[profile.release]
debug = true
strip = false
Expand Down
Loading
Loading