Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

163 rindas
5.3 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. permissions:
  11. contents: read
  12. jobs:
  13. test:
  14. runs-on: ubuntu-latest
  15. timeout-minutes: 60
  16. strategy:
  17. fail-fast: false
  18. matrix:
  19. containers: [1, 2]
  20. name: UI Tests (Cypress)
  21. services:
  22. mariadb:
  23. image: mariadb:10.6
  24. env:
  25. MARIADB_ROOT_PASSWORD: travis
  26. ports:
  27. - 3306:3306
  28. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  29. steps:
  30. - name: Clone
  31. uses: actions/checkout@v3
  32. - name: Setup Python
  33. uses: actions/setup-python@v4
  34. with:
  35. python-version: '3.10'
  36. - name: Check for valid Python & Merge Conflicts
  37. run: |
  38. python -m compileall -f "${GITHUB_WORKSPACE}"
  39. if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
  40. then echo "Found merge conflicts"
  41. exit 1
  42. fi
  43. - name: Check if build should be run
  44. id: check-build
  45. run: |
  46. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  47. env:
  48. TYPE: "ui"
  49. PR_NUMBER: ${{ github.event.number }}
  50. REPO_NAME: ${{ github.repository }}
  51. - uses: actions/setup-node@v3
  52. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  53. with:
  54. node-version: 16
  55. check-latest: true
  56. - name: Add to Hosts
  57. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  58. run: |
  59. echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  60. echo "127.0.0.1 test_site_producer" | sudo tee -a /etc/hosts
  61. - name: Cache pip
  62. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  63. uses: actions/cache@v3
  64. with:
  65. path: ~/.cache/pip
  66. key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
  67. restore-keys: |
  68. ${{ runner.os }}-pip-
  69. ${{ runner.os }}-
  70. - name: Cache node modules
  71. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  72. uses: actions/cache@v3
  73. env:
  74. cache-name: cache-node-modules
  75. with:
  76. path: ~/.npm
  77. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  78. restore-keys: |
  79. ${{ runner.os }}-build-${{ env.cache-name }}-
  80. ${{ runner.os }}-build-
  81. ${{ runner.os }}-
  82. - name: Get yarn cache directory path
  83. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  84. id: yarn-cache-dir-path
  85. run: echo "::set-output name=dir::$(yarn cache dir)"
  86. - uses: actions/cache@v3
  87. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  88. id: yarn-cache
  89. with:
  90. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  91. key: ${{ runner.os }}-yarn-ui-${{ hashFiles('**/yarn.lock') }}
  92. restore-keys: |
  93. ${{ runner.os }}-yarn-ui-
  94. - name: Cache cypress binary
  95. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  96. uses: actions/cache@v3
  97. with:
  98. path: ~/.cache/Cypress
  99. key: ${{ runner.os }}-cypress
  100. - name: Install Dependencies
  101. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  102. run: |
  103. bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  104. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  105. env:
  106. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  107. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  108. TYPE: ui
  109. DB: mariadb
  110. - name: Verify yarn.lock
  111. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  112. run: |
  113. cd ~/influxframework-bench/apps/influxframework
  114. yarn install --immutable --immutable-cache --check-cache
  115. git diff --exit-code yarn.lock
  116. - name: Instrument Source Code
  117. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  118. run: cd ~/influxframework-bench/apps/influxframework/ && npx nyc instrument -x 'influxframework/public/dist/**' -x 'influxframework/public/js/lib/**' -x '**/*.bundle.js' --compact=false --in-place influxframework
  119. - name: Build
  120. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  121. run: cd ~/influxframework-bench/ && bench build --apps influxframework
  122. - name: Site Setup
  123. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  124. run: |
  125. cd ~/influxframework-bench/
  126. bench --site test_site execute influxframework.utils.install.complete_setup_wizard
  127. bench --site test_site execute influxframework.tests.ui_test_helpers.create_test_user
  128. - name: UI Tests
  129. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  130. run: |
  131. cd ~/influxframework-bench/
  132. bench --site test_site run-ui-tests influxframework --headless --parallel --ci-build-id $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT -- --record
  133. env:
  134. CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb
  135. - name: Show bench console if tests failed
  136. if: ${{ failure() }}
  137. run: cat ~/influxframework-bench/bench_start.log