numpy
/
.cirrus.star
54 строки · 1.8 Кб
1# The guide to programming cirrus-ci tasks using starlark is found at
2# https://cirrus-ci.org/guide/programming-tasks/
3#
4# In this simple starlark script we simply check conditions for whether
5# a CI run should go ahead. If the conditions are met, then we just
6# return the yaml containing the tasks to be run.
7
8load("cirrus", "env", "fs", "http")
9
10def main(ctx):
11######################################################################
12# Should wheels be built?
13# Only test on the numpy/numpy repository
14######################################################################
15
16if env.get("CIRRUS_REPO_FULL_NAME") != "numpy/numpy":
17return []
18
19# only run the wheels entry on a cron job
20if env.get("CIRRUS_CRON", "") == "nightly":
21return fs.read("tools/ci/cirrus_wheels.yml")
22
23# Obtain commit message for the event. Unfortunately CIRRUS_CHANGE_MESSAGE
24# only contains the actual commit message on a non-PR trigger event.
25# For a PR event it contains the PR title and description.
26SHA = env.get("CIRRUS_CHANGE_IN_REPO")
27url = "https://api.github.com/repos/numpy/numpy/git/commits/" + SHA
28dct = http.get(url).json()
29
30commit_msg = dct["message"]
31if "[skip cirrus]" in commit_msg or "[skip ci]" in commit_msg:
32return []
33
34wheel = False
35labels = env.get("CIRRUS_PR_LABELS", "")
36pr_number = env.get("CIRRUS_PR", "-1")
37tag = env.get("CIRRUS_TAG", "")
38
39if "[wheel build]" in commit_msg:
40wheel = True
41
42# if int(pr_number) > 0 and ("14 - Release" in labels or "36 - Build" in labels):
43# wheel = True
44
45if tag.startswith("v") and "dev0" not in tag:
46wheel = True
47
48if wheel:
49return fs.read("tools/ci/cirrus_wheels.yml")
50
51if int(pr_number) < 0:
52return []
53
54return fs.read("tools/ci/cirrus_arm.yml")
55