Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 1 | name: Patch |
| 2 | |
Ankush Menat | 8a6b82b | 2021-08-13 12:59:27 +0530 | [diff] [blame] | 3 | on: |
| 4 | pull_request: |
| 5 | paths-ignore: |
| 6 | - '**.js' |
| 7 | - '**.md' |
| 8 | workflow_dispatch: |
| 9 | |
Ankush Menat | 9de0f75 | 2021-08-30 14:07:13 +0530 | [diff] [blame] | 10 | concurrency: |
| 11 | group: patch-develop-${{ github.event.number }} |
| 12 | cancel-in-progress: true |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 13 | |
| 14 | jobs: |
| 15 | test: |
Ankush Menat | 602374a | 2021-08-30 18:24:48 +0530 | [diff] [blame] | 16 | runs-on: ubuntu-latest |
Ankush | 0bb60b3 | 2021-07-29 17:15:12 +0530 | [diff] [blame] | 17 | timeout-minutes: 60 |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 18 | |
| 19 | name: Patch Test |
| 20 | |
| 21 | services: |
| 22 | mysql: |
| 23 | image: mariadb:10.3 |
| 24 | env: |
| 25 | MYSQL_ALLOW_EMPTY_PASSWORD: YES |
| 26 | ports: |
| 27 | - 3306:3306 |
| 28 | options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |
| 29 | |
| 30 | steps: |
| 31 | - name: Clone |
| 32 | uses: actions/checkout@v2 |
| 33 | |
| 34 | - name: Setup Python |
| 35 | uses: actions/setup-python@v2 |
| 36 | with: |
Ankush Menat | e5e0070 | 2021-08-30 12:07:11 +0530 | [diff] [blame] | 37 | python-version: 3.7 |
| 38 | |
| 39 | - name: Setup Node |
| 40 | uses: actions/setup-node@v2 |
| 41 | with: |
| 42 | node-version: 14 |
| 43 | check-latest: true |
Suraj Shetty | 490aed2 | 2021-05-08 00:04:34 +0530 | [diff] [blame] | 44 | |
| 45 | - name: Add to Hosts |
| 46 | run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts |
| 47 | |
| 48 | - name: Cache pip |
| 49 | uses: actions/cache@v2 |
| 50 | with: |
| 51 | path: ~/.cache/pip |
| 52 | key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 53 | restore-keys: | |
| 54 | ${{ runner.os }}-pip- |
| 55 | ${{ runner.os }}- |
| 56 | |
| 57 | - name: Cache node modules |
| 58 | uses: actions/cache@v2 |
| 59 | env: |
| 60 | cache-name: cache-node-modules |
| 61 | with: |
| 62 | path: ~/.npm |
| 63 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 64 | restore-keys: | |
| 65 | ${{ runner.os }}-build-${{ env.cache-name }}- |
| 66 | ${{ runner.os }}-build- |
| 67 | ${{ runner.os }}- |
| 68 | |
| 69 | - name: Get yarn cache directory path |
| 70 | id: yarn-cache-dir-path |
| 71 | run: echo "::set-output name=dir::$(yarn cache dir)" |
| 72 | |
| 73 | - uses: actions/cache@v2 |
| 74 | id: yarn-cache |
| 75 | with: |
| 76 | path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 77 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 78 | restore-keys: | |
| 79 | ${{ runner.os }}-yarn- |
| 80 | |
| 81 | - name: Install |
| 82 | run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh |
| 83 | |
| 84 | - name: Run Patch Tests |
Gavin D'souza | c68006b | 2021-06-03 20:05:00 +0530 | [diff] [blame] | 85 | run: | |
| 86 | cd ~/frappe-bench/ |
| 87 | wget https://erpnext.com/files/v10-erpnext.sql.gz |
| 88 | bench --site test_site --force restore ~/frappe-bench/v10-erpnext.sql.gz |
Ankush Menat | 27cbeb9 | 2021-09-26 14:10:52 +0530 | [diff] [blame] | 89 | |
| 90 | git -C "apps/frappe" remote set-url upstream https://github.com/frappe/frappe.git |
| 91 | git -C "apps/erpnext" remote set-url upstream https://github.com/frappe/erpnext.git |
| 92 | |
| 93 | for version in $(seq 12 13) |
| 94 | do |
| 95 | echo "Updating to v$version" |
Ankush Menat | b728597 | 2021-11-10 17:59:07 +0530 | [diff] [blame] | 96 | branch_name="version-$version-hotfix" |
Ankush Menat | 27cbeb9 | 2021-09-26 14:10:52 +0530 | [diff] [blame] | 97 | |
| 98 | git -C "apps/frappe" fetch --depth 1 upstream $branch_name:$branch_name |
| 99 | git -C "apps/erpnext" fetch --depth 1 upstream $branch_name:$branch_name |
| 100 | |
| 101 | git -C "apps/frappe" checkout -q -f $branch_name |
| 102 | git -C "apps/erpnext" checkout -q -f $branch_name |
| 103 | |
| 104 | bench setup requirements --python |
| 105 | bench --site test_site migrate |
| 106 | done |
| 107 | |
| 108 | |
| 109 | echo "Updating to latest version" |
| 110 | git -C "apps/frappe" checkout -q -f "${GITHUB_BASE_REF:-${GITHUB_REF##*/}}" |
| 111 | git -C "apps/erpnext" checkout -q -f "$GITHUB_SHA" |
Gavin D'souza | c68006b | 2021-06-03 20:05:00 +0530 | [diff] [blame] | 112 | bench --site test_site migrate |