mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-11-08 06:15:26 +00:00
Build for v12 (#750)
* Build for v12 Typo!! * Fix Python 3.7 compatibility * Skip assets endpoint test on v12
This commit is contained in:
parent
a389c3a175
commit
6fa358ca4e
2
.github/workflows/build_stable.yml
vendored
2
.github/workflows/build_stable.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
||||
uses: frappe/frappe_docker/.github/workflows/docker-build-push.yml@main
|
||||
with:
|
||||
repo: erpnext
|
||||
version: "13"
|
||||
version: "12"
|
||||
push: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
|
@ -1,8 +1,9 @@
|
||||
#!/usr/local/bin/python
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from typing import Any, Type, TypeVar
|
||||
from typing import Any, TypeVar
|
||||
|
||||
|
||||
def update_config(**values: Any):
|
||||
@ -22,7 +23,7 @@ def update_config(**values: Any):
|
||||
_T = TypeVar("_T")
|
||||
|
||||
|
||||
def env(name: str, type_: Type[_T] = str) -> _T:
|
||||
def env(name: str, type_: type[_T] = str) -> _T:
|
||||
value = os.getenv(name)
|
||||
if not value:
|
||||
raise RuntimeError(f'Required environment variable "{name}" not set')
|
||||
|
@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import click
|
||||
import click.exceptions
|
||||
import frappe.app
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/home/frappe/frappe-bench/env/bin/python
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
@ -48,7 +49,7 @@ def get_files_from_previous_backup(site_name: str) -> list[Path]:
|
||||
return files
|
||||
|
||||
|
||||
def get_bucket(args: Arguments) -> "_Bucket":
|
||||
def get_bucket(args: Arguments) -> _Bucket:
|
||||
return boto3.resource(
|
||||
service_name="s3",
|
||||
endpoint_url=args.endpoint_url,
|
||||
@ -58,7 +59,7 @@ def get_bucket(args: Arguments) -> "_Bucket":
|
||||
).Bucket(args.bucket)
|
||||
|
||||
|
||||
def upload_file(path: Path, site_name: str, bucket: "_Bucket") -> None:
|
||||
def upload_file(path: Path, site_name: str, bucket: _Bucket) -> None:
|
||||
filename = str(path.absolute())
|
||||
key = str(Path(site_name) / path.name)
|
||||
print(f"Uploading {key}")
|
||||
@ -78,7 +79,7 @@ def push_backup(args: Arguments) -> None:
|
||||
print("Done!")
|
||||
|
||||
|
||||
def parse_args(args: List[str]) -> Arguments:
|
||||
def parse_args(args: list[str]) -> Arguments:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--site", required=True)
|
||||
parser.add_argument("--bucket", required=True)
|
||||
@ -96,7 +97,7 @@ def parse_args(args: List[str]) -> Arguments:
|
||||
return parser.parse_args(args, namespace=Arguments())
|
||||
|
||||
|
||||
def main(args: List[str]) -> int:
|
||||
def main(args: list[str]) -> int:
|
||||
push_backup(parse_args(args))
|
||||
return 0
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import socket
|
||||
from typing import Any, Iterable
|
||||
from typing import Any, Iterable, Tuple
|
||||
|
||||
Address = tuple[str, int]
|
||||
Address = Tuple[str, int]
|
||||
|
||||
|
||||
async def wait_for_port(address: Address) -> None:
|
||||
|
@ -1,3 +1,4 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@ -38,12 +39,7 @@ def assets_cb(text: str):
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("url", "callback"),
|
||||
(
|
||||
("/", index_cb),
|
||||
("/api/method/version", api_cb),
|
||||
("/assets/frappe/images/frappe-framework-logo.svg", assets_cb),
|
||||
),
|
||||
("url", "callback"), (("/", index_cb), ("/api/method/version", api_cb))
|
||||
)
|
||||
def test_endpoints(url: str, callback: Any, frappe_site: str):
|
||||
check_url_content(
|
||||
@ -51,6 +47,17 @@ def test_endpoints(url: str, callback: Any, frappe_site: str):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
os.environ["FRAPPE_VERSION"][0:3] == "v12", reason="v12 doesn't have the asset"
|
||||
)
|
||||
def test_assets_endpoint(frappe_site: str):
|
||||
check_url_content(
|
||||
url=f"http://127.0.0.1/assets/frappe/images/frappe-framework-logo.svg",
|
||||
callback=assets_cb,
|
||||
site_name=frappe_site,
|
||||
)
|
||||
|
||||
|
||||
def test_files_reachable(frappe_site: str, tmp_path: Path, compose: Compose):
|
||||
content = "lalala\n"
|
||||
file_path = tmp_path / "testfile.txt"
|
||||
|
Loading…
Reference in New Issue
Block a user