-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathend2end.py
80 lines (67 loc) · 2.39 KB
/
end2end.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import argparse
from pathlib import Path
import tankerci.cpp
import tankerci.conan
from tankerci.conan import TankerSource
import tankerci.js
def use_packaged_tanker(artifacts_path: Path, profile: str) -> None:
tankerci.conan.export_pkg(
artifacts_path,
profile=profile,
force=True,
package_folder=artifacts_path / profile,
)
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument(
"--isolate-conan-user-home",
action="store_true",
dest="home_isolation",
default=False,
)
parser.add_argument(
"--use-tanker",
type=TankerSource,
default=TankerSource.EDITABLE,
dest="tanker_source",
)
parser.add_argument("--profile", required=True)
parser.add_argument("--use-local-sources", action="store_true", default=False)
parser.add_argument("--remote", default="artifactory")
args = parser.parse_args()
artifact_path = Path().cwd() / "package"
user_home = None
if args.home_isolation:
user_home = Path.cwd() / ".cache" / "conan" / args.remote
ctx = tankerci.conan.ConanContextManager([args.remote], conan_home=user_home)
ctx.isolate()
if args.use_local_sources:
base_path = Path.cwd().parent
else:
base_path = tankerci.git.prepare_sources(
repos=["sdk-python", "sdk-js", "qa-python-js"]
)
with tankerci.working_directory(base_path / "sdk-js"):
tankerci.js.npm("install")
tankerci.js.npm("run", "build:all")
with tankerci.working_directory(base_path / "sdk-python"):
# artifacts are downloaded in sdk-native/package by gitlab
# since we are using sdk-python we use this smoke grenade
(Path.cwd() / "package").symlink_to(artifact_path)
tankerci.run("poetry", "install", "--no-root")
tankerci.run(
"poetry",
"run",
"python",
"run-ci.py",
"prepare",
f"--use-tanker={args.tanker_source.value}",
f"--profile={args.profile}",
f"--remote={args.remote}",
)
tankerci.run("poetry", "run", "python", "run-ci.py", "build")
with tankerci.working_directory(base_path / "qa-python-js"):
tankerci.run("poetry", "install")
tankerci.run("poetry", "run", "pytest", "--verbose", "--capture=no")
if __name__ == "__main__":
main()