blob: 4d8c51d9429daff55ba2287f7604af911b3e2ca1 [file] [log] [blame]
Suraj Shetty490aed22021-05-08 00:04:34 +05301name: Patch
2
Ankush Menat8a6b82b2021-08-13 12:59:27 +05303on:
4 pull_request:
5 paths-ignore:
6 - '**.js'
Ankush Menatf1a7e3b2022-03-14 18:19:52 +05307 - '**.css'
Ankush Menat8a6b82b2021-08-13 12:59:27 +05308 - '**.md'
Ankush Menatf1a7e3b2022-03-14 18:19:52 +05309 - '**.html'
10 - '**.csv'
Ankush Menat8a6b82b2021-08-13 12:59:27 +053011 workflow_dispatch:
12
Ankush Menat9de0f752021-08-30 14:07:13 +053013concurrency:
14 group: patch-develop-${{ github.event.number }}
15 cancel-in-progress: true
Suraj Shetty490aed22021-05-08 00:04:34 +053016
17jobs:
18 test:
Ankush Menat602374a2021-08-30 18:24:48 +053019 runs-on: ubuntu-latest
Ankush0bb60b32021-07-29 17:15:12 +053020 timeout-minutes: 60
Suraj Shetty490aed22021-05-08 00:04:34 +053021
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 Menat2854f632022-01-10 13:51:06 +053040 python-version: 3.8
Ankush Menate5e00702021-08-30 12:07:11 +053041
42 - name: Setup Node
43 uses: actions/setup-node@v2
44 with:
45 node-version: 14
46 check-latest: true
Suraj Shetty490aed22021-05-08 00:04:34 +053047
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
Ankush Menat20f85192022-06-29 12:23:17 +053055 key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
Suraj Shetty490aed22021-05-08 00:04:34 +053056 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
Conord2074b12022-01-02 12:03:10 -060086 env:
87 DB: mariadb
88 TYPE: server
Suraj Shetty490aed22021-05-08 00:04:34 +053089
90 - name: Run Patch Tests
Gavin D'souzac68006b2021-06-03 20:05:00 +053091 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 Menat27cbeb92021-09-26 14:10:52 +053095
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 Menatb7285972021-11-10 17:59:07 +0530102 branch_name="version-$version-hotfix"
Ankush Menat27cbeb92021-09-26 14:10:52 +0530103
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'souza6c726a12022-06-13 13:22:04 +0530118 bench setup requirements --python
Gavin D'souzac68006b2021-06-03 20:05:00 +0530119 bench --site test_site migrate