shipit-cli 0.18.0__tar.gz → 0.18.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/PKG-INFO +1 -1
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/pyproject.toml +1 -1
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/assets/php/php.ini +1 -1
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/assets/wordpress/install.sh +0 -4
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/php.py +116 -12
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/wordpress.py +6 -2
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/runners/wasmer.py +59 -3
- shipit_cli-0.18.2/src/shipit/version.py +5 -0
- shipit_cli-0.18.2/tests/test_wasmer_annotations.py +93 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/tests/test_wordpress_phpix.py +12 -0
- shipit_cli-0.18.0/src/shipit/version.py +0 -5
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/.gitignore +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/README.md +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/__init__.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/assets/wordpress/.htaccess +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/assets/wordpress/start.php +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/assets/wordpress/wp-config.php +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/builders/__init__.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/builders/base.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/builders/docker.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/builders/local.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/cli.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/generator.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/procfile.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/base.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/go.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/hugo.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/jekyll.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/laravel.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/mkdocs.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/node_static.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/python.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/registry.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/providers/staticfile.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/runners/__init__.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/runners/base.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/runners/local.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/shipit_types.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/ui.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/src/shipit/utils.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/tests/test_e2e.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/tests/test_generate_shipit_examples.py +0 -0
- {shipit_cli-0.18.0 → shipit_cli-0.18.2}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shipit-cli
|
|
3
|
-
Version: 0.18.
|
|
3
|
+
Version: 0.18.2
|
|
4
4
|
Summary: Shipit CLI is the best way to build, serve and deploy your projects anywhere.
|
|
5
5
|
Project-URL: homepage, https://wasmer.io
|
|
6
6
|
Project-URL: repository, https://github.com/wasmerio/shipit
|
|
@@ -11,10 +11,6 @@ WP_LOCALE=${WP_LOCALE:-"en_US"}
|
|
|
11
11
|
WP_SITEURL=${WP_SITEURL:-"http://localhost"}
|
|
12
12
|
WP_SITE_TITLE=${WP_SITE_TITLE:-"WordPress"}
|
|
13
13
|
|
|
14
|
-
wp() {
|
|
15
|
-
php /opt/assets/wp-cli.phar --allow-root --path=/app "$@"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
echo "🚀 Starting WordPress setup..."
|
|
19
15
|
|
|
20
16
|
echo "Creating required directories..."
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
|
+
from enum import Enum
|
|
2
3
|
from pathlib import Path
|
|
3
|
-
from typing import Dict,
|
|
4
|
+
from typing import Any, Dict, Literal, Optional
|
|
4
5
|
|
|
5
6
|
from .base import (
|
|
6
7
|
DetectResult,
|
|
@@ -12,12 +13,14 @@ from .base import (
|
|
|
12
13
|
VolumeSpec,
|
|
13
14
|
Config,
|
|
14
15
|
)
|
|
15
|
-
from enum import Enum
|
|
16
16
|
from pydantic_settings import SettingsConfigDict
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
class PhpFramework(Enum):
|
|
19
20
|
Laravel = "laravel"
|
|
21
|
+
Moodle = "moodle"
|
|
20
22
|
Symfony = "symfony"
|
|
23
|
+
Drupal = "drupal"
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
class PhpConfig(Config):
|
|
@@ -37,8 +40,83 @@ class PhpProvider:
|
|
|
37
40
|
self.path = path
|
|
38
41
|
self.config = config
|
|
39
42
|
|
|
43
|
+
@staticmethod
|
|
44
|
+
def load_composer_config(path: Path) -> dict[str, Any] | None:
|
|
45
|
+
composer_path = path / "composer.json"
|
|
46
|
+
if not composer_path.exists():
|
|
47
|
+
return None
|
|
48
|
+
try:
|
|
49
|
+
composer_config = json.loads(composer_path.read_text())
|
|
50
|
+
except json.JSONDecodeError:
|
|
51
|
+
return None
|
|
52
|
+
if not isinstance(composer_config, dict):
|
|
53
|
+
return None
|
|
54
|
+
return composer_config
|
|
55
|
+
|
|
56
|
+
@staticmethod
|
|
57
|
+
def composer_packages(composer_config: dict[str, Any] | None) -> set[str]:
|
|
58
|
+
if not composer_config:
|
|
59
|
+
return set()
|
|
60
|
+
|
|
61
|
+
packages: set[str] = set()
|
|
62
|
+
for section in ("require", "require-dev"):
|
|
63
|
+
deps = composer_config.get(section)
|
|
64
|
+
if isinstance(deps, dict):
|
|
65
|
+
packages.update(str(name).lower() for name in deps)
|
|
66
|
+
|
|
67
|
+
package_name = composer_config.get("name")
|
|
68
|
+
if isinstance(package_name, str):
|
|
69
|
+
packages.add(package_name.lower())
|
|
70
|
+
return packages
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def detect_framework(
|
|
74
|
+
cls,
|
|
75
|
+
path: Path,
|
|
76
|
+
composer_config: dict[str, Any] | None = None,
|
|
77
|
+
) -> PhpFramework | None:
|
|
78
|
+
composer_config = composer_config or cls.load_composer_config(path)
|
|
79
|
+
composer_packages = cls.composer_packages(composer_config)
|
|
80
|
+
|
|
81
|
+
has_moodle_layout = (
|
|
82
|
+
(path / "version.php").exists()
|
|
83
|
+
and (path / "lib" / "setup.php").exists()
|
|
84
|
+
and (
|
|
85
|
+
(path / "admin" / "cli" / "install.php").exists()
|
|
86
|
+
or (path / "mod").is_dir()
|
|
87
|
+
or (path / "theme").is_dir()
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
if has_moodle_layout:
|
|
91
|
+
return PhpFramework.Moodle
|
|
92
|
+
|
|
93
|
+
drupal_packages = {
|
|
94
|
+
"drupal/core",
|
|
95
|
+
"drupal/core-composer-scaffold",
|
|
96
|
+
"drupal/core-recommended",
|
|
97
|
+
"drupal/drupal",
|
|
98
|
+
"drupal/recommended-project",
|
|
99
|
+
}
|
|
100
|
+
has_drupal_layout = (
|
|
101
|
+
(path / "core" / "lib" / "Drupal.php").exists()
|
|
102
|
+
or (path / "web" / "core" / "lib" / "Drupal.php").exists()
|
|
103
|
+
)
|
|
104
|
+
if has_drupal_layout or composer_packages & drupal_packages:
|
|
105
|
+
return PhpFramework.Drupal
|
|
106
|
+
|
|
107
|
+
if (path / "artisan").exists() and (path / "composer.json").exists():
|
|
108
|
+
return PhpFramework.Laravel
|
|
109
|
+
|
|
110
|
+
if (path / "symfony.lock").exists() or any(
|
|
111
|
+
package.startswith("symfony/") for package in composer_packages
|
|
112
|
+
):
|
|
113
|
+
return PhpFramework.Symfony
|
|
114
|
+
|
|
115
|
+
return None
|
|
116
|
+
|
|
40
117
|
@classmethod
|
|
41
118
|
def load_config(cls, path: Path, base_config: Config) -> PhpConfig:
|
|
119
|
+
composer_config = cls.load_composer_config(path)
|
|
42
120
|
use_composer = (
|
|
43
121
|
_exists(path, "composer.json", "composer.lock")
|
|
44
122
|
or (
|
|
@@ -48,17 +126,21 @@ class PhpProvider:
|
|
|
48
126
|
or False
|
|
49
127
|
)
|
|
50
128
|
composer_build_script = None
|
|
51
|
-
if
|
|
52
|
-
|
|
53
|
-
if
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
129
|
+
if composer_config:
|
|
130
|
+
scripts = composer_config.get("scripts")
|
|
131
|
+
if isinstance(scripts, dict):
|
|
132
|
+
composer_build_script = (
|
|
133
|
+
"post-update-cmd" if "post-update-cmd" in scripts else None
|
|
134
|
+
)
|
|
135
|
+
if not composer_build_script and "post-install-cmd" in scripts:
|
|
57
136
|
composer_build_script = "post-install-cmd"
|
|
58
|
-
config = PhpConfig(
|
|
137
|
+
config = PhpConfig(
|
|
138
|
+
use_composer=use_composer,
|
|
139
|
+
composer_build_script=composer_build_script,
|
|
140
|
+
**base_config.model_dump(),
|
|
141
|
+
)
|
|
59
142
|
if not config.framework:
|
|
60
|
-
|
|
61
|
-
config.framework = PhpFramework.Symfony
|
|
143
|
+
config.framework = cls.detect_framework(path, composer_config)
|
|
62
144
|
return config
|
|
63
145
|
|
|
64
146
|
@classmethod
|
|
@@ -69,11 +151,23 @@ class PhpProvider:
|
|
|
69
151
|
def detect(
|
|
70
152
|
cls, path: Path, config: Config
|
|
71
153
|
) -> Optional[DetectResult]:
|
|
72
|
-
|
|
154
|
+
framework = cls.detect_framework(path)
|
|
155
|
+
if framework == PhpFramework.Drupal and (path / "web" / "index.php").exists():
|
|
156
|
+
return DetectResult(cls.name(), 70)
|
|
157
|
+
if framework in {
|
|
158
|
+
PhpFramework.Drupal,
|
|
159
|
+
PhpFramework.Moodle,
|
|
160
|
+
PhpFramework.Symfony,
|
|
161
|
+
} and _exists(path, "index.php", "public/index.php", "web/index.php"):
|
|
162
|
+
return DetectResult(cls.name(), 65)
|
|
163
|
+
if (path / "composer.json").exists() and _exists(
|
|
164
|
+
path, "public/index.php", "web/index.php"
|
|
165
|
+
):
|
|
73
166
|
return DetectResult(cls.name(), 60)
|
|
74
167
|
if (
|
|
75
168
|
_exists(path, "index.php")
|
|
76
169
|
or _exists(path, "public/index.php")
|
|
170
|
+
or _exists(path, "web/index.php")
|
|
77
171
|
or _exists(path, "app/index.php")
|
|
78
172
|
):
|
|
79
173
|
return DetectResult(cls.name(), 10)
|
|
@@ -160,6 +254,16 @@ class PhpProvider:
|
|
|
160
254
|
def base_commands(self) -> Dict[str, str]:
|
|
161
255
|
php_script = "phpix" if self.config.phpix else "php"
|
|
162
256
|
|
|
257
|
+
if (
|
|
258
|
+
self.config.framework == PhpFramework.Drupal
|
|
259
|
+
and _exists(self.path, "web/index.php")
|
|
260
|
+
):
|
|
261
|
+
return {
|
|
262
|
+
"start": (
|
|
263
|
+
f'"{php_script} -S localhost:{{}} -t '
|
|
264
|
+
'{}/web".format(PORT, app.serve_path)'
|
|
265
|
+
)
|
|
266
|
+
}
|
|
163
267
|
if _exists(self.path, "public/index.php"):
|
|
164
268
|
return {
|
|
165
269
|
"start": f'"{php_script} -S localhost:{{}} -t {{}}/public".format(PORT, app.serve_path)'
|
|
@@ -76,7 +76,11 @@ class WordPressProvider(PhpProvider):
|
|
|
76
76
|
steps.append(
|
|
77
77
|
'copy("wordpress/.htaccess", "{}/.htaccess".format(app.path), base="assets")'
|
|
78
78
|
)
|
|
79
|
-
return steps + super().
|
|
79
|
+
return steps + super().build_steps_with_options(
|
|
80
|
+
extra_ignore=["wp-content"],
|
|
81
|
+
after_install=None,
|
|
82
|
+
after_build=None
|
|
83
|
+
)
|
|
80
84
|
|
|
81
85
|
def prepare_steps(self) -> Optional[list[str]]:
|
|
82
86
|
return super().prepare_steps()
|
|
@@ -90,7 +94,7 @@ class WordPressProvider(PhpProvider):
|
|
|
90
94
|
'-t {}".format(assets.serve_path, PORT, app.serve_path)'
|
|
91
95
|
)
|
|
92
96
|
return {
|
|
93
|
-
|
|
97
|
+
"wp": '"php {}/wp-cli.phar --allow-root --path={}".format(assets.serve_path, app.serve_path)',
|
|
94
98
|
"after_deploy": '"bash {}/setup-wp.sh".format(assets.serve_path)',
|
|
95
99
|
**commands,
|
|
96
100
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
from enum import Enum
|
|
1
2
|
from functools import reduce
|
|
2
|
-
from shipit.shipit_types import EnvStep
|
|
3
|
-
from shipit.shipit_types import UseStep
|
|
4
3
|
import hashlib
|
|
5
4
|
import json
|
|
6
5
|
import os
|
|
@@ -17,7 +16,7 @@ from tomlkit import array, aot, comment, document, nl, string, table
|
|
|
17
16
|
|
|
18
17
|
from shipit.builders.base import BuildBackend
|
|
19
18
|
from shipit.runners.base import Runner
|
|
20
|
-
from shipit.shipit_types import Package, PrepareStep, Serve
|
|
19
|
+
from shipit.shipit_types import EnvStep, Package, PrepareStep, Serve, UseStep
|
|
21
20
|
from shipit.ui import console, write_stderr, write_stdout
|
|
22
21
|
from shipit.version import version as shipit_version
|
|
23
22
|
|
|
@@ -25,6 +24,46 @@ if TYPE_CHECKING:
|
|
|
25
24
|
from shipit.shipit_types import Step
|
|
26
25
|
|
|
27
26
|
|
|
27
|
+
SHIPIT_CONFIG_ANNOTATION = "shipitcli.com/config"
|
|
28
|
+
SHIPIT_PROVIDER_ANNOTATION = "shipitcli.com/provider"
|
|
29
|
+
SHIPIT_VERSION_ANNOTATION = "shipitcli.com/version"
|
|
30
|
+
WASMER_APP_KIND_ANNOTATION = "wasmer.io/app-kind"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def serialize_provider_config(provider_config: Any) -> Dict[str, Any]:
|
|
34
|
+
if provider_config is None:
|
|
35
|
+
return {}
|
|
36
|
+
if hasattr(provider_config, "model_dump"):
|
|
37
|
+
return provider_config.model_dump(mode="json", exclude_defaults=True)
|
|
38
|
+
if isinstance(provider_config, dict):
|
|
39
|
+
return provider_config
|
|
40
|
+
return {}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def resolve_app_kind(provider: str, framework: Any = None) -> Optional[str]:
|
|
44
|
+
if provider == "wordpress":
|
|
45
|
+
return "wordpress"
|
|
46
|
+
|
|
47
|
+
if isinstance(framework, Enum):
|
|
48
|
+
framework = framework.value
|
|
49
|
+
if framework is None:
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
provider_name = {
|
|
53
|
+
"node": "javascript",
|
|
54
|
+
"node-static": "javascript",
|
|
55
|
+
}.get(provider, provider)
|
|
56
|
+
framework_name = str(framework).lower()
|
|
57
|
+
app_kinds = {
|
|
58
|
+
"python": {"django", "mcp"},
|
|
59
|
+
"php": {"moodle", "drupal"},
|
|
60
|
+
"javascript": {"ghost", "strapi"},
|
|
61
|
+
}
|
|
62
|
+
if framework_name in app_kinds.get(provider_name, set()):
|
|
63
|
+
return framework_name
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
|
|
28
67
|
class MapperItem(TypedDict, total=False):
|
|
29
68
|
dependencies: Dict[str, str]
|
|
30
69
|
scripts: Set[str]
|
|
@@ -172,6 +211,7 @@ class WasmerRunner:
|
|
|
172
211
|
self.wasmer_registry = registry
|
|
173
212
|
self.wasmer_token = token
|
|
174
213
|
self.bin = bin or "wasmer"
|
|
214
|
+
self.provider_config: Any = None
|
|
175
215
|
|
|
176
216
|
def get_serve_mount_path(self, name: str) -> Path:
|
|
177
217
|
if name == "app":
|
|
@@ -188,6 +228,7 @@ class WasmerRunner:
|
|
|
188
228
|
)
|
|
189
229
|
provider_config.cross_platform = "wasix_wasm32"
|
|
190
230
|
provider_config.precompile_python = True
|
|
231
|
+
self.provider_config = provider_config
|
|
191
232
|
return provider_config
|
|
192
233
|
|
|
193
234
|
def prepare_build_steps(self, build_steps: List["Step"]) -> List["Step"]:
|
|
@@ -525,6 +566,21 @@ class WasmerRunner:
|
|
|
525
566
|
)
|
|
526
567
|
yaml_config["jobs"] = jobs
|
|
527
568
|
|
|
569
|
+
annotations = yaml_config.get("annotations", {})
|
|
570
|
+
assert isinstance(annotations, dict), "annotations must be a dictionary"
|
|
571
|
+
annotations[SHIPIT_CONFIG_ANNOTATION] = serialize_provider_config(
|
|
572
|
+
self.provider_config
|
|
573
|
+
)
|
|
574
|
+
annotations[SHIPIT_VERSION_ANNOTATION] = shipit_version
|
|
575
|
+
annotations[SHIPIT_PROVIDER_ANNOTATION] = serve.provider
|
|
576
|
+
app_kind = resolve_app_kind(
|
|
577
|
+
serve.provider,
|
|
578
|
+
getattr(self.provider_config, "framework", None),
|
|
579
|
+
)
|
|
580
|
+
if app_kind:
|
|
581
|
+
annotations[WASMER_APP_KIND_ANNOTATION] = app_kind
|
|
582
|
+
yaml_config["annotations"] = annotations
|
|
583
|
+
|
|
528
584
|
app_yaml = yaml.dump(yaml_config)
|
|
529
585
|
|
|
530
586
|
console.print(f"\n[bold]Created app.yaml manifest ✅[/bold]")
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
from shipit.providers.php import PhpFramework
|
|
7
|
+
from shipit.providers.python import PythonConfig, PythonFramework
|
|
8
|
+
from shipit.runners.wasmer import WasmerRunner, resolve_app_kind
|
|
9
|
+
from shipit.shipit_types import Package, Serve
|
|
10
|
+
from shipit.version import version as shipit_version
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DummyBuildBackend:
|
|
14
|
+
def __init__(self, root: Path) -> None:
|
|
15
|
+
self.root = root
|
|
16
|
+
|
|
17
|
+
def build(self, name, env, mounts, steps) -> None:
|
|
18
|
+
raise NotImplementedError
|
|
19
|
+
|
|
20
|
+
def get_build_mount_path(self, name: str) -> Path:
|
|
21
|
+
return self.root / "build" / name
|
|
22
|
+
|
|
23
|
+
def get_artifact_mount_path(self, name: str) -> Path:
|
|
24
|
+
path = self.root / "artifacts" / name
|
|
25
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
26
|
+
return path
|
|
27
|
+
|
|
28
|
+
def get_runtime_path(self) -> str | None:
|
|
29
|
+
return None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.mark.parametrize(
|
|
33
|
+
("provider", "framework", "expected"),
|
|
34
|
+
[
|
|
35
|
+
("wordpress", None, "wordpress"),
|
|
36
|
+
("python", PythonFramework.Django, "django"),
|
|
37
|
+
("python", PythonFramework.MCP, "mcp"),
|
|
38
|
+
("php", PhpFramework.Moodle, "moodle"),
|
|
39
|
+
("php", PhpFramework.Drupal, "drupal"),
|
|
40
|
+
("javascript", "ghost", "ghost"),
|
|
41
|
+
("javascript", "strapi", "strapi"),
|
|
42
|
+
("node-static", "ghost", "ghost"),
|
|
43
|
+
("python", "fastapi", None),
|
|
44
|
+
],
|
|
45
|
+
)
|
|
46
|
+
def test_resolve_app_kind(
|
|
47
|
+
provider: str,
|
|
48
|
+
framework: object,
|
|
49
|
+
expected: str | None,
|
|
50
|
+
) -> None:
|
|
51
|
+
assert resolve_app_kind(provider, framework) == expected
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_wasmer_app_yaml_adds_python_annotations(tmp_path: Path) -> None:
|
|
55
|
+
src_dir = tmp_path / "src"
|
|
56
|
+
src_dir.mkdir()
|
|
57
|
+
(src_dir / "app.yaml").write_text(
|
|
58
|
+
yaml.dump({"annotations": {"example.com/existing": "keep"}})
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
runner = WasmerRunner(DummyBuildBackend(tmp_path), src_dir)
|
|
62
|
+
runner.prepare_config(PythonConfig(framework=PythonFramework.Django))
|
|
63
|
+
|
|
64
|
+
serve = Serve(
|
|
65
|
+
name="django",
|
|
66
|
+
provider="python",
|
|
67
|
+
build=[],
|
|
68
|
+
deps=[Package("python")],
|
|
69
|
+
commands={
|
|
70
|
+
"start": (
|
|
71
|
+
"python -m uvicorn example.asgi --host 0.0.0.0 --port 8080"
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
runner.build_serve(serve)
|
|
77
|
+
|
|
78
|
+
app_yaml = yaml.safe_load((runner.wasmer_dir_path / "app.yaml").read_text())
|
|
79
|
+
annotations = app_yaml["annotations"]
|
|
80
|
+
|
|
81
|
+
assert annotations["example.com/existing"] == "keep"
|
|
82
|
+
assert annotations["shipitcli.com/provider"] == "python"
|
|
83
|
+
assert annotations["shipitcli.com/version"] == shipit_version
|
|
84
|
+
assert annotations["wasmer.io/app-kind"] == "django"
|
|
85
|
+
assert annotations["shipitcli.com/config"]["framework"] == "django"
|
|
86
|
+
assert (
|
|
87
|
+
annotations["shipitcli.com/config"]["cross_platform"]
|
|
88
|
+
== "wasix_wasm32"
|
|
89
|
+
)
|
|
90
|
+
assert (
|
|
91
|
+
annotations["shipitcli.com/config"]["python_extra_index_url"]
|
|
92
|
+
== "https://pythonindex.wasix.org/simple"
|
|
93
|
+
)
|
|
@@ -7,6 +7,7 @@ from shipit.providers.base import Config
|
|
|
7
7
|
from shipit.providers.wordpress import WordPressProvider
|
|
8
8
|
from shipit.runners.wasmer import WasmerRunner
|
|
9
9
|
from shipit.shipit_types import Mount, Package, Serve, Service
|
|
10
|
+
from shipit.version import version as shipit_version
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class DummyBuildBackend:
|
|
@@ -59,6 +60,13 @@ def test_wasmer_app_yaml_sets_memory_limit_for_wordpress_phpix(
|
|
|
59
60
|
src_dir.mkdir()
|
|
60
61
|
|
|
61
62
|
runner = WasmerRunner(DummyBuildBackend(tmp_path), src_dir)
|
|
63
|
+
provider_config = load_provider_config(
|
|
64
|
+
WordPressProvider,
|
|
65
|
+
src_dir,
|
|
66
|
+
Config(),
|
|
67
|
+
{"phpix": True},
|
|
68
|
+
)
|
|
69
|
+
runner.prepare_config(provider_config)
|
|
62
70
|
serve = Serve(
|
|
63
71
|
name="wordpress",
|
|
64
72
|
provider="wordpress",
|
|
@@ -85,3 +93,7 @@ def test_wasmer_app_yaml_sets_memory_limit_for_wordpress_phpix(
|
|
|
85
93
|
assert app_yaml["capabilities"]["memory"]["limit"] == "2Gb"
|
|
86
94
|
assert app_yaml["enable_email"] is True
|
|
87
95
|
assert app_yaml["env"]["PHPIX_PHP_THREADS"] == "4"
|
|
96
|
+
assert app_yaml["annotations"]["shipitcli.com/config"]["phpix"] is True
|
|
97
|
+
assert app_yaml["annotations"]["shipitcli.com/provider"] == "wordpress"
|
|
98
|
+
assert app_yaml["annotations"]["shipitcli.com/version"] == shipit_version
|
|
99
|
+
assert app_yaml["annotations"]["wasmer.io/app-kind"] == "wordpress"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|