e2e-tests.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. name: E2E Tests
  2. on:
  3. push:
  4. branches: [ main, develop ]
  5. paths:
  6. - 'web/tests/e2e/**'
  7. - 'web/src/**'
  8. - '.github/workflows/e2e-tests.yml'
  9. pull_request:
  10. branches: [ main ]
  11. paths:
  12. - 'web/tests/e2e/**'
  13. - 'web/src/**'
  14. - '.github/workflows/e2e-tests.yml'
  15. workflow_dispatch:
  16. jobs:
  17. e2e-tests:
  18. runs-on: ubuntu-latest
  19. timeout-minutes: 30
  20. services:
  21. mysql:
  22. image: mysql:8.0.36
  23. env:
  24. MYSQL_DATABASE: test_d8dai
  25. MYSQL_ROOT_PASSWORD: test_password
  26. MYSQL_USER: test_user
  27. MYSQL_PASSWORD: test_password
  28. options: >-
  29. --health-cmd="mysqladmin ping"
  30. --health-interval=10s
  31. --health-timeout=5s
  32. --health-retries=3
  33. ports:
  34. - 3306:3306
  35. steps:
  36. - name: Checkout code
  37. uses: actions/checkout@v4
  38. - name: Setup Node.js
  39. uses: actions/setup-node@v4
  40. with:
  41. node-version: '20'
  42. cache: 'pnpm'
  43. - name: Install pnpm
  44. uses: pnpm/action-setup@v2
  45. with:
  46. version: 8
  47. - name: Install dependencies
  48. run: pnpm install --frozen-lockfile
  49. - name: Install Playwright browsers
  50. run: npx playwright install --with-deps chromium
  51. - name: Setup test environment
  52. run: |
  53. cp .env.example .env.test
  54. echo "DATABASE_URL=mysql://root:test_password@localhost:3306/test_d8dai" >> .env.test
  55. echo "NODE_ENV=test" >> .env.test
  56. - name: Run database migrations
  57. run: |
  58. export NODE_ENV=test
  59. pnpm db:migrate
  60. - name: Run E2E tests
  61. run: |
  62. export NODE_ENV=test
  63. cd web
  64. pnpm test:e2e --project=chromium
  65. env:
  66. E2E_BASE_URL: http://localhost:8080
  67. - name: Upload test results
  68. if: always()
  69. uses: actions/upload-artifact@v4
  70. with:
  71. name: playwright-report
  72. path: tests/e2e/playwright-report/
  73. retention-days: 7
  74. - name: Upload test results (JUnit)
  75. if: always()
  76. uses: actions/upload-artifact@v4
  77. with:
  78. name: test-results
  79. path: test-results/
  80. retention-days: 7
  81. - name: Generate test summary
  82. if: always()
  83. uses: test-summary/action@v2
  84. with:
  85. paths: test-results/junit.xml
  86. - name: Analyze test results
  87. if: always()
  88. run: |
  89. cd web
  90. pnpm test:analyze
  91. - name: Notify on failure
  92. if: failure()
  93. uses: 8398a7/action-slack@v3
  94. with:
  95. status: ${{ job.status }}
  96. channel: '#ci-notifications'
  97. webhook_url: ${{ secrets.SLACK_WEBHOOK }}
  98. env:
  99. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}