Skip to content

Commit 11f2aa9

Browse files
authored
Merge pull request #87 from alvinreal/fix/issue-81
feat: add compatibility matrix CI with report artifacts
2 parents 54872ea + bde03de commit 11f2aa9

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.github/workflows/ci.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
test:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
16+
fail-fast: false
1617
matrix:
1718
os: [ubuntu-latest, macos-latest, windows-latest]
1819
rust: [stable, nightly]
@@ -31,3 +32,98 @@ jobs:
3132
run: cargo build --verbose
3233
- name: Test
3334
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

Comments
 (0)