25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

163 lines
4.6 KiB

  1. name: UI
  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: ui-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: "ui"
  29. PR_NUMBER: ${{ github.event.number }}
  30. REPO_NAME: ${{ github.repository }}
  31. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  32. test:
  33. runs-on: ubuntu-latest
  34. needs: checkrun
  35. if: ${{ needs.checkrun.outputs.build == 'strawberry' && github.repository_owner == 'xhiveframework' }}
  36. timeout-minutes: 60
  37. env:
  38. NODE_ENV: "production"
  39. strategy:
  40. fail-fast: false
  41. matrix:
  42. # Make sure you modify coverage submission file list if changing this
  43. container: [1, 2, 3]
  44. name: UI Tests (Cypress)
  45. services:
  46. mariadb:
  47. image: mariadb:10.6
  48. env:
  49. MARIADB_ROOT_PASSWORD: travis
  50. ports:
  51. - 3306:3306
  52. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  53. steps:
  54. - name: Clone
  55. uses: actions/checkout@v4
  56. - name: Setup Python
  57. uses: actions/setup-python@v4
  58. with:
  59. python-version: '3.10'
  60. - name: Check for valid Python & Merge Conflicts
  61. run: |
  62. python -m compileall -q -f "${GITHUB_WORKSPACE}"
  63. if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
  64. then echo "Found merge conflicts"
  65. exit 1
  66. fi
  67. - uses: actions/setup-node@v3
  68. with:
  69. node-version: 18
  70. check-latest: true
  71. - name: Add to Hosts
  72. run: |
  73. echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  74. - name: Cache pip
  75. uses: actions/cache@v3
  76. with:
  77. path: ~/.cache/pip
  78. key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
  79. restore-keys: |
  80. ${{ runner.os }}-pip-
  81. ${{ runner.os }}-
  82. - name: Get yarn cache directory path
  83. id: yarn-cache-dir-path
  84. run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
  85. - uses: actions/cache@v3
  86. id: yarn-cache
  87. with:
  88. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  89. key: ${{ runner.os }}-yarn-ui-${{ hashFiles('**/yarn.lock') }}
  90. restore-keys: |
  91. ${{ runner.os }}-yarn-ui-
  92. - name: Cache cypress binary
  93. uses: actions/cache@v3
  94. with:
  95. path: ~/.cache/Cypress
  96. key: ${{ runner.os }}-cypress
  97. - name: Install Dependencies
  98. run: |
  99. bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  100. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  101. env:
  102. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  103. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  104. TYPE: ui
  105. DB: mariadb
  106. - name: Verify yarn.lock
  107. run: |
  108. cd ~/xhiveframework-bench/apps/xhiveframework
  109. git diff --exit-code yarn.lock
  110. - name: Build
  111. run: cd ~/xhiveframework-bench/ && bench build --apps xhiveframework
  112. - name: Site Setup
  113. run: |
  114. cd ~/xhiveframework-bench/
  115. bench --site test_site execute xhiveframework.utils.install.complete_setup_wizard
  116. bench --site test_site execute xhiveframework.tests.ui_test_helpers.create_test_user
  117. - name: UI Tests
  118. run: cd ~/xhiveframework-bench/ && bench --site test_site run-ui-tests xhiveframework --headless --parallel --ci-build-id $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT
  119. env:
  120. CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb
  121. - name: Show bench output
  122. if: ${{ always() }}
  123. run: cat ~/xhiveframework-bench/bench_start.log || true
  124. faux-test:
  125. runs-on: ubuntu-latest
  126. needs: checkrun
  127. if: ${{ needs.checkrun.outputs.build != 'strawberry' && github.repository_owner == 'xhiveframework' }}
  128. name: UI Tests (Cypress)
  129. strategy:
  130. matrix:
  131. container: [1, 2, 3]
  132. steps:
  133. - name: Pass skipped tests unconditionally
  134. run: "echo Skipped"