ci.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. name: ci
  2. on:
  3. push:
  4. pull_request:
  5. workflow_dispatch:
  6. inputs:
  7. run_e2e:
  8. description: "运行浏览器冒烟"
  9. required: false
  10. default: "false"
  11. jobs:
  12. build-test:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@v4
  16. - uses: actions/setup-java@v4
  17. with:
  18. distribution: temurin
  19. java-version: "21"
  20. cache: maven
  21. - name: Backend unit tests
  22. working-directory: backend
  23. run: |
  24. chmod +x mvnw
  25. ./mvnw -q test
  26. - name: Backend integration tests
  27. working-directory: backend
  28. run: ./mvnw -q failsafe:integration-test failsafe:verify
  29. - uses: actions/setup-node@v4
  30. with:
  31. node-version: "22"
  32. cache: npm
  33. cache-dependency-path: frontend/package-lock.json
  34. - name: Frontend build
  35. working-directory: frontend
  36. run: |
  37. npm ci
  38. npm run build
  39. - name: OpenAPI validation
  40. working-directory: tests/contract
  41. run: |
  42. npm ci
  43. npm run validate
  44. - name: Docker image build
  45. run: |
  46. docker build -f deploy/backend.Dockerfile -t organization-people-platform-backend .
  47. docker build -f deploy/frontend.Dockerfile -t organization-people-platform-frontend .
  48. - name: E2E smoke
  49. if: github.event_name == 'workflow_dispatch' && github.event.inputs.run_e2e == 'true'
  50. run: |
  51. chmod +x scripts/*.sh
  52. scripts/dev-up.sh
  53. cd tests/e2e
  54. npm ci
  55. npx playwright install --with-deps chromium
  56. npm test