backend-ci.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. name: CI
  2. on:
  3. push:
  4. pull_request:
  5. permissions:
  6. contents: read
  7. jobs:
  8. shell:
  9. runs-on: macos-15
  10. steps:
  11. - uses: actions/checkout@v6
  12. - name: Check deployment scripts
  13. run: |
  14. /bin/bash -n deploy/apple-container.sh
  15. /bin/bash deploy/tests/apple-container-test.sh
  16. /bin/sh deploy/tests/docker-compose-security-test.sh
  17. /bin/sh deploy/tests/docker-compose-gateway-env-test.sh
  18. /bin/sh deploy/tests/docker-runtime-resources-test.sh
  19. /bin/sh deploy/test-caddyfile-cache.sh
  20. test:
  21. runs-on: ubuntu-latest
  22. steps:
  23. - uses: actions/checkout@v6
  24. - uses: actions/setup-go@v6
  25. with:
  26. go-version-file: backend/go.mod
  27. check-latest: false
  28. cache: true
  29. cache-dependency-path: backend/go.sum
  30. - name: Verify Go version
  31. run: |
  32. go version | grep -q 'go1.27.0'
  33. - name: Unit tests
  34. working-directory: backend
  35. run: make test-unit
  36. - name: Integration tests
  37. working-directory: backend
  38. run: make test-integration
  39. protection-database:
  40. runs-on: ubuntu-latest
  41. timeout-minutes: 20
  42. services:
  43. postgres:
  44. image: postgres:16
  45. env:
  46. POSTGRES_USER: protection_review
  47. POSTGRES_PASSWORD: local-ci-only
  48. POSTGRES_DB: relay_protection_test
  49. ports: ['5432:5432']
  50. options: >-
  51. --health-cmd 'pg_isready -U protection_review -d relay_protection_test'
  52. --health-interval 5s --health-timeout 5s --health-retries 20
  53. env:
  54. REQUIRE_DATABASE_TESTS: '1'
  55. PROTECTION_TEST_DSN: postgres://protection_review:local-ci-only@127.0.0.1:5432/relay_protection_test?sslmode=disable
  56. USER_CLEANUP_TEST_DSN: postgres://protection_review:local-ci-only@127.0.0.1:5432/relay_protection_test?sslmode=disable
  57. INTELLIGENT_TESTS_TEST_DSN: postgres://protection_review:local-ci-only@127.0.0.1:5432/relay_protection_test?sslmode=disable
  58. steps:
  59. - uses: actions/checkout@v6
  60. - uses: actions/setup-go@v6
  61. with:
  62. go-version-file: backend/go.mod
  63. cache-dependency-path: backend/go.sum
  64. - name: Run protection, hierarchy, cleanup and queue database tests
  65. working-directory: backend
  66. run: go test -tags=protectionintegration ./internal/repository ./internal/service -run 'Test(AccountProtection|AccountTraffic|GroupDetailStats|ProtectionTransitionDatabase|ProtectedProxy|RateLimitObservation|UserHierarchy|UserResource|UserCleanup|Intelligent)' -count=1 -timeout=10m
  67. frontend:
  68. runs-on: ubuntu-latest
  69. steps:
  70. - uses: actions/checkout@v6
  71. - name: Setup pnpm
  72. uses: pnpm/action-setup@v6
  73. with:
  74. version: 9
  75. - name: Setup Node.js
  76. uses: actions/setup-node@v6
  77. with:
  78. node-version: '20'
  79. cache: 'pnpm'
  80. cache-dependency-path: frontend/pnpm-lock.yaml
  81. - name: Install frontend dependencies
  82. working-directory: frontend
  83. run: pnpm install --frozen-lockfile
  84. - name: Frontend typecheck and critical vitest
  85. run: make test-frontend
  86. golangci-lint:
  87. runs-on: ubuntu-latest
  88. steps:
  89. - uses: actions/checkout@v6
  90. - uses: actions/setup-go@v6
  91. with:
  92. go-version-file: backend/go.mod
  93. check-latest: false
  94. cache: true
  95. cache-dependency-path: backend/go.sum
  96. - name: Verify Go version
  97. run: |
  98. go version | grep -q 'go1.27.0'
  99. - name: golangci-lint
  100. uses: golangci/golangci-lint-action@v9
  101. with:
  102. version: v2.13
  103. args: --timeout=30m
  104. working-directory: backend