mutation-testing-weekly.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. name: Weekly Mutation Testing
  2. on:
  3. # Run every Monday at 9 AM UTC
  4. schedule:
  5. - cron: '0 9 * * 1'
  6. # Allow manual trigger
  7. workflow_dispatch:
  8. env:
  9. CARGO_TERM_COLOR: always
  10. jobs:
  11. cargo-mutants:
  12. runs-on: ubuntu-latest
  13. permissions:
  14. contents: read
  15. issues: write
  16. steps:
  17. - uses: actions/checkout@v4
  18. - name: Install Rust
  19. uses: dtolnay/rust-toolchain@stable
  20. - uses: taiki-e/install-action@v2
  21. with:
  22. tool: cargo-mutants
  23. - name: Run mutation tests on cashu crate
  24. run: cargo mutants --package cashu --in-place --no-shuffle
  25. continue-on-error: true
  26. - name: Upload mutation results
  27. uses: actions/upload-artifact@v4
  28. if: always()
  29. with:
  30. name: mutants.out
  31. path: mutants.out
  32. retention-days: 90
  33. - name: Check for missed mutants and create issue
  34. if: always()
  35. run: |
  36. if [ -s mutants.out/missed.txt ]; then
  37. echo "Missed mutants found"
  38. MUTANTS_VERSION=$(cargo mutants --version)
  39. MISSED_COUNT=$(wc -l < mutants.out/missed.txt)
  40. CAUGHT_COUNT=$(wc -l < mutants.out/caught.txt 2>/dev/null || echo "0")
  41. gh issue create \
  42. --title "🧬 Weekly Mutation Testing Report - $(date +%Y-%m-%d)" \
  43. --label "mutation-testing,weekly-report" \
  44. --body "$(cat <<EOF
  45. ## Mutation Testing Results
  46. - ✅ Caught: ${CAUGHT_COUNT}
  47. - ❌ Missed: ${MISSED_COUNT}
  48. ### Top 10 Missed Mutations
  49. \`\`\`
  50. $(head -n 10 mutants.out/missed.txt)
  51. \`\`\`
  52. ### Action Items
  53. 1. Review the missed mutations above
  54. 2. Add tests to catch these mutations
  55. 3. For the complete list, check the [mutants.out artifact](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
  56. **cargo-mutants version:** ${MUTANTS_VERSION}
  57. ---
  58. 💡 **Tip:** Use \`just mutants-quick\` to test only your changes before pushing!
  59. EOF
  60. )"
  61. else
  62. echo "No missed mutants found! 🎉"
  63. fi
  64. env:
  65. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}