Skip to content

Commit

Permalink
ci: version-15
Browse files Browse the repository at this point in the history
  • Loading branch information
HKuz committed Mar 7, 2024
1 parent 399384f commit c9deda4
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 19 deletions.
22 changes: 20 additions & 2 deletions .github/helper/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,25 @@ mysql --host 127.0.0.1 --port 3306 -u root -e "GRANT ALL PRIVILEGES ON \`test_si
mysql --host 127.0.0.1 --port 3306 -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'" # match site_cofig
mysql --host 127.0.0.1 --port 3306 -u root -e "FLUSH PRIVILEGES"

git clone https://github.com/frappe/frappe --branch version-14
echo "------ CI VARIABLES ------"
echo "GITHUB_EVENT_NAME:"
echo "${GITHUB_EVENT_NAME}" # push, pull_request
echo "GITHUB_BASE_REF:" # only works when event is pull request
echo "${GITHUB_BASE_REF}" # blank for push, version-14 for pull_request
echo "GITHUB_REF_NAME (for push/tag, format for PR is pr#/merge):"
echo "${GITHUB_REF_NAME}" # version-15 for push, pr#/merge for pull_request
echo "--------------------------"

if [ "${GITHUB_EVENT_NAME}" = 'pull_request' ]; then
echo "GITHUB_EVENT_NAME IS pull_request"
BRANCH_NAME="${GITHUB_BASE_REF}"
else
echo "GITHUB_EVENT_NAME IS push"
BRANCH_NAME="${GITHUB_REF_NAME}"
fi
echo "BRANCH_NAME IS: ${BRANCH_NAME}"

git clone https://github.com/frappe/frappe --branch "${BRANCH_NAME}"
bench init frappe-bench --frappe-path ~/frappe --python "$(which python)" --skip-assets --ignore-exist

mkdir ~/frappe-bench/sites/test_site
Expand All @@ -41,7 +59,7 @@ sed -i 's/schedule:/# schedule:/g' Procfile
sed -i 's/socketio:/# socketio:/g' Procfile
sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile

bench get-app https://github.com/frappe/erpnext --branch version-14 --resolve-deps --skip-assets
bench get-app https://github.com/frappe/erpnext --branch "${BRANCH_NAME}" --resolve-deps --skip-assets
bench get-app beam "${GITHUB_WORKSPACE}" --skip-assets --resolve-deps

printf '%s\n' 'frappe' 'erpnext' 'beam' > ~/frappe-bench/sites/apps.txt
Expand Down
8 changes: 6 additions & 2 deletions .github/validate_customizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def validate_module(customized_doctypes, set_module=False):
modules = (app_dir / this_app / "modules.txt").read_text().split("\n")
for doctype, customize_files in customized_doctypes.items():
for customize_file in customize_files:
if not this_app in str(customize_file):
if (
not this_app == customize_file.parent.parent.parent.parent.stem
): # Updated to accommodate local folders named same as app
continue
module = customize_file.parent.parent.stem
file_contents = json.loads(customize_file.read_text())
Expand Down Expand Up @@ -86,7 +88,9 @@ def validate_no_custom_perms(customized_doctypes):
this_app = pathlib.Path(__file__).resolve().parent.parent.stem
for doctype, customize_files in customized_doctypes.items():
for customize_file in customize_files:
if not this_app in str(customize_file):
if (
not this_app == customize_file.parent.parent.parent.parent.stem
): # Updated to accommodate local folders named same as app
continue
file_contents = json.loads(customize_file.read_text())
if file_contents.get("custom_perms"):
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Linters
on:
push:
branches:
- main
- version-14
- version-15
pull_request:

env:
Expand All @@ -29,8 +29,8 @@ jobs:
- name: Install mypy
run: pip install mypy

# - name: Install mypy types
# run: mypy ./aterp/. --install-types
- name: Install mypy types
run: mypy ./beam/. --install-types --non-interactive

- name: Run mypy
uses: sasanquaneuf/mypy-github-action@releases/v1
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
run: git clone --depth 1 https://gist.github.com/f1bf2c11f78331b2417189c385022c28.git validate_json

- name: Validate JSON
run: python3 validate_json/validate_json.py ./aterp/aterp/
run: python3 validate_json/validate_json.py ./beam/beam/

- name: Compile
run: python3 -m compileall -q ./
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- version-14
- version-15
pull_request:
branches:
- version-14
- version-15

# concurrency:
# group: develop-cloud_storage-${{ github.event.number }}
Expand Down Expand Up @@ -43,7 +45,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18
check-latest: true
cache: 'yarn' # Replaces `Get yarn cache directory path` and `yarn-cache` steps

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- version-14
# - version-15 # TODO: uncomment
jobs:
release:
name: Release
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ MIT

## Install Instructions

Set up a new bench, substitute a path to the python version to use, which should 3.10 latest
Set up a new bench, substitute a path to the python version to use, which should be 3.10 latest

```
# for linux development
bench init --frappe-branch version-14 {{ bench name }} --python ~/.pyenv/versions/3.10.4/bin/python3
bench init --frappe-branch version-15 {{ bench name }} --python ~/.pyenv/versions/3.10.13/bin/python3
```
Create a new site in that bench
```
cd {{ bench name }}
bench new-site {{ site name }} --force --db-name {{ site name }}
bench use {{ site name }}
```
Download the ERPNext app, its prerequisite Payments, and the HR module
Download the ERPNext app
```
bench get-app erpnext --branch version-14
bench get-app erpnext --branch version-15
```
Download this application and install all apps
```
bench get-app beam git@github.com:agritheory/beam.git
bench get-app beam --branch version-15 git@github.com:agritheory/beam.git
```
Set developer mode in `site_config.json`
```
Expand All @@ -35,7 +35,10 @@ nano site_config.json
"developer_mode": 1,
```

Enable server scripts
```
bench set-config -g server_script_enabled 1
```
Update and get the site ready
```
bench start
Expand Down
2 changes: 1 addition & 1 deletion beam/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "14.8.4"
__version__ = "15.0.0"
2 changes: 2 additions & 0 deletions beam/install.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import frappe

from beam.beam.scan.config import get_scan_doctypes
from beam.customize import load_customizations


def after_install():
load_customizations()
print("Setting up Handling Unit Inventory Dimension")
if frappe.db.exists("Inventory Dimension", "Handling Unit"):
return
Expand Down
7 changes: 6 additions & 1 deletion beam/tests/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,12 @@ def create_production_plan(settings, prod_plan_from_doc):
job_cards = frappe.get_all("Job Card", {"work_order": wo.name})
for job_card in job_cards:
job_card = frappe.get_doc("Job Card", job_card)
job_card.time_logs[0].completed_qty = wo.qty
job_card.append(
"time_logs",
{
"completed_qty": wo.qty,
},
)
job_card.save()
job_card.submit()

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"private": true,
"release": {
"branches": [
"version-14"
"version-14",
"version-15"
]
}
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ version_variables = [
]

[tool.semantic_release.branches.version]
match = "version-14"
match = "version-(14|15)"
prerelease = false

[tool.semantic_release.changelog]
Expand Down

0 comments on commit c9deda4

Please sign in to comment.