blob: 97bccf5d56a7b5f22898dab7cfc8676255e78391 [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'
7 - '**.md'
8 workflow_dispatch:
9
Ankush Menat9de0f752021-08-30 14:07:13 +053010concurrency:
11 group: patch-develop-${{ github.event.number }}
12 cancel-in-progress: true
Suraj Shetty490aed22021-05-08 00:04:34 +053013
14jobs:
15 test:
Ankush Menat602374a2021-08-30 18:24:48 +053016 runs-on: ubuntu-latest
Ankush0bb60b32021-07-29 17:15:12 +053017 timeout-minutes: 60
Suraj Shetty490aed22021-05-08 00:04:34 +053018
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 Menate5e00702021-08-30 12:07:11 +053037 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 Shetty490aed22021-05-08 00:04:34 +053044
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'souzac68006b2021-06-03 20:05:00 +053085 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 Menat27cbeb92021-09-26 14:10:52 +053089
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 Menatb7285972021-11-10 17:59:07 +053096 branch_name="version-$version-hotfix"
Ankush Menat27cbeb92021-09-26 14:10:52 +053097
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'souzac68006b2021-06-03 20:05:00 +0530112 bench --site test_site migrate