Skip to content

Commit e138d82

Browse files
author
metalmon
committed
Merge remote-tracking branch 'frappe/develop' into develop
2 parents ca3bb5f + a8c8351 commit e138d82

612 files changed

Lines changed: 234427 additions & 38733 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"hljs": true,
9797
"Awesomplete": true,
9898
"Sortable": true,
99+
"gemoji": true,
99100
"Showdown": true,
100101
"Taggle": true,
101102
"Gantt": true,

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ e9bbe03354079cfcef65a77b0c33f57b047a7c93
6161

6262
# replace `frappe.flags.in_test` with `frappe.in_test`
6363
653c80b8483cc41aef25cd7d66b9b6bb188bf5f8
64+
65+
# another ruff update
66+
6ca4d4d167a1a009d99062747711de7a994aa633

.github/actions/setup/action.yml

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
name: 'Setup Environment'
2+
description: 'Sets up the environment for Frappe development'
3+
inputs:
4+
python-version:
5+
description: 'Python version to use'
6+
required: false
7+
default: '3.12.6'
8+
node-version:
9+
description: 'Node.js version to use'
10+
required: false
11+
default: '22'
12+
build-assets:
13+
required: false
14+
description: 'Wether to build assets'
15+
default: true
16+
enable-coverage:
17+
required: false
18+
default: false
19+
enable-watch:
20+
required: false
21+
default: false
22+
enable-schedule:
23+
required: false
24+
default: false
25+
disable-web:
26+
required: false
27+
default: false
28+
disable-socketio:
29+
required: false
30+
default: false
31+
db:
32+
required: false
33+
default: mariadb
34+
db-root-password:
35+
required: true
36+
37+
runs:
38+
using: "composite"
39+
steps:
40+
- shell: bash -e {0}
41+
run: |
42+
# Add 'test_site' to /etc/hosts & setup git config
43+
echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
44+
git config --global init.defaultBranch main
45+
git config --global advice.detachedHead false
46+
47+
- name: Clone
48+
uses: actions/checkout@v4
49+
with:
50+
path: apps/${{ github.event.repository.name }}
51+
52+
- name: Setup Python
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: ${{ inputs.python-version }}
56+
57+
- shell: bash -e {0}
58+
run: |
59+
# Check for valid Python & Merge Conflicts
60+
python -m compileall -q -f "${GITHUB_WORKSPACE}/apps/${{ github.event.repository.name }}"
61+
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}/apps/${{ github.event.repository.name }}"
62+
then echo "Found merge conflicts"
63+
exit 1
64+
fi
65+
66+
- name: Checkout Frappe
67+
uses: actions/checkout@v4
68+
with:
69+
repository: ${{ env.FRAPPE_GH_ORG || github.repository_owner }}/frappe
70+
ref: ${{ github.event.client_payload.frappe_sha || github.base_ref || github.ref_name }}
71+
path: apps/frappe
72+
if: github.event.repository.name != 'frappe'
73+
74+
- uses: actions/setup-node@v4
75+
with:
76+
node-version: ${{ inputs.node-version }}
77+
check-latest: true
78+
79+
- name: Cache pip
80+
uses: actions/cache@v4
81+
with:
82+
path: ~/.cache/pip
83+
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
84+
restore-keys: |
85+
${{ runner.os }}-pip-
86+
${{ runner.os }}-
87+
88+
- id: yarn-cache-dir-path
89+
shell: bash -e {0}
90+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
91+
- uses: actions/cache@v4
92+
id: yarn-cache
93+
with:
94+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
95+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
96+
restore-keys: |
97+
${{ runner.os }}-yarn-
98+
99+
- shell: bash -e {0}
100+
run: |
101+
# Install System Dependencies
102+
start_time=$(date +%s)
103+
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-11.8.5"
104+
105+
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
106+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
107+
108+
sudo apt -qq update
109+
sudo apt -qq remove mysql-server mysql-client
110+
sudo apt -qq remove -y postgresql-client postgresql-client-16 postgresql-client-common
111+
sudo apt -qq install libcups2-dev redis-server mariadb-client libmariadb-dev postgresql-client-18 libpq-dev
112+
echo "/usr/lib/postgresql/18/bin" >> $GITHUB_PATH
113+
114+
wget -q -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
115+
sudo apt install /tmp/wkhtmltox.deb
116+
117+
end_time=$(date +%s)
118+
echo -e "\033[33mInstall System Dependencies: $((end_time - start_time)) seconds\033[0m"
119+
120+
- shell: bash -e {0}
121+
env:
122+
DB: ${{ inputs.db }}
123+
run: |
124+
# Init Bench & test_site
125+
start_time=$(date +%s)
126+
mkdir ${GITHUB_WORKSPACE}/{sites,config,logs,config/pids,sites/test_site}
127+
python -m venv ${GITHUB_WORKSPACE}/env
128+
source ${GITHUB_WORKSPACE}/env/bin/activate
129+
pip install --quiet --upgrade pip
130+
pip cache remove mysqlclient
131+
132+
pip install --quiet frappe-bench
133+
134+
python <<EOF
135+
from bench.config.common_site_config import setup_config
136+
from bench.config.redis import generate_config
137+
from bench.config.procfile import setup_procfile
138+
139+
bench_path = "${{ github.workspace }}"
140+
is_true = lambda str: True if str == "true" else False
141+
is_not_true = lambda str: True if str != "true" else False
142+
143+
setup_config(bench_path)
144+
generate_config(bench_path)
145+
setup_procfile(
146+
bench_path,
147+
skip_redis=False,
148+
skip_web=is_true("${{ inputs.disable-web }}"),
149+
skip_watch=is_not_true("${{ inputs.enable-watch }}"),
150+
skip_socketio=is_true("${{ inputs.disable-socketio }}"),
151+
skip_schedule=is_not_true("${{ inputs.enable-schedule }}"),
152+
with_coverage=is_true("${{ inputs.enable-coverage }}"),
153+
)
154+
EOF
155+
end_time=$(date +%s)
156+
echo -e "\033[33mInit Bench: $((end_time - start_time)) seconds\033[0m"
157+
cat ${GITHUB_WORKSPACE}/Procfile | awk '{print "\033[0;34m" $0 "\033[0m"}'
158+
# Attempt to copy the configuration file
159+
if cp "${GITHUB_WORKSPACE}/apps/${{ github.event.repository.name }}/.github/helper/db/$DB.json" ${GITHUB_WORKSPACE}/sites/test_site/site_config.json; then
160+
echo "Successfully copied ${DB}.json to site_config.json."
161+
else
162+
echo "Error: The configuration file ${GITHUB_WORKSPACE}/apps/${{ github.event.repository.name }}/.github/helper/db/$DB.json does not exist."
163+
echo "Please ensure that the database JSON file is correctly named and located in the helper/db directory."
164+
exit 1 # Exit with a non-zero status to indicate failure
165+
fi
166+
167+
if [ "$DB" == "mariadb" ]; then
168+
mariadb --host 127.0.0.1 --port 3306 -u root -p${{ inputs.db-root-password }} -e "SET GLOBAL character_set_server = 'utf8mb4'";
169+
mariadb --host 127.0.0.1 --port 3306 -u root -p${{ inputs.db-root-password }} -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'";
170+
171+
mariadb --host 127.0.0.1 --port 3306 -u root -p${{ inputs.db-root-password }} -e "CREATE DATABASE test_frappe";
172+
mariadb --host 127.0.0.1 --port 3306 -u root -p${{ inputs.db-root-password }} -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'";
173+
mariadb --host 127.0.0.1 --port 3306 -u root -p${{ inputs.db-root-password }} -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'";
174+
175+
mariadb --host 127.0.0.1 --port 3306 -u root -p${{ inputs.db-root-password }} -e "FLUSH PRIVILEGES";
176+
fi
177+
178+
if [ "$DB" == "postgres" ]; then
179+
export PGPASSWORD='travis'
180+
psql -h 127.0.0.1 -p 5432 -c "CREATE DATABASE test_frappe" -U postgres
181+
psql -h 127.0.0.1 -p 5432 -c "CREATE USER test_frappe WITH PASSWORD 'test_frappe'" -U postgres
182+
psql -h 127.0.0.1 -p 5432 -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE test_frappe TO test_frappe;"
183+
unset PGPASSWORD
184+
fi
185+
186+
- shell: bash -e {0}
187+
run: |
188+
# Install App(s)
189+
step_start_time=$(date +%s)
190+
source ${GITHUB_WORKSPACE}/env/bin/activate
191+
192+
for app in ${GITHUB_WORKSPACE}/apps/*/; do
193+
app_name="$(basename $app)"
194+
if [ -f "${app}setup.py" ] || [ -f "${app}pyproject.toml" ]; then
195+
start_time=$(date +%s)
196+
echo -e "\033[36mInstalling python app from ${app}\033[0m"
197+
pip install --upgrade -e "${app}[dev,test]"
198+
end_time=$(date +%s)
199+
echo -e "\033[36mTime taken to Install python ${app}: $((end_time - start_time)) seconds\033[0m"
200+
fi
201+
if [ "${{ inputs.build-assets }}" == "true" ] && [ -f "${app}package.json" ]; then
202+
start_time=$(date +%s)
203+
echo -e "\033[36mInstalling js app dependencies from ${app}\033[0m"
204+
pushd "$app"
205+
yarn --check-files
206+
popd
207+
end_time=$(date +%s)
208+
echo -e "\033[36mTime taken to Install js ${app}: $((end_time - start_time)) seconds\033[0m"
209+
fi
210+
echo "$app_name" >> sites/apps.txt
211+
echo -e "\033[32mAdded $app_name to $PWD/sites/apps.txt\033[0m"
212+
done
213+
step_end_time=$(date +%s)
214+
echo -e "\033[33mInstall App(s): $((step_end_time - step_start_time)) seconds\033[0m"
215+
env:
216+
TYPE: server
217+
218+
- shell: bash -e {0}
219+
run: |
220+
# Start Bench
221+
source ${GITHUB_WORKSPACE}/env/bin/activate
222+
bench start &> ${GITHUB_WORKSPACE}/bench_start.log &
223+
224+
- shell: bash -e {0}
225+
if: ${{ inputs.build-assets == 'true' }}
226+
run: |
227+
# Build Assets
228+
start_time=$(date +%s)
229+
230+
source ${GITHUB_WORKSPACE}/env/bin/activate
231+
CI=Yes bench build --force --production &
232+
build_pid=$!
233+
bench --site test_site reinstall --yes
234+
wait $build_pid
235+
236+
end_time=$(date +%s)
237+
echo -e "\033[33mBuild Assets and reinstall site: $((end_time - start_time)) seconds\033[0m"

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/helper/db/postgres.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"db_host": "127.0.0.1",
3+
"db_port": 5432,
4+
"db_name": "test_frappe",
5+
"db_password": "test_frappe",
6+
"db_type": "postgres",
7+
"allow_tests": true,
8+
"auto_email_id": "test@example.com",
9+
"mail_server": "localhost",
10+
"mail_port": 2525,
11+
"mail_login": "test@example.com",
12+
"mail_password": "test",
13+
"admin_password": "admin",
14+
"root_login": "postgres",
15+
"root_password": "travis",
16+
"host_name": "http://test_site:8000",
17+
"server_script_enabled": true
18+
}

.github/labeler.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Any python files modifed but no test files modified
2+
add-test-cases:
3+
- all:
4+
- changed-files:
5+
- any-glob-to-any-file: 'frappe/**/*.py'
6+
- all-globs-to-all-files: '!frappe/**/test*.py'
7+
8+
# Add 'release' label to any PR that is opened against the `main` branch
9+
release:
10+
- base-branch: ['^version-\d+$']

.github/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- skip-release-notes

.github/stale.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
4+
daysUntilStale: 28
5+
6+
# Number of days of inactivity before a stale Issue or Pull Request is closed.
7+
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
8+
daysUntilClose: 3
9+
10+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
11+
exemptLabels:
12+
- hotfix
13+
- no-stale
14+
15+
# Set to true to ignore issues in a project (defaults to false)
16+
exemptProjects: false
17+
18+
# Set to true to ignore issues in a milestone (defaults to false)
19+
exemptMilestones: true
20+
21+
# Label to use when marking as stale
22+
staleLabel: inactive
23+
24+
# Comment to post when marking as stale. Set to `false` to disable
25+
markComment: >
26+
This pull request has been automatically marked as stale because it has not had
27+
recent activity. It will be closed within 3 days if no further activity occurs, but it
28+
only takes a comment to keep a contribution alive :) Also, even if it is closed,
29+
you can always reopen the PR when you're ready. Thank you for contributing.
30+
31+
# Limit the number of actions per hour, from 1-30. Default is 30
32+
limitPerRun: 10
33+
34+
# Limit to only `issues` or `pulls`
35+
only: pulls

0 commit comments

Comments
 (0)