-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.py
133 lines (102 loc) · 2.71 KB
/
build.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
from os import environ
from subprocess import run
from pybuilder.core import init, task
from ddadevops import *
default_task = "dev"
base_name = "dda-masto-embed"
name = 'dda-masto-embed'
MODULE = 'not-used'
PROJECT_ROOT_PATH = '.'
version = "1.0.2-dev"
@init
def initialize(project):
project.build_depends_on("ddadevops>=4.7.0")
input = {
"name": name,
"module": MODULE,
"stage": "notused",
"project_root_path": PROJECT_ROOT_PATH,
"build_types": [],
"mixin_types": ["RELEASE"],
"release_primary_build_file": "package.json",
"release_secondary_build_files": [
"build.py"
],
"release_artifact_server_url": "https://repo.prod.meissa.de",
"release_organisation": "meissa",
"release_repository_name": name,
"release_artifacts": [
f"target/{name}.js",
],
"release_main_branch": "master",
}
build = ReleaseMixin(project, input)
build.initialize_build_dir()
@task
def test(project):
test_cljs(project)
@task
def test_cljs(project):
run("shadow-cljs compile test", shell=True, check=True)
run("node target/node-tests.js", shell=True, check=True)
@task
def report_frontend(project):
run("mkdir -p target/frontend-build", shell=True, check=True)
run(
"shadow-cljs run shadow.cljs.build-report frontend target/build-report.html",
shell=True,
check=True,
)
@task
def package_frontend(project):
run("mkdir -p target/", shell=True, check=True)
run("shadow-cljs release frontend", shell=True, check=True)
run(
f"cp public/js/main.js target/{name}.js",
shell=True,
check=True,
)
run(
f"sha256sum target/{name}.js > target/{name}.js.sha256",
shell=True,
check=True,
)
run(
f"sha512sum target/{name}.js > target/{name}.js.sha512",
shell=True,
check=True,
)
@task
def patch(project):
linttest(project, "PATCH")
release(project)
@task
def minor(project):
linttest(project, "MINOR")
release(project)
@task
def major(project):
linttest(project, "MAJOR")
release(project)
@task
def dev(project):
linttest(project, "NONE")
@task
def prepare(project):
build = get_devops_build(project)
build.prepare_release()
@task
def tag(project):
build = get_devops_build(project)
build.tag_bump_and_push_release()
@task
def publish_artifacts(project):
build = get_devops_build(project)
build.publish_artifacts()
def release(project):
prepare(project)
tag(project)
def linttest(project, release_type):
build = get_devops_build(project)
build.update_release_type(release_type)
test_cljs(project)