|
13 | 13 | test: |
14 | 14 | runs-on: ${{ matrix.os }} |
15 | 15 | strategy: |
| 16 | + fail-fast: false |
16 | 17 | matrix: |
17 | 18 | os: [ubuntu-latest, macos-latest, windows-latest] |
18 | 19 | rust: [stable, nightly] |
|
31 | 32 | run: cargo build --verbose |
32 | 33 | - name: Test |
33 | 34 | run: cargo test --verbose |
| 35 | + - name: Write cell result |
| 36 | + if: always() |
| 37 | + shell: bash |
| 38 | + run: | |
| 39 | + mkdir -p compatibility-results |
| 40 | + echo "${{ matrix.os }},${{ matrix.rust }},${{ job.status }}" \ |
| 41 | + > "compatibility-results/${{ matrix.os }}-${{ matrix.rust }}.csv" |
| 42 | + - name: Upload cell result |
| 43 | + if: always() |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: compat-cell-${{ matrix.os }}-${{ matrix.rust }} |
| 47 | + path: compatibility-results/ |
| 48 | + retention-days: 90 |
| 49 | + |
| 50 | + compatibility-report: |
| 51 | + name: Compatibility Report |
| 52 | + needs: test |
| 53 | + if: always() |
| 54 | + runs-on: ubuntu-latest |
| 55 | + steps: |
| 56 | + - uses: actions/download-artifact@v4 |
| 57 | + with: |
| 58 | + pattern: compat-cell-* |
| 59 | + merge-multiple: true |
| 60 | + path: results |
| 61 | + |
| 62 | + - name: Generate compatibility matrix summary |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + set -euo pipefail |
| 66 | +
|
| 67 | + REPORT="compatibility-report" |
| 68 | + mkdir -p "$REPORT" |
| 69 | +
|
| 70 | + # Header |
| 71 | + { |
| 72 | + echo "# Compatibility Matrix" |
| 73 | + echo "" |
| 74 | + echo "**Run:** #${{ github.run_number }} " |
| 75 | + echo "**Ref:** \`${{ github.ref_name }}\` (${{ github.sha }}) " |
| 76 | + echo "**Date:** $(date -u '+%Y-%m-%d %H:%M UTC')" |
| 77 | + echo "" |
| 78 | + echo "| OS | Toolchain | Status |" |
| 79 | + echo "|---|---|---|" |
| 80 | + } > "$REPORT/compatibility-matrix.md" |
| 81 | +
|
| 82 | + ALL_PASS=true |
| 83 | + for f in results/*.csv; do |
| 84 | + while IFS=, read -r os rust status; do |
| 85 | + if [ "$status" = "success" ]; then |
| 86 | + icon="✅" |
| 87 | + else |
| 88 | + icon="❌" |
| 89 | + ALL_PASS=false |
| 90 | + fi |
| 91 | + echo "| $os | $rust | $icon $status |" >> "$REPORT/compatibility-matrix.md" |
| 92 | + done < "$f" |
| 93 | + done |
| 94 | +
|
| 95 | + echo "" >> "$REPORT/compatibility-matrix.md" |
| 96 | + if [ "$ALL_PASS" = "true" ]; then |
| 97 | + echo "**Result: ✅ All platforms pass**" >> "$REPORT/compatibility-matrix.md" |
| 98 | + else |
| 99 | + echo "**Result: ❌ Some platforms failed**" >> "$REPORT/compatibility-matrix.md" |
| 100 | + fi |
| 101 | +
|
| 102 | + # Also write a machine-readable JSON summary |
| 103 | + echo '{"cells":[' > "$REPORT/compatibility-matrix.json" |
| 104 | + FIRST=true |
| 105 | + for f in results/*.csv; do |
| 106 | + while IFS=, read -r os rust status; do |
| 107 | + if [ "$FIRST" = "true" ]; then |
| 108 | + FIRST=false |
| 109 | + else |
| 110 | + echo "," >> "$REPORT/compatibility-matrix.json" |
| 111 | + fi |
| 112 | + printf '{"os":"%s","rust":"%s","status":"%s"}' "$os" "$rust" "$status" \ |
| 113 | + >> "$REPORT/compatibility-matrix.json" |
| 114 | + done < "$f" |
| 115 | + done |
| 116 | + echo '],"all_pass":'"$ALL_PASS"'}' >> "$REPORT/compatibility-matrix.json" |
| 117 | +
|
| 118 | + cat "$REPORT/compatibility-matrix.md" |
| 119 | +
|
| 120 | + - name: Post summary to GitHub Actions |
| 121 | + shell: bash |
| 122 | + run: cat compatibility-report/compatibility-matrix.md >> "$GITHUB_STEP_SUMMARY" |
| 123 | + |
| 124 | + - name: Upload compatibility report |
| 125 | + uses: actions/upload-artifact@v4 |
| 126 | + with: |
| 127 | + name: compatibility-report |
| 128 | + path: compatibility-report/ |
| 129 | + retention-days: 90 |
0 commit comments