Skip to content

Commit 8f0387e

Browse files
Merge branch 'IvorySQL:master' into master
2 parents bf6c7c9 + 69ebb6c commit 8f0387e

1,783 files changed

Lines changed: 113403 additions & 104885 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.cirrus.star‎

Lines changed: 82 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ https://github.com/bazelbuild/starlark/blob/master/spec.md
77
See also .cirrus.yml and src/tools/ci/README
88
"""
99

10-
load("cirrus", "env", "fs")
10+
load("cirrus", "env", "fs", "re", "yaml")
1111

1212

1313
def main():
@@ -18,27 +18,44 @@ def main():
1818
1919
1) the contents of .cirrus.yml
2020
21-
2) if defined, the contents of the file referenced by the, repository
21+
2) computed environment variables
22+
23+
3) if defined, the contents of the file referenced by the, repository
2224
level, REPO_CI_CONFIG_GIT_URL variable (see
2325
https://cirrus-ci.org/guide/programming-tasks/#fs for the accepted
2426
format)
2527
26-
3) .cirrus.tasks.yml
28+
4) .cirrus.tasks.yml
2729
"""
2830

2931
output = ""
3032

3133
# 1) is evaluated implicitly
3234

35+
3336
# Add 2)
37+
additional_env = compute_environment_vars()
38+
env_fmt = """
39+
###
40+
# Computed environment variables start here
41+
###
42+
{0}
43+
###
44+
# Computed environment variables end here
45+
###
46+
"""
47+
output += env_fmt.format(yaml.dumps({'env': additional_env}))
48+
49+
50+
# Add 3)
3451
repo_config_url = env.get("REPO_CI_CONFIG_GIT_URL")
3552
if repo_config_url != None:
3653
print("loading additional configuration from \"{}\"".format(repo_config_url))
3754
output += config_from(repo_config_url)
3855
else:
3956
output += "\n# REPO_CI_CONFIG_URL was not set\n"
4057

41-
# Add 3)
58+
# Add 4)
4259
# output += config_from(".cirrus.tasks.yml")
4360

4461
# PR-only format check
@@ -47,6 +64,67 @@ def main():
4764
return output
4865

4966

67+
def compute_environment_vars():
68+
cenv = {}
69+
70+
###
71+
# Some tasks are manually triggered by default because they might use too
72+
# many resources for users of free Cirrus credits, but they can be
73+
# triggered automatically by naming them in an environment variable e.g.
74+
# REPO_CI_AUTOMATIC_TRIGGER_TASKS="task_name other_task" under "Repository
75+
# Settings" on Cirrus CI's website.
76+
77+
default_manual_trigger_tasks = ['mingw', 'netbsd', 'openbsd']
78+
79+
repo_ci_automatic_trigger_tasks = env.get('REPO_CI_AUTOMATIC_TRIGGER_TASKS', '')
80+
for task in default_manual_trigger_tasks:
81+
name = 'CI_TRIGGER_TYPE_' + task.upper()
82+
if repo_ci_automatic_trigger_tasks.find(task) != -1:
83+
value = 'automatic'
84+
else:
85+
value = 'manual'
86+
cenv[name] = value
87+
###
88+
89+
###
90+
# Parse "ci-os-only:" tag in commit message and set
91+
# CI_{$OS}_ENABLED variable for each OS
92+
93+
# We want to disable SanityCheck if testing just a specific OS. This
94+
# shortens push-wait-for-ci cycle time a bit when debugging operating
95+
# system specific failures. Just treating it as an OS in that case
96+
# suffices.
97+
98+
operating_systems = [
99+
'compilerwarnings',
100+
'freebsd',
101+
'linux',
102+
'macos',
103+
'mingw',
104+
'netbsd',
105+
'openbsd',
106+
'sanitycheck',
107+
'windows',
108+
]
109+
commit_message = env.get('CIRRUS_CHANGE_MESSAGE')
110+
match_re = r"(^|.*\n)ci-os-only: ([^\n]+)($|\n.*)"
111+
112+
# re.match() returns an array with a tuple of (matched-string, match_1, ...)
113+
m = re.match(match_re, commit_message)
114+
if m and len(m) > 0:
115+
os_only = m[0][2]
116+
os_only_list = re.split(r'[, ]+', os_only)
117+
else:
118+
os_only_list = operating_systems
119+
120+
for os in operating_systems:
121+
os_enabled = os in os_only_list
122+
cenv['CI_{0}_ENABLED'.format(os.upper())] = os_enabled
123+
###
124+
125+
return cenv
126+
127+
50128
def config_from(config_src):
51129
"""return contents of config file `config_src`, surrounded by markers
52130
indicating start / end of the included file

0 commit comments

Comments
 (0)