mutation.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. name: Mutation testing
  2. # Mutation testing (gremlins) is the objective check for "fake" tests: it mutates the
  3. # source and a surviving (LIVED) mutant means no test caught the change. It is SLOW, so it
  4. # runs nightly / on demand and scoped per package — never per-commit. It is informational:
  5. # no thresholds are set, so it reports survivors as artifacts without failing the build.
  6. on:
  7. schedule:
  8. - cron: "0 3 * * *" # 03:00 UTC daily
  9. workflow_dispatch:
  10. permissions:
  11. contents: read
  12. jobs:
  13. gremlins:
  14. runs-on: ubuntu-latest
  15. timeout-minutes: 120
  16. strategy:
  17. fail-fast: false
  18. matrix:
  19. include:
  20. - name: sub
  21. path: ./internal/sub/
  22. exclude: ""
  23. - name: runtime
  24. path: ./internal/web/runtime/
  25. exclude: ""
  26. - name: link
  27. path: ./internal/util/link/
  28. exclude: ""
  29. - name: database
  30. path: ./internal/database/
  31. exclude: 'dump_sqlite\.go'
  32. - name: service
  33. path: ./internal/web/service/
  34. exclude: 'server\.go|xray\.go|inbound\.go|client_bulk\.go|inbound_traffic\.go|.*_postgres_test\.go'
  35. steps:
  36. - uses: actions/checkout@v6
  37. - uses: actions/setup-go@v6
  38. with:
  39. go-version-file: go.mod
  40. cache: true
  41. - name: Stub internal/web/dist for go:embed
  42. run: mkdir -p internal/web/dist && touch internal/web/dist/.gitkeep
  43. - name: Install gremlins
  44. run: go install github.com/go-gremlins/gremlins/cmd/[email protected]
  45. - name: Run gremlins on ${{ matrix.name }}
  46. run: |
  47. OUT="mutation-${{ matrix.name }}.json"
  48. if [ -n "${{ matrix.exclude }}" ]; then
  49. gremlins unleash -E '${{ matrix.exclude }}' -o "$OUT" ${{ matrix.path }}
  50. else
  51. gremlins unleash -o "$OUT" ${{ matrix.path }}
  52. fi
  53. - name: Upload mutation report
  54. if: always()
  55. uses: actions/upload-artifact@v4
  56. with:
  57. name: mutation-${{ matrix.name }}
  58. path: mutation-${{ matrix.name }}.json
  59. if-no-files-found: ignore