e2e-tests.yml 2.4 KB

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