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