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