version: '3.8'
services:
test:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- ./test-results:/app/test-results
- cargo-cache:/usr/local/cargo/registry
- cargo-git:/usr/local/cargo/git
- target-cache:/app/target
environment:
- RUST_BACKTRACE=1
- RUST_LOG=debug
command: >
sh -c "
echo '=== Running promocrypt-core Test Suite ===' &&
mkdir -p /app/test-results &&
echo '' &&
echo '1. Format check...' &&
cargo fmt --check 2>&1 | tee /app/test-results/fmt.txt &&
echo '' &&
echo '2. Clippy lint check...' &&
cargo clippy -- -D warnings 2>&1 | tee /app/test-results/clippy.txt &&
echo '' &&
echo '3. Unit tests...' &&
cargo test --lib --release 2>&1 | tee /app/test-results/unit-tests.txt &&
echo '' &&
echo '4. Integration tests...' &&
cargo test --test '*' --release 2>&1 | tee /app/test-results/integration-tests.txt &&
echo '' &&
echo '5. Doc tests...' &&
cargo test --doc --release 2>&1 | tee /app/test-results/doc-tests.txt &&
echo '' &&
echo '6. Build release...' &&
cargo build --release 2>&1 | tee /app/test-results/build.txt &&
echo '' &&
echo '=== All tests completed ===' &&
echo 'Results saved to /app/test-results/'
"
test-quick:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- cargo-cache:/usr/local/cargo/registry
- cargo-git:/usr/local/cargo/git
environment:
- RUST_BACKTRACE=1
command: cargo test --release
bench:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- ./bench-results:/app/bench-results
- cargo-cache:/usr/local/cargo/registry
- cargo-git:/usr/local/cargo/git
environment:
- RUST_BACKTRACE=1
command: >
sh -c "
echo '=== Running Benchmarks ===' &&
cargo bench 2>&1 | tee /app/bench-results/benchmarks.txt
"
ffi-test:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- cargo-cache:/usr/local/cargo/registry
- cargo-git:/usr/local/cargo/git
command: >
sh -c "
echo '=== Building FFI Library ===' &&
cargo build --release --features ffi &&
echo 'FFI library built successfully' &&
ls -la target/release/libpromocrypt* || echo 'Library files:'
"
volumes:
cargo-cache:
cargo-git:
target-cache: