ci.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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@v6
  26. - uses: actions/setup-go@v6
  27. with:
  28. go-version-file: go.mod
  29. cache: true
  30. - name: Stub web/dist for go:embed
  31. run: mkdir -p web/dist && touch web/dist/.gitkeep
  32. - name: Test
  33. run: |
  34. go list ./... | grep -v '/frontend/node_modules/' > /tmp/go-packages.txt
  35. go test $(cat /tmp/go-packages.txt)
  36. govulncheck:
  37. runs-on: ubuntu-latest
  38. steps:
  39. - uses: actions/checkout@v6
  40. - uses: actions/setup-go@v6
  41. with:
  42. go-version-file: go.mod
  43. cache: true
  44. - name: Stub web/dist for go:embed
  45. run: mkdir -p web/dist && touch web/dist/.gitkeep
  46. - name: Install govulncheck
  47. run: go install golang.org/x/vuln/cmd/govulncheck@latest
  48. - name: Run govulncheck
  49. run: govulncheck ./...
  50. frontend:
  51. runs-on: ubuntu-latest
  52. steps:
  53. - uses: actions/checkout@v6
  54. - uses: actions/setup-node@v6
  55. with:
  56. node-version-file: .nvmrc
  57. cache: npm
  58. cache-dependency-path: frontend/package-lock.json
  59. - name: Install
  60. run: npm ci
  61. working-directory: frontend
  62. - name: Lint
  63. run: npm run lint
  64. working-directory: frontend
  65. - name: Typecheck
  66. run: npm run typecheck
  67. working-directory: frontend
  68. - name: Test
  69. run: npm test
  70. working-directory: frontend
  71. - name: Build
  72. run: npm run build
  73. working-directory: frontend
  74. - name: Audit
  75. run: npm audit --audit-level=high
  76. working-directory: frontend