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