Ankush Menat | 3f14b92 | 2021-06-04 16:41:32 +0530 | [diff] [blame] | 1 | name: UI |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
Ankush Menat | 8a6b82b | 2021-08-13 12:59:27 +0530 | [diff] [blame] | 5 | paths-ignore: |
| 6 | - '**.md' |
Ankush Menat | 3f14b92 | 2021-06-04 16:41:32 +0530 | [diff] [blame] | 7 | workflow_dispatch: |
| 8 | |
Ankush Menat | 9de0f75 | 2021-08-30 14:07:13 +0530 | [diff] [blame] | 9 | concurrency: |
| 10 | group: ui-develop-${{ github.event.number }} |
| 11 | cancel-in-progress: true |
| 12 | |
Ankush Menat | 3f14b92 | 2021-06-04 16:41:32 +0530 | [diff] [blame] | 13 | jobs: |
| 14 | test: |
Ankush Menat | 602374a | 2021-08-30 18:24:48 +0530 | [diff] [blame] | 15 | runs-on: ubuntu-latest |
Ankush | 0bb60b3 | 2021-07-29 17:15:12 +0530 | [diff] [blame] | 16 | timeout-minutes: 60 |
Ankush Menat | 3f14b92 | 2021-06-04 16:41:32 +0530 | [diff] [blame] | 17 | |
| 18 | strategy: |
| 19 | fail-fast: false |
| 20 | |
| 21 | name: UI Tests (Cypress) |
| 22 | |
| 23 | services: |
| 24 | mysql: |
| 25 | image: mariadb:10.3 |
| 26 | env: |
| 27 | MYSQL_ALLOW_EMPTY_PASSWORD: YES |
| 28 | ports: |
| 29 | - 3306:3306 |
| 30 | options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |
| 31 | |
| 32 | steps: |
| 33 | - name: Clone |
| 34 | uses: actions/checkout@v2 |
| 35 | |
| 36 | - name: Setup Python |
| 37 | uses: actions/setup-python@v2 |
| 38 | with: |
| 39 | python-version: 3.7 |
| 40 | |
| 41 | - uses: actions/setup-node@v2 |
| 42 | with: |
| 43 | node-version: 14 |
| 44 | check-latest: true |
| 45 | |
| 46 | - name: Add to Hosts |
| 47 | run: | |
| 48 | echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts |
| 49 | |
| 50 | - name: Cache pip |
| 51 | uses: actions/cache@v2 |
| 52 | with: |
| 53 | path: ~/.cache/pip |
| 54 | key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 55 | restore-keys: | |
| 56 | ${{ runner.os }}-pip- |
| 57 | ${{ runner.os }}- |
| 58 | |
| 59 | - name: Cache node modules |
| 60 | uses: actions/cache@v2 |
| 61 | env: |
| 62 | cache-name: cache-node-modules |
| 63 | with: |
| 64 | path: ~/.npm |
| 65 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 66 | restore-keys: | |
| 67 | ${{ runner.os }}-build-${{ env.cache-name }}- |
| 68 | ${{ runner.os }}-build- |
| 69 | ${{ runner.os }}- |
| 70 | |
| 71 | - name: Get yarn cache directory path |
| 72 | id: yarn-cache-dir-path |
| 73 | run: echo "::set-output name=dir::$(yarn cache dir)" |
| 74 | |
| 75 | - uses: actions/cache@v2 |
| 76 | id: yarn-cache |
| 77 | with: |
| 78 | path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 79 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 80 | restore-keys: | |
| 81 | ${{ runner.os }}-yarn- |
| 82 | |
| 83 | - name: Cache cypress binary |
| 84 | uses: actions/cache@v2 |
| 85 | with: |
| 86 | path: ~/.cache |
| 87 | key: ${{ runner.os }}-cypress- |
| 88 | restore-keys: | |
| 89 | ${{ runner.os }}-cypress- |
| 90 | ${{ runner.os }}- |
| 91 | |
| 92 | - name: Install |
| 93 | run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh |
| 94 | env: |
| 95 | DB: mariadb |
| 96 | TYPE: ui |
| 97 | |
| 98 | - name: Site Setup |
| 99 | run: cd ~/frappe-bench/ && bench --site test_site execute erpnext.setup.utils.before_tests |
| 100 | |
Ankush Menat | a68344f | 2021-06-29 21:33:55 +0530 | [diff] [blame] | 101 | - name: cypress pre-requisites |
Ankush Menat | ae55eab | 2021-08-26 20:43:06 +0530 | [diff] [blame] | 102 | run: cd ~/frappe-bench/apps/frappe && yarn add cypress-file-upload@^5 @testing-library/cypress@^8 --no-lockfile |
Ankush Menat | a68344f | 2021-06-29 21:33:55 +0530 | [diff] [blame] | 103 | |
Ankush Menat | 3f14b92 | 2021-06-04 16:41:32 +0530 | [diff] [blame] | 104 | |
| 105 | - name: Build Assets |
| 106 | run: cd ~/frappe-bench/ && bench build |
Ankush Menat | 35e30bd | 2021-10-05 21:44:34 +0530 | [diff] [blame] | 107 | env: |
| 108 | CI: Yes |
Ankush Menat | 3f14b92 | 2021-06-04 16:41:32 +0530 | [diff] [blame] | 109 | |
| 110 | - name: UI Tests |
| 111 | run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests erpnext --headless |
| 112 | env: |
Rucha Mahabal | 9dfddca | 2021-07-16 10:32:38 +0530 | [diff] [blame] | 113 | CYPRESS_RECORD_KEY: 60a8e3bf-08f5-45b1-9269-2b207d7d30cd |
Ankush Menat | 203c2b2 | 2021-07-02 22:35:15 +0530 | [diff] [blame] | 114 | |
| 115 | - name: Show bench console if tests failed |
| 116 | if: ${{ failure() }} |
| 117 | run: cat ~/frappe-bench/bench_run_logs.txt |