1
0

ci.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. name: CI
  2. on:
  3. pull_request:
  4. paths:
  5. - "**.go"
  6. - "go.mod"
  7. - "go.sum"
  8. - "frontend/**"
  9. - ".nvmrc"
  10. push:
  11. branches:
  12. - main
  13. paths:
  14. - "**.go"
  15. - "go.mod"
  16. - "go.sum"
  17. - "frontend/**"
  18. - ".nvmrc"
  19. permissions:
  20. contents: read
  21. jobs:
  22. go-test:
  23. runs-on: ubuntu-latest
  24. steps:
  25. - uses: actions/checkout@v7
  26. - uses: actions/setup-go@v6
  27. with:
  28. go-version-file: go.mod
  29. cache: true
  30. - name: Stub internal/web/dist for go:embed
  31. run: mkdir -p internal/web/dist && touch internal/web/dist/.gitkeep
  32. - name: Test
  33. run: |
  34. go list ./... | grep -v '/frontend/node_modules/' > /tmp/go-packages.txt
  35. go test -shuffle=on -count=1 $(cat /tmp/go-packages.txt)
  36. codegen:
  37. runs-on: ubuntu-latest
  38. steps:
  39. - uses: actions/checkout@v7
  40. - uses: actions/setup-go@v6
  41. with:
  42. go-version-file: go.mod
  43. cache: true
  44. - uses: actions/setup-node@v6
  45. with:
  46. node-version-file: .nvmrc
  47. - name: Regenerate schemas, examples and OpenAPI
  48. run: npm run gen
  49. working-directory: frontend
  50. - name: Fail if generated files are stale (run 'npm run gen' and commit)
  51. run: git diff --exit-code -- frontend/src/generated frontend/public/openapi.json
  52. govulncheck:
  53. runs-on: ubuntu-latest
  54. steps:
  55. - uses: actions/checkout@v7
  56. - uses: actions/setup-go@v6
  57. with:
  58. go-version-file: go.mod
  59. cache: true
  60. - name: Stub internal/web/dist for go:embed
  61. run: mkdir -p internal/web/dist && touch internal/web/dist/.gitkeep
  62. - name: Install govulncheck
  63. run: go install golang.org/x/vuln/cmd/govulncheck@latest
  64. - name: Run govulncheck
  65. run: govulncheck ./...
  66. # Race + shuffle hygiene gate: data races and order-dependent tests fail the build.
  67. race:
  68. runs-on: ubuntu-latest
  69. steps:
  70. - uses: actions/checkout@v7
  71. - uses: actions/setup-go@v6
  72. with:
  73. go-version-file: go.mod
  74. cache: true
  75. - name: Stub internal/web/dist for go:embed
  76. run: mkdir -p internal/web/dist && touch internal/web/dist/.gitkeep
  77. - name: Race + shuffle
  78. run: |
  79. go list ./... | grep -v '/frontend/node_modules/' > /tmp/go-packages.txt
  80. go test -race -shuffle=on -count=1 $(cat /tmp/go-packages.txt)
  81. # Brief native-fuzz smoke on the security-/parser-critical decoders. Each runs the
  82. # generated corpus plus 30s of exploration; a crash here is a real input-handling bug.
  83. fuzz-smoke:
  84. runs-on: ubuntu-latest
  85. steps:
  86. - uses: actions/checkout@v7
  87. - uses: actions/setup-go@v6
  88. with:
  89. go-version-file: go.mod
  90. cache: true
  91. - name: Stub internal/web/dist for go:embed
  92. run: mkdir -p internal/web/dist && touch internal/web/dist/.gitkeep
  93. - name: Fuzz critical parsers (smoke)
  94. run: |
  95. go test -run '^$' -fuzz 'FuzzParseLink$' -fuzztime=30s ./internal/util/link/
  96. go test -run '^$' -fuzz 'FuzzDecodeCertPin$' -fuzztime=30s ./internal/web/runtime/
  97. golangci:
  98. runs-on: ubuntu-latest
  99. steps:
  100. - uses: actions/checkout@v7
  101. - uses: actions/setup-go@v6
  102. with:
  103. go-version-file: go.mod
  104. cache: true
  105. - name: Stub internal/web/dist for go:embed
  106. run: mkdir -p internal/web/dist && touch internal/web/dist/.gitkeep
  107. - name: golangci-lint
  108. uses: golangci/golangci-lint-action@v9
  109. with:
  110. version: latest
  111. frontend:
  112. runs-on: ubuntu-latest
  113. steps:
  114. - uses: actions/checkout@v7
  115. - uses: actions/setup-node@v6
  116. with:
  117. node-version-file: .nvmrc
  118. cache: npm
  119. cache-dependency-path: frontend/package-lock.json
  120. - name: Install
  121. run: npm ci
  122. working-directory: frontend
  123. - name: Lint
  124. run: npm run lint
  125. working-directory: frontend
  126. - name: Typecheck
  127. run: npm run typecheck
  128. working-directory: frontend
  129. - name: Test
  130. run: npm test
  131. working-directory: frontend
  132. - name: Build
  133. run: npm run build
  134. working-directory: frontend
  135. - name: Audit
  136. run: npm audit --audit-level=high
  137. working-directory: frontend