Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

158 wiersze
5.1 KiB

  1. name: UI
  2. on:
  3. pull_request:
  4. workflow_dispatch:
  5. push:
  6. branches: [ develop ]
  7. concurrency:
  8. group: ui-develop-${{ github.event.number }}
  9. cancel-in-progress: true
  10. jobs:
  11. test:
  12. runs-on: ubuntu-latest
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. containers: [1, 2]
  17. name: UI Tests (Cypress)
  18. services:
  19. mysql:
  20. image: mariadb:10.3
  21. env:
  22. MYSQL_ALLOW_EMPTY_PASSWORD: YES
  23. ports:
  24. - 3306:3306
  25. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  26. steps:
  27. - name: Clone
  28. uses: actions/checkout@v2
  29. - name: Setup Python
  30. uses: actions/setup-python@v2
  31. with:
  32. python-version: '3.9'
  33. - name: Check if build should be run
  34. id: check-build
  35. run: |
  36. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  37. env:
  38. TYPE: "ui"
  39. PR_NUMBER: ${{ github.event.number }}
  40. REPO_NAME: ${{ github.repository }}
  41. - uses: actions/setup-node@v2
  42. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  43. with:
  44. node-version: 14
  45. check-latest: true
  46. - name: Add to Hosts
  47. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  48. run: |
  49. echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  50. echo "127.0.0.1 test_site_producer" | sudo tee -a /etc/hosts
  51. - name: Cache pip
  52. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  53. uses: actions/cache@v2
  54. with:
  55. path: ~/.cache/pip
  56. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
  57. restore-keys: |
  58. ${{ runner.os }}-pip-
  59. ${{ runner.os }}-
  60. - name: Cache node modules
  61. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  62. uses: actions/cache@v2
  63. env:
  64. cache-name: cache-node-modules
  65. with:
  66. path: ~/.npm
  67. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  68. restore-keys: |
  69. ${{ runner.os }}-build-${{ env.cache-name }}-
  70. ${{ runner.os }}-build-
  71. ${{ runner.os }}-
  72. - name: Get yarn cache directory path
  73. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  74. id: yarn-cache-dir-path
  75. run: echo "::set-output name=dir::$(yarn cache dir)"
  76. - uses: actions/cache@v2
  77. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  78. id: yarn-cache
  79. with:
  80. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  81. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  82. restore-keys: |
  83. ${{ runner.os }}-yarn-
  84. - name: Cache cypress binary
  85. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  86. uses: actions/cache@v2
  87. with:
  88. path: ~/.cache
  89. key: ${{ runner.os }}-cypress-
  90. restore-keys: |
  91. ${{ runner.os }}-cypress-
  92. ${{ runner.os }}-
  93. - name: Install Dependencies
  94. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  95. run: bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  96. env:
  97. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  98. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  99. TYPE: ui
  100. - name: Install
  101. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  102. run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  103. env:
  104. DB: mariadb
  105. TYPE: ui
  106. - name: Instrument Source Code
  107. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  108. run: cd ~/frappe-bench/apps/frappe/ && npx nyc instrument -x 'frappe/public/dist/**' -x 'frappe/public/js/lib/**' -x '**/*.bundle.js' --compact=false --in-place frappe
  109. - name: Build
  110. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  111. run: cd ~/frappe-bench/ && bench build --apps frappe
  112. - name: Site Setup
  113. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  114. run: cd ~/frappe-bench/ && bench --site test_site execute frappe.utils.install.complete_setup_wizard
  115. - name: UI Tests
  116. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  117. run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests frappe --with-coverage --headless --parallel --ci-build-id $GITHUB_RUN_ID
  118. env:
  119. CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb
  120. - name: Check If Coverage Report Exists
  121. id: check_coverage
  122. uses: andstor/file-existence-action@v1
  123. with:
  124. files: "/home/runner/frappe-bench/apps/frappe/.cypress-coverage/clover.xml"
  125. - name: Upload Coverage Data
  126. if: ${{ steps.check-build.outputs.build == 'strawberry' && steps.check_coverage.outputs.files_exists == 'true' }}
  127. uses: codecov/codecov-action@v2
  128. with:
  129. name: Cypress
  130. fail_ci_if_error: true
  131. directory: /home/runner/frappe-bench/apps/frappe/.cypress-coverage/
  132. verbose: true
  133. flags: ui-tests