-
Notifications
You must be signed in to change notification settings - Fork 2
/
updatedocs.py
119 lines (105 loc) · 3.52 KB
/
updatedocs.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
# -*- python -*-
# ex: set syntax=python:
from buildbot.plugins import changes, schedulers, steps, util
c = {}
c["change_source"] = []
c["schedulers"] = []
c["builders"] = []
repos = [
{"repo": "docs_ngcom", "langs": ["ru", "en"]},
{"repo": "docs_ngmobile", "langs": ["ru", "en"]},
{"repo": "docs_ngqgis", "langs": ["ru", "en"]},
{"repo": "docs_ngweb", "langs": ["ru", "en"]},
{"repo": "docs_toolbox", "langs": ["ru", "en"]},
{"repo": "docs_data", "langs": ["ru", "en"]},
{"repo": "docs_collector", "langs": ["ru", "en"]},
{"repo": "docs_ngid", "langs": ["ru", "en"]},
{"repo": "docs_formbuilder", "langs": ["ru", "en"]},
{"repo": "docs_ngcourses", "langs": ["ru", "en"]},
{"repo": "docs_howto", "langs": ["master"]},
]
base_repourl = "https://github.com/nextgis/"
repourl = "git@github.com:nextgis/docs_ng.git" # base_repourl + 'docs_ng.git'
poller_name = "updatedocs"
for repo in repos:
git_poller = changes.GitPoller(
project=poller_name + "/" + repo["repo"],
repourl=base_repourl + repo["repo"] + ".git",
# workdir = poller_name + '-' + repo['repo'] + '-workdir',
branches=repo["langs"],
pollinterval=1 * 60 * 60,
) # Poll hourly
c["change_source"].append(git_poller)
project_name = "updatedocs"
langs = ["ru", "en"]
# scheduler = schedulers.AnyBranchScheduler(
# name=project_name,
# change_filter=util.ChangeFilter(project_re = poller_name + '/*'),
# treeStableTimer=2*60,
# builderNames=[project_name])
# c['schedulers'].append(scheduler)
branches = langs + ["master"]
for lang in branches:
scheduler = schedulers.SingleBranchScheduler(
name=project_name + "_" + lang,
change_filter=util.ChangeFilter(project_re=poller_name + "/*", branch=lang),
treeStableTimer=2 * 60,
builderNames=[project_name],
)
c["schedulers"].append(scheduler)
c["schedulers"].append(
schedulers.ForceScheduler(
name=project_name + "_force",
builderNames=[project_name],
)
)
#### update docs
git_user_name = "NextGIS BuildBot"
git_user_email = "buildbot@nextgis.com"
logname = "stdio"
factory = util.BuildFactory()
factory.addStep(
steps.Git(repourl=repourl, mode="full", method="clobber", submodules=True)
)
factory.addStep(
steps.ShellSequence(
commands=[
util.ShellArg(
command=["git", "config", "--global", "user.name", git_user_name],
logname=logname,
),
util.ShellArg(
command=["git", "config", "--global", "user.email", git_user_email],
logname=logname,
),
],
name="Set git config defaults",
haltOnFailure=True,
workdir="build",
)
)
for lang in langs:
factory.addStep(
steps.ShellCommand(
command=["sh", "switch_lang.sh", lang],
description=["switch", "language to " + lang],
descriptionDone=["switched", "language to " + lang],
workdir="build",
)
)
# TODO: github script push
factory.addStep(
steps.ShellCommand(
command=["sh", "update_docs.sh"],
description=["update", lang + " documentation"],
descriptionDone=["updated", lang + " documentation"],
workdir="build",
)
)
builder = util.BuilderConfig(
name=project_name,
workernames=["build-light"],
factory=factory,
tags=["docs"],
)
c["builders"].append(builder)