Skip to content

release: v6.24.3 - Code complexity reduction via EXTREME TDD #265

release: v6.24.3 - Code complexity reduction via EXTREME TDD

release: v6.24.3 - Code complexity reduction via EXTREME TDD #265

Workflow file for this run

name: Feature Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test-compile-mode:
name: Test Compile Mode
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install test dependencies
run: |
# Install compression tools
sudo apt-get update
sudo apt-get install -y zstd gzip dash
- name: Build with compile mode
run: cargo build --release
- name: Test self-extracting script creation
run: |
# Create test script
echo 'fn main() { echo("Hello from RASH!"); }' > test.rs
# Compile to self-extracting script
./target/release/bashrs compile test.rs -o test-self-extract.sh --self-extracting
# Verify output exists and is executable
test -f test-self-extract.sh
test -x test-self-extract.sh
# Test execution (if base64 and zstd are available)
if command -v base64 >/dev/null && command -v zstd >/dev/null; then
./test-self-extract.sh | grep "Hello from RASH!"
fi
- name: Test container generation
run: |
# Test Docker format
./target/release/bashrs compile test.rs -o Dockerfile --container --container-format docker
test -f Dockerfile
grep -q "FROM scratch" Dockerfile
# Test OCI format
./target/release/bashrs compile test.rs -o container.tar --container --container-format oci
test -f container.tar
- name: Run compile mode tests
run: cargo test --workspace -- compile
test-playground-mode:
name: Test Playground Mode
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-playground-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-playground-
- name: Build with playground feature
run: cargo build --release --features playground
- name: Check playground binary
run: |
# Verify playground command is available
./target/release/bashrs playground --help || echo "Playground help available"
- name: Run playground tests
run: cargo test --features playground -- playground
integration-test:
name: Integration Tests
needs: [test-compile-mode, test-playground-mode]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Full feature build
run: cargo build --release --all-features
- name: Run all feature tests
run: cargo test --all-features
- name: Test example compilation
run: |
for example in examples/*.rs; do
if [ -f "$example" ]; then
echo "Testing $example..."
base=$(basename "$example" .rs)
# Standard transpilation
./target/release/bashrs build "$example" -o "$base.sh"
test -f "$base.sh"
# Self-extracting
./target/release/bashrs compile "$example" -o "$base-self.sh" --self-extracting
test -f "$base-self.sh"
fi
done