integration-test.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: Integration Tests
  2. on:
  3. push:
  4. branches: [master, develop]
  5. pull_request:
  6. branches: [master, develop]
  7. jobs:
  8. integration-test:
  9. name: Vitest Integration Tests
  10. runs-on: ubuntu-latest
  11. services:
  12. mysql:
  13. image: mysql:8.0
  14. env:
  15. MYSQL_ROOT_PASSWORD: root
  16. MYSQL_DATABASE: audio_book_test
  17. ports:
  18. - 3307:3306
  19. options: >-
  20. --health-cmd="mysqladmin ping"
  21. --health-interval=10s
  22. --health-timeout=5s
  23. --health-retries=5
  24. steps:
  25. - name: Checkout code
  26. uses: actions/checkout@v4
  27. - name: Setup Node.js
  28. uses: actions/setup-node@v4
  29. with:
  30. node-version: '20'
  31. cache: 'npm'
  32. cache-dependency-path: server/package-lock.json
  33. - name: Install dependencies
  34. working-directory: server
  35. run: npm ci
  36. - name: Setup database
  37. run: |
  38. mysql -h 127.0.0.1 -P 3307 -u root -proot -e "CREATE DATABASE IF NOT EXISTS audio_book_test;"
  39. npx prisma db push --skip-generate || true
  40. - name: Run integration tests
  41. working-directory: server
  42. env:
  43. TEST_DATABASE_URL: mysql://root:root@127.0.0.1:3307/audio_book_test
  44. run: npx vitest run --config vitest.config.mts tests/integration
  45. - name: Upload test results
  46. if: always()
  47. uses: actions/upload-artifact@v4
  48. with:
  49. name: integration-test-results
  50. path: tests/test-results/
  51. retention-days: 7