blob: d5f005274444a8c90f36b4c63c61e5576e824bf7 [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:
Sagar Voraa2252c92022-08-09 11:49:48 +000014 group: patch-develop-${{ github.event_name }}-${{ github.event.number || github.event_name == 'workflow_dispatch' && github.run_id || '' }}
Ankush Menat9de0f752021-08-30 14:07:13 +053015 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:
Ankush Menatd23b5d82022-12-06 12:58:07 +053028 MARIADB_ROOT_PASSWORD: 'root'
Suraj Shetty490aed22021-05-08 00:04:34 +053029 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
Gavin D'souzab07dd102022-07-04 11:11:14 +053037 - name: Check for valid Python & Merge Conflicts
38 run: |
39 python -m compileall -f "${GITHUB_WORKSPACE}"
40 if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
41 then echo "Found merge conflicts"
42 exit 1
43 fi
44
Suraj Shetty490aed22021-05-08 00:04:34 +053045 - name: Setup Python
Ankush Menatb9f394a2022-06-30 16:20:59 +053046 uses: "gabrielfalcao/pyenv-action@v9"
Suraj Shetty490aed22021-05-08 00:04:34 +053047 with:
Ankush Menatb9f394a2022-06-30 16:20:59 +053048 versions: 3.10:latest, 3.7:latest
Ankush Menate5e00702021-08-30 12:07:11 +053049
50 - name: Setup Node
51 uses: actions/setup-node@v2
52 with:
53 node-version: 14
54 check-latest: true
Suraj Shetty490aed22021-05-08 00:04:34 +053055
56 - name: Add to Hosts
57 run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
58
59 - name: Cache pip
60 uses: actions/cache@v2
61 with:
62 path: ~/.cache/pip
Ankush Menat20f85192022-06-29 12:23:17 +053063 key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
Suraj Shetty490aed22021-05-08 00:04:34 +053064 restore-keys: |
65 ${{ runner.os }}-pip-
66 ${{ runner.os }}-
67
68 - name: Cache node modules
69 uses: actions/cache@v2
70 env:
71 cache-name: cache-node-modules
72 with:
73 path: ~/.npm
74 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
75 restore-keys: |
76 ${{ runner.os }}-build-${{ env.cache-name }}-
77 ${{ runner.os }}-build-
78 ${{ runner.os }}-
79
80 - name: Get yarn cache directory path
81 id: yarn-cache-dir-path
82 run: echo "::set-output name=dir::$(yarn cache dir)"
83
84 - uses: actions/cache@v2
85 id: yarn-cache
86 with:
87 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
88 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
89 restore-keys: |
90 ${{ runner.os }}-yarn-
91
92 - name: Install
Ankush Menatb9f394a2022-06-30 16:20:59 +053093 run: |
94 pip install frappe-bench
95 pyenv global $(pyenv versions | grep '3.10')
96 bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
Conord2074b12022-01-02 12:03:10 -060097 env:
98 DB: mariadb
99 TYPE: server
Suraj Shetty490aed22021-05-08 00:04:34 +0530100
101 - name: Run Patch Tests
Gavin D'souzac68006b2021-06-03 20:05:00 +0530102 run: |
103 cd ~/frappe-bench/
104 wget https://erpnext.com/files/v10-erpnext.sql.gz
105 bench --site test_site --force restore ~/frappe-bench/v10-erpnext.sql.gz
Ankush Menat27cbeb92021-09-26 14:10:52 +0530106
107 git -C "apps/frappe" remote set-url upstream https://github.com/frappe/frappe.git
108 git -C "apps/erpnext" remote set-url upstream https://github.com/frappe/erpnext.git
109
Ankush Menatb9f394a2022-06-30 16:20:59 +0530110 pyenv global $(pyenv versions | grep '3.7')
Ankush Menat27cbeb92021-09-26 14:10:52 +0530111 for version in $(seq 12 13)
112 do
113 echo "Updating to v$version"
Ankush Menatb7285972021-11-10 17:59:07 +0530114 branch_name="version-$version-hotfix"
Ankush Menat27cbeb92021-09-26 14:10:52 +0530115
116 git -C "apps/frappe" fetch --depth 1 upstream $branch_name:$branch_name
117 git -C "apps/erpnext" fetch --depth 1 upstream $branch_name:$branch_name
118
119 git -C "apps/frappe" checkout -q -f $branch_name
120 git -C "apps/erpnext" checkout -q -f $branch_name
121
Ankush Menatb9f394a2022-06-30 16:20:59 +0530122 rm -rf ~/frappe-bench/env
123 bench setup env
phot0n76493e92022-07-25 10:56:04 +0530124 bench pip install -e ./apps/payments
Ankush Menatb9f394a2022-06-30 16:20:59 +0530125 bench pip install -e ./apps/erpnext
126
Ankush Menat27cbeb92021-09-26 14:10:52 +0530127 bench --site test_site migrate
128 done
129
130
131 echo "Updating to latest version"
132 git -C "apps/frappe" checkout -q -f "${GITHUB_BASE_REF:-${GITHUB_REF##*/}}"
133 git -C "apps/erpnext" checkout -q -f "$GITHUB_SHA"
Ankush Menatb9f394a2022-06-30 16:20:59 +0530134
135 pyenv global $(pyenv versions | grep '3.10')
136 rm -rf ~/frappe-bench/env
137 bench -v setup env
phot0n76493e92022-07-25 10:56:04 +0530138 bench pip install -e ./apps/payments
Ankush Menatb9f394a2022-06-30 16:20:59 +0530139 bench pip install -e ./apps/erpnext
140
Gavin D'souzac68006b2021-06-03 20:05:00 +0530141 bench --site test_site migrate
phot0n76493e92022-07-25 10:56:04 +0530142 bench --site test_site install-app payments