|
7 | 7 | workflow_dispatch: |
8 | 8 | inputs: |
9 | 9 | test_type: |
10 | | - description: 'Type of cross-platform test to run' |
| 10 | + description: "Type of cross-platform test to run" |
11 | 11 | required: true |
12 | | - default: 'full' |
| 12 | + default: "full" |
13 | 13 | type: choice |
14 | 14 | options: |
15 | 15 | - full |
16 | 16 | - quick |
17 | 17 | - targets-only |
18 | 18 |
|
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
19 | 22 | env: |
20 | 23 | CARGO_TERM_COLOR: always |
21 | 24 |
|
|
78 | 81 |
|
79 | 82 | - name: Install cross (for cross-compilation) |
80 | 83 | if: matrix.cross == true |
81 | | - run: cargo install cross --git https://github.com/cross-rs/cross |
| 84 | + run: cargo install cross --locked |
82 | 85 |
|
83 | 86 | - name: Cache cargo registry |
84 | 87 | uses: actions/cache@v5 |
@@ -215,17 +218,20 @@ jobs: |
215 | 218 | ./target/release/batless${{ matrix.binary_extension }} large_test.txt --max-lines=100 --mode=plain > /dev/null |
216 | 219 | ./target/release/batless${{ matrix.binary_extension }} large_test.txt --max-bytes=1024 --mode=plain > /dev/null |
217 | 220 |
|
218 | | - - name: Test error handling |
219 | | - shell: ${{ matrix.shell }} |
| 221 | + - name: Test error handling (Unix) |
| 222 | + if: matrix.os != 'windows-latest' |
| 223 | + shell: bash |
220 | 224 | run: | |
221 | | - # Test non-existent file (cross-platform compatible) |
222 | | - if [[ "${{ matrix.os }}" == "windows-latest" ]]; then |
223 | | - ./target/release/batless${{ matrix.binary_extension }} nonexistent.txt 2>&1 | findstr /i "error" || echo "Error handling test passed" |
224 | | - else |
225 | | - set +e # Don't fail on expected errors |
226 | | - ./target/release/batless${{ matrix.binary_extension }} nonexistent.txt 2>&1 | grep -i "error" || echo "Error handling test passed" |
227 | | - set -e |
228 | | - fi |
| 225 | + set +e # Don't fail on expected errors |
| 226 | + ./target/release/batless nonexistent.txt 2>&1 | grep -i "error" || echo "Error handling test passed" |
| 227 | + set -e |
| 228 | +
|
| 229 | + - name: Test error handling (Windows) |
| 230 | + if: matrix.os == 'windows-latest' |
| 231 | + shell: pwsh |
| 232 | + run: | |
| 233 | + $output = & "./target/release/batless.exe" nonexistent.txt 2>&1 | Out-String |
| 234 | + if ($output -match "(?i)error") { Write-Host "Error handling test passed" } else { Write-Host "Error handling test passed (no error string)" } |
229 | 235 |
|
230 | 236 | integration-validation: |
231 | 237 | name: Integration Validation |
@@ -273,7 +279,8 @@ jobs: |
273 | 279 | name: Cross-Platform Report |
274 | 280 | runs-on: ubuntu-latest |
275 | 281 | if: always() |
276 | | - needs: [cross-compile-targets, platform-specific-tests, integration-validation] |
| 282 | + needs: |
| 283 | + [cross-compile-targets, platform-specific-tests, integration-validation] |
277 | 284 |
|
278 | 285 | steps: |
279 | 286 | - name: Generate cross-platform report |
@@ -306,16 +313,9 @@ jobs: |
306 | 313 |
|
307 | 314 | cat report.md |
308 | 315 |
|
309 | | - - name: Comment on PR with results |
310 | | - if: github.event_name == 'pull_request' |
311 | | - uses: actions/github-script@v8 |
| 316 | + - name: Upload report |
| 317 | + uses: actions/upload-artifact@v6 |
312 | 318 | with: |
313 | | - script: | |
314 | | - const fs = require('fs'); |
315 | | - const report = fs.readFileSync('report.md', 'utf8'); |
316 | | - github.rest.issues.createComment({ |
317 | | - issue_number: context.issue.number, |
318 | | - owner: context.repo.owner, |
319 | | - repo: context.repo.repo, |
320 | | - body: report |
321 | | - }); |
| 319 | + name: cross-platform-report |
| 320 | + path: report.md |
| 321 | + retention-days: 30 |
0 commit comments