|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + paths: |
| 8 | + - 'src/**' |
| 9 | + - 'Cargo.toml' |
| 10 | + - 'Cargo.lock' |
| 11 | + - 'tests/**' |
| 12 | + - '.github/workflows/integration-test.yml' |
| 13 | + pull_request: |
| 14 | + branches: [ main ] |
| 15 | + paths: |
| 16 | + - 'src/**' |
| 17 | + - 'Cargo.toml' |
| 18 | + - 'Cargo.lock' |
| 19 | + - 'tests/**' |
| 20 | + - '.github/workflows/integration-test.yml' |
| 21 | + |
| 22 | +permissions: |
| 23 | + contents: read |
| 24 | + |
| 25 | +env: |
| 26 | + CARGO_TERM_COLOR: always |
| 27 | + |
| 28 | +jobs: |
| 29 | + integration-test: |
| 30 | + name: E2E Tests (${{ matrix.os }}) |
| 31 | + runs-on: ${{ matrix.os }} |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + include: |
| 36 | + - os: ubuntu-latest |
| 37 | + binary: rnr |
| 38 | + shell: bash |
| 39 | + - os: macos-latest |
| 40 | + binary: rnr |
| 41 | + shell: bash |
| 42 | + - os: windows-latest |
| 43 | + binary: rnr.exe |
| 44 | + shell: bash |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout code |
| 48 | + uses: actions/checkout@v4 |
| 49 | + |
| 50 | + - name: Install Rust toolchain |
| 51 | + uses: dtolnay/rust-toolchain@stable |
| 52 | + |
| 53 | + - name: Cache cargo registry |
| 54 | + uses: actions/cache@v4 |
| 55 | + with: |
| 56 | + path: | |
| 57 | + ~/.cargo/registry |
| 58 | + ~/.cargo/git |
| 59 | + target |
| 60 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 61 | + restore-keys: | |
| 62 | + ${{ runner.os }}-cargo- |
| 63 | +
|
| 64 | + - name: Build release binary |
| 65 | + run: cargo build --release |
| 66 | + |
| 67 | + - name: Copy binary to test location |
| 68 | + shell: bash |
| 69 | + run: | |
| 70 | + cp target/release/${{ matrix.binary }} tests/ |
| 71 | +
|
| 72 | + # ==================== Basic Tests ==================== |
| 73 | + |
| 74 | + - name: "Test: --help" |
| 75 | + shell: bash |
| 76 | + working-directory: tests |
| 77 | + run: | |
| 78 | + echo "## --help output" >> $GITHUB_STEP_SUMMARY |
| 79 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 80 | + ./${{ matrix.binary }} --help >> $GITHUB_STEP_SUMMARY |
| 81 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 82 | +
|
| 83 | + - name: "Test: --version" |
| 84 | + shell: bash |
| 85 | + working-directory: tests |
| 86 | + run: | |
| 87 | + ./${{ matrix.binary }} --version |
| 88 | +
|
| 89 | + - name: "Test: --list (basic fixture)" |
| 90 | + shell: bash |
| 91 | + working-directory: tests/fixtures/basic |
| 92 | + run: | |
| 93 | + echo "## --list output (basic)" >> $GITHUB_STEP_SUMMARY |
| 94 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 95 | + ../../${{ matrix.binary }} --list >> $GITHUB_STEP_SUMMARY |
| 96 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 97 | +
|
| 98 | + # ==================== Basic Task Execution ==================== |
| 99 | + |
| 100 | + - name: "Test: shorthand task" |
| 101 | + shell: bash |
| 102 | + working-directory: tests/fixtures/basic |
| 103 | + run: | |
| 104 | + OUTPUT=$(../../${{ matrix.binary }} hello 2>&1) |
| 105 | + echo "$OUTPUT" |
| 106 | + if ! echo "$OUTPUT" | grep -q "Hello, World!"; then |
| 107 | + echo "ERROR: Expected 'Hello, World!' in output" |
| 108 | + exit 1 |
| 109 | + fi |
| 110 | + echo "✅ Shorthand task passed" |
| 111 | +
|
| 112 | + - name: "Test: full task with description" |
| 113 | + shell: bash |
| 114 | + working-directory: tests/fixtures/basic |
| 115 | + run: | |
| 116 | + OUTPUT=$(../../${{ matrix.binary }} build 2>&1) |
| 117 | + echo "$OUTPUT" |
| 118 | + if ! echo "$OUTPUT" | grep -q "Building project"; then |
| 119 | + echo "ERROR: Expected 'Building project' in output" |
| 120 | + exit 1 |
| 121 | + fi |
| 122 | + echo "✅ Full task passed" |
| 123 | +
|
| 124 | + - name: "Test: task with environment variables" |
| 125 | + shell: bash |
| 126 | + working-directory: tests/fixtures/basic |
| 127 | + run: | |
| 128 | + OUTPUT=$(../../${{ matrix.binary }} with-env 2>&1) |
| 129 | + echo "$OUTPUT" |
| 130 | + if ! echo "$OUTPUT" | grep -q "Environment variables are set"; then |
| 131 | + echo "ERROR: Expected 'Environment variables are set' in output" |
| 132 | + exit 1 |
| 133 | + fi |
| 134 | + echo "✅ Environment variables task passed" |
| 135 | +
|
| 136 | + # ==================== Steps Tests ==================== |
| 137 | + |
| 138 | + - name: "Test: sequential steps" |
| 139 | + shell: bash |
| 140 | + working-directory: tests/fixtures/steps |
| 141 | + run: | |
| 142 | + OUTPUT=$(../../${{ matrix.binary }} sequential 2>&1) |
| 143 | + echo "$OUTPUT" |
| 144 | + if ! echo "$OUTPUT" | grep -q "Step 1"; then |
| 145 | + echo "ERROR: Expected 'Step 1' in output" |
| 146 | + exit 1 |
| 147 | + fi |
| 148 | + if ! echo "$OUTPUT" | grep -q "Step 2"; then |
| 149 | + echo "ERROR: Expected 'Step 2' in output" |
| 150 | + exit 1 |
| 151 | + fi |
| 152 | + if ! echo "$OUTPUT" | grep -q "Step 3"; then |
| 153 | + echo "ERROR: Expected 'Step 3' in output" |
| 154 | + exit 1 |
| 155 | + fi |
| 156 | + echo "✅ Sequential steps passed" |
| 157 | +
|
| 158 | + - name: "Test: task delegation in steps" |
| 159 | + shell: bash |
| 160 | + working-directory: tests/fixtures/steps |
| 161 | + run: | |
| 162 | + OUTPUT=$(../../${{ matrix.binary }} delegate 2>&1) |
| 163 | + echo "$OUTPUT" |
| 164 | + if ! echo "$OUTPUT" | grep -q "Running step A"; then |
| 165 | + echo "ERROR: Expected 'Running step A' in output" |
| 166 | + exit 1 |
| 167 | + fi |
| 168 | + if ! echo "$OUTPUT" | grep -q "Running step B"; then |
| 169 | + echo "ERROR: Expected 'Running step B' in output" |
| 170 | + exit 1 |
| 171 | + fi |
| 172 | + if ! echo "$OUTPUT" | grep -q "Running step C"; then |
| 173 | + echo "ERROR: Expected 'Running step C' in output" |
| 174 | + exit 1 |
| 175 | + fi |
| 176 | + echo "✅ Task delegation passed" |
| 177 | +
|
| 178 | + - name: "Test: mixed sequential and parallel" |
| 179 | + shell: bash |
| 180 | + working-directory: tests/fixtures/steps |
| 181 | + run: | |
| 182 | + OUTPUT=$(../../${{ matrix.binary }} mixed 2>&1) |
| 183 | + echo "$OUTPUT" |
| 184 | + if ! echo "$OUTPUT" | grep -q "Starting"; then |
| 185 | + echo "ERROR: Expected 'Starting' in output" |
| 186 | + exit 1 |
| 187 | + fi |
| 188 | + if ! echo "$OUTPUT" | grep -q "Parallel task 1"; then |
| 189 | + echo "ERROR: Expected 'Parallel task 1' in output" |
| 190 | + exit 1 |
| 191 | + fi |
| 192 | + if ! echo "$OUTPUT" | grep -q "Parallel task 2"; then |
| 193 | + echo "ERROR: Expected 'Parallel task 2' in output" |
| 194 | + exit 1 |
| 195 | + fi |
| 196 | + if ! echo "$OUTPUT" | grep -q "Done"; then |
| 197 | + echo "ERROR: Expected 'Done' in output" |
| 198 | + exit 1 |
| 199 | + fi |
| 200 | + echo "✅ Mixed steps passed" |
| 201 | +
|
| 202 | + # ==================== Nested Task Tests ==================== |
| 203 | + |
| 204 | + - name: "Test: command in subdirectory" |
| 205 | + shell: bash |
| 206 | + working-directory: tests/fixtures/nested |
| 207 | + run: | |
| 208 | + OUTPUT=$(../../${{ matrix.binary }} run-in-subdir 2>&1) |
| 209 | + echo "$OUTPUT" |
| 210 | + if ! echo "$OUTPUT" | grep -q "Running in subproject directory"; then |
| 211 | + echo "ERROR: Expected 'Running in subproject directory' in output" |
| 212 | + exit 1 |
| 213 | + fi |
| 214 | + echo "✅ Command in subdirectory passed" |
| 215 | +
|
| 216 | + - name: "Test: nested task delegation" |
| 217 | + shell: bash |
| 218 | + working-directory: tests/fixtures/nested |
| 219 | + run: | |
| 220 | + OUTPUT=$(../../${{ matrix.binary }} build-subproject 2>&1) |
| 221 | + echo "$OUTPUT" |
| 222 | + if ! echo "$OUTPUT" | grep -q "Building subproject"; then |
| 223 | + echo "ERROR: Expected 'Building subproject' in output" |
| 224 | + exit 1 |
| 225 | + fi |
| 226 | + echo "✅ Nested task delegation passed" |
| 227 | +
|
| 228 | + # ==================== Error Cases ==================== |
| 229 | + |
| 230 | + - name: "Test: nonexistent task (should fail)" |
| 231 | + shell: bash |
| 232 | + working-directory: tests/fixtures/basic |
| 233 | + run: | |
| 234 | + if ../../${{ matrix.binary }} nonexistent 2>&1; then |
| 235 | + echo "ERROR: Expected nonexistent task to fail" |
| 236 | + exit 1 |
| 237 | + fi |
| 238 | + echo "✅ Nonexistent task correctly failed" |
| 239 | +
|
| 240 | + # ==================== Summary ==================== |
| 241 | + |
| 242 | + - name: Generate test summary |
| 243 | + if: always() |
| 244 | + shell: bash |
| 245 | + run: | |
| 246 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 247 | + echo "## Integration Test Results - ${{ matrix.os }}" >> $GITHUB_STEP_SUMMARY |
| 248 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 249 | + echo "✅ All integration tests completed" >> $GITHUB_STEP_SUMMARY |
0 commit comments