1+ name : Feature Tests
2+
3+ on :
4+ push :
5+ branches : [main, develop]
6+ pull_request :
7+ branches : [main]
8+
9+ env :
10+ CARGO_TERM_COLOR : always
11+ RUST_BACKTRACE : 1
12+
13+ jobs :
14+ test-compile-mode :
15+ name : Test Compile Mode
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v4
19+
20+ - name : Install Rust
21+ uses : dtolnay/rust-toolchain@stable
22+ with :
23+ components : rustfmt, clippy
24+
25+ - name : Cache dependencies
26+ uses : actions/cache@v4
27+ with :
28+ path : |
29+ ~/.cargo/registry
30+ ~/.cargo/git
31+ target
32+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
33+ restore-keys : |
34+ ${{ runner.os }}-cargo-
35+
36+ - name : Install test dependencies
37+ run : |
38+ # Install compression tools
39+ sudo apt-get update
40+ sudo apt-get install -y zstd gzip dash
41+
42+ - name : Build with compile mode
43+ run : cargo build --release
44+
45+ - name : Test self-extracting script creation
46+ run : |
47+ # Create test script
48+ echo 'fn main() { echo("Hello from RASH!"); }' > test.rs
49+
50+ # Compile to self-extracting script
51+ ./target/release/rash compile test.rs -o test-self-extract.sh --self-extracting
52+
53+ # Verify output exists and is executable
54+ test -f test-self-extract.sh
55+ test -x test-self-extract.sh
56+
57+ # Test execution (if base64 and zstd are available)
58+ if command -v base64 >/dev/null && command -v zstd >/dev/null; then
59+ ./test-self-extract.sh | grep "Hello from RASH!"
60+ fi
61+
62+ - name : Test container generation
63+ run : |
64+ # Test Docker format
65+ ./target/release/rash compile test.rs -o Dockerfile --container --container-format docker
66+ test -f Dockerfile
67+ grep -q "FROM scratch" Dockerfile
68+
69+ # Test OCI format
70+ ./target/release/rash compile test.rs -o container.tar --container --container-format oci
71+ test -f container.tar
72+
73+ - name : Run compile mode tests
74+ run : cargo test --workspace -- compile
75+
76+ test-playground-mode :
77+ name : Test Playground Mode
78+ runs-on : ubuntu-latest
79+ steps :
80+ - uses : actions/checkout@v4
81+
82+ - name : Install Rust
83+ uses : dtolnay/rust-toolchain@stable
84+ with :
85+ components : rustfmt, clippy
86+
87+ - name : Cache dependencies
88+ uses : actions/cache@v4
89+ with :
90+ path : |
91+ ~/.cargo/registry
92+ ~/.cargo/git
93+ target
94+ key : ${{ runner.os }}-cargo-playground-${{ hashFiles('**/Cargo.lock') }}
95+ restore-keys : |
96+ ${{ runner.os }}-cargo-playground-
97+
98+ - name : Build with playground feature
99+ run : cargo build --release --features playground
100+
101+ - name : Check playground binary
102+ run : |
103+ # Verify playground command is available
104+ ./target/release/rash playground --help || echo "Playground help available"
105+
106+ - name : Run playground tests
107+ run : cargo test --features playground -- playground
108+
109+ integration-test :
110+ name : Integration Tests
111+ needs : [test-compile-mode, test-playground-mode]
112+ runs-on : ubuntu-latest
113+ steps :
114+ - uses : actions/checkout@v4
115+
116+ - name : Install Rust
117+ uses : dtolnay/rust-toolchain@stable
118+
119+ - name : Full feature build
120+ run : cargo build --release --all-features
121+
122+ - name : Run all feature tests
123+ run : cargo test --all-features
124+
125+ - name : Test example compilation
126+ run : |
127+ for example in examples/*.rs; do
128+ if [ -f "$example" ]; then
129+ echo "Testing $example..."
130+ base=$(basename "$example" .rs)
131+
132+ # Standard transpilation
133+ ./target/release/rash build "$example" -o "$base.sh"
134+ test -f "$base.sh"
135+
136+ # Self-extracting
137+ ./target/release/rash compile "$example" -o "$base-self.sh" --self-extracting
138+ test -f "$base-self.sh"
139+ fi
140+ done
0 commit comments