-
-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CirrusCI change in config format #3825
Changes from all commits
398147c
30800b7
a96278b
3742ece
b5f85b4
846247c
54460c7
5f9aedb
bfd8c5a
dfa2cbb
f3d060e
d009425
c7d0919
544edee
01fd362
4f6c8c1
f9bd6c2
111a8fe
273a1f0
fd68fea
2b758a2
c70d8cd
72d9b3d
d3fcc62
092fe01
fa6beaa
058dd38
c39bed2
5d2c457
441d853
4da8c49
320f204
5624ba2
69b0e16
87e1fce
4caeec1
2cea8c8
04678e8
5df8300
32925f6
d198865
1511a4c
6c04f63
3f093ec
1322b22
0d7eb92
e9aeb57
9b6d3a0
7f9b5bd
3d7fa80
520f4bb
27dbc11
65853ea
a13b121
5d9ed86
51e0f5e
1b70b22
296e212
3f4c1f6
b8bda59
b3d3be7
8520117
8387f47
24a43c5
7087a89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
load("cirrus", "env", "fs", "hash", "re") | ||
|
||
def main(): | ||
if env.get("CIRRUS_PR", "") != "": | ||
return create_pr_tasks() | ||
|
||
if env.get("CIRRUS_CRON", "") == "nightly": | ||
return create_nightly_tasks() | ||
|
||
cirrus_tag = env.get("CIRRUS_TAG", "") | ||
re.findall(r'^\d+\.\d+\.\d+$', cirrus_tag) | ||
return create_release_tasks() | ||
|
||
def create_pr_tasks(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is full and complete. Release and Nightly aren't yet. |
||
tasks = [] | ||
|
||
pr_tasks = linux_tasks() | ||
# release tasks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "release" task here is release config |
||
for t in pr_tasks: | ||
release = linux_pr_task(t['name'], | ||
t['image'], | ||
t['triple_vendor'], | ||
t['triple_os'] | ||
) | ||
|
||
# finish release task creation | ||
release.update(linux_pr_scripts().items()) | ||
tasks.append(release) | ||
|
||
# debug tasks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. create a debug config test as well |
||
for t in pr_tasks: | ||
debug = linux_pr_task(t['name'] + ' [debug]', | ||
t['image'], | ||
t['triple_vendor'], | ||
t['triple_os'] | ||
) | ||
|
||
# finish debug task creation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. debug only runs if non-debug passed. |
||
debug.update(linux_pr_scripts("debug").items()) | ||
debug['depends_on'] = [t['name']] | ||
tasks.append(debug) | ||
|
||
return tasks | ||
|
||
def create_nightly_tasks(): | ||
tasks = [] | ||
|
||
pr_tasks = linux_tasks() | ||
for t in pr_tasks: | ||
nightly = linux_pr_task(t['name'] + ' nightly', | ||
t['image'], | ||
t['triple_vendor'], | ||
t['triple_os'] | ||
) | ||
|
||
# finish nightly task creation | ||
nightly.update(linux_nightly_scripts().items()) | ||
|
||
nightly['env']['CLOUDSMITH_API_KEY'] = 'ENCRYPTED[!2cb1e71c189cabf043ac3a9030b3c7708f9c4c983c86d07372ae58ad246a07c54e40810d038d31c3cf3ed8888350caca!' | ||
|
||
tasks.append(nightly) | ||
|
||
return tasks | ||
|
||
def create_release_tasks(): | ||
tasks = [] | ||
|
||
pr_tasks = linux_tasks() | ||
for t in pr_tasks: | ||
release = linux_pr_task(t['name'] + ' release', | ||
t['image'], | ||
t['triple_vendor'], | ||
t['triple_os'] | ||
) | ||
|
||
# finish release task creation | ||
release.update(linux_release_scripts().items()) | ||
|
||
release['env']['CLOUDSMITH_API_KEY'] = 'ENCRYPTED[!2cb1e71c189cabf043ac3a9030b3c7708f9c4c983c86d07372ae58ad246a07c54e40810d038d31c3cf3ed8888350caca!' | ||
|
||
tasks.append(release) | ||
|
||
return tasks | ||
|
||
def linux_tasks(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would be where new tasks get added. anything in the list of maps below would have configuration for PR, nightly and release built. |
||
return [ | ||
{ 'name': 'x86-64-unknown-linux-rocky8', | ||
'image': 'ponylang/ponyc-ci-x86-64-unknown-linux-rocky8-builder:20210707', | ||
'triple_vendor': 'unknown', | ||
'triple_os': 'linux-rocky8' | ||
}, | ||
{ 'name': 'x86-64-unknown-linux-centos8', | ||
'image': 'ponylang/ponyc-ci-x86-64-unknown-linux-centos8-builder:20210225', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we changed the builder image, it would be updated here. note, no cache-buster value to update separately. this means you cant do what i have done before and forget to update it. the downside is, there is no way to manually bust the cache; however, we've never really needed to do that. |
||
'triple_vendor': 'unknown', | ||
'triple_os': 'linux-centos8' | ||
} | ||
] | ||
|
||
def linux_pr_task(name, image, triple_vendor, triple_os): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be renamed as its not just for pr. |
||
cache_key = hash.md5(fs.read('lib/CMakeLists.txt') + image) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the cache key is now the hash of the lib/CMakeLists.txt and the docker image name. definitely simpler than the current setup in .cirrus.yml |
||
|
||
cpu = 8 | ||
memory = 24 | ||
|
||
task = { | ||
'name': name, | ||
'container': { | ||
'image': image, | ||
'cpu': cpu, | ||
'memory': memory | ||
}, | ||
'env': { | ||
'TRIPLE_VENDOR': triple_vendor, | ||
'TRIPLE_OS': triple_os | ||
}, | ||
Comment on lines
+112
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the env is only needed for nightly and release tasks but there's no harm in having it for pr as well. it makes everything less complicated to have it here. |
||
'libs_cache': { | ||
'folder': 'build/libs', | ||
'fingerprint_key': cache_key, | ||
'populate_script': 'make libs build_flags=-j8' | ||
}, | ||
} | ||
|
||
return task | ||
|
||
def linux_pr_scripts(config="release"): | ||
return { | ||
'configure_script': 'make configure config=' + config, | ||
'build_script': 'make build build_flags=-j8 config=' + config, | ||
'test_script': 'make test-ci config=' + config | ||
} | ||
|
||
def linux_nightly_scripts(): | ||
return { | ||
'nightly_script': 'bash .ci-scripts/x86-64-nightly.bash' | ||
} | ||
|
||
def linux_release_scripts(): | ||
return { | ||
'release_script': 'bash .ci-scripts/x86-64-release.bash' | ||
} | ||
Comment on lines
+125
to
+140
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the only "real" difference between the release, nightly, and pr is the script to run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decide which tasks to create. PR, Nightly, or Release.