Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

165 linhas
4.3 KiB

  1. name: Server
  2. on:
  3. pull_request:
  4. workflow_dispatch:
  5. schedule:
  6. # Run everday at midnight UTC / 5:30 IST
  7. - cron: "0 0 * * *"
  8. concurrency:
  9. group: server-develop-${{ github.event_name }}-${{ github.event.number }}
  10. cancel-in-progress: true
  11. permissions:
  12. # Do not change this as GITHUB_TOKEN is being used by roulette
  13. contents: read
  14. jobs:
  15. checkrun:
  16. name: Build Check
  17. runs-on: ubuntu-latest
  18. outputs:
  19. build: ${{ steps.check-build.outputs.build }}
  20. steps:
  21. - name: Clone
  22. uses: actions/checkout@v4
  23. - name: Check if build should be run
  24. id: check-build
  25. run: |
  26. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  27. env:
  28. TYPE: "server"
  29. PR_NUMBER: ${{ github.event.number }}
  30. REPO_NAME: ${{ github.repository }}
  31. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  32. test:
  33. name: Unit Tests
  34. runs-on: ubuntu-latest
  35. needs: checkrun
  36. if: ${{ needs.checkrun.outputs.build == 'strawberry' }}
  37. timeout-minutes: 30
  38. env:
  39. NODE_ENV: "production"
  40. strategy:
  41. fail-fast: false
  42. services:
  43. mariadb:
  44. image: mariadb:10.6
  45. env:
  46. MARIADB_ROOT_PASSWORD: travis
  47. ports:
  48. - 3306:3306
  49. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  50. postgres:
  51. image: postgres:12.4
  52. env:
  53. POSTGRES_PASSWORD: travis
  54. options: >-
  55. --health-cmd pg_isready
  56. --health-interval 10s
  57. --health-timeout 5s
  58. --health-retries 5
  59. ports:
  60. - 5432:5432
  61. smtp_server:
  62. image: rnwood/smtp4dev
  63. ports:
  64. - 2525:25
  65. - 3000:80
  66. steps:
  67. - name: Clone
  68. uses: actions/checkout@v4
  69. - name: Setup Python
  70. uses: actions/setup-python@v4
  71. with:
  72. python-version: "3.10"
  73. - name: Check for valid Python & Merge Conflicts
  74. run: |
  75. python -m compileall -q -f "${GITHUB_WORKSPACE}"
  76. if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
  77. then echo "Found merge conflicts"
  78. exit 1
  79. fi
  80. - uses: actions/setup-node@v3
  81. with:
  82. node-version: 18
  83. check-latest: true
  84. - name: Add to Hosts
  85. run: |
  86. echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  87. - name: Cache pip
  88. uses: actions/cache@v3
  89. with:
  90. path: ~/.cache/pip
  91. key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
  92. restore-keys: |
  93. ${{ runner.os }}-pip-
  94. ${{ runner.os }}-
  95. - name: Get yarn cache directory path
  96. id: yarn-cache-dir-path
  97. run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
  98. - uses: actions/cache@v3
  99. id: yarn-cache
  100. with:
  101. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  102. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  103. restore-keys: |
  104. ${{ runner.os }}-yarn-
  105. - name: Install Dependencies
  106. run: |
  107. bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  108. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  109. env:
  110. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  111. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  112. TYPE: server
  113. DB: 'mariadb'
  114. - name: Run Tests
  115. run: bench --site test_site run-parallel-tests
  116. working-directory: /home/runner/xhiveframework-bench
  117. - name: Show bench output
  118. if: ${{ always() }}
  119. run: |
  120. cd ~/xhiveframework-bench
  121. cat bench_start.log || true
  122. cd logs
  123. for f in ./*.log*; do
  124. echo "Printing log: $f";
  125. cat $f
  126. done
  127. - name: Setup tmate session
  128. uses: mxschmitt/action-tmate@v3
  129. if: ${{ contains( github.event.pull_request.labels.*.name, 'debug-gha') }}
  130. # This is required because github still doesn't understand knowingly skipped tests
  131. faux-test:
  132. name: Unit Tests
  133. runs-on: ubuntu-latest
  134. needs: checkrun
  135. if: ${{ needs.checkrun.outputs.build != 'strawberry' }}
  136. steps:
  137. - name: Pass skipped tests unconditionally
  138. run: "echo Skipped"