mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 17:50:13 +00:00
test
This commit is contained in:
parent
79086f4a8e
commit
ce3ad12a66
2 changed files with 7 additions and 6 deletions
10
ci/run_ci.py
10
ci/run_ci.py
|
|
@ -18,7 +18,7 @@ def docker_build(data):
|
||||||
def take_some_time():
|
def take_some_time():
|
||||||
time.sleep(random.random() * 10)
|
time.sleep(random.random() * 10)
|
||||||
|
|
||||||
def report_status(name, start_time, exit=None):
|
def report_status(sha, name, start_time, exit=None):
|
||||||
status=""
|
status=""
|
||||||
match exit:
|
match exit:
|
||||||
case None:
|
case None:
|
||||||
|
|
@ -30,7 +30,7 @@ def report_status(name, start_time, exit=None):
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'head_sha': must_get_env("GIT_SHA"),
|
'head_sha': sha,
|
||||||
'status': status,
|
'status': status,
|
||||||
'started_at': start_time,
|
'started_at': start_time,
|
||||||
'output': {
|
'output': {
|
||||||
|
|
@ -70,7 +70,7 @@ def report_status(name, start_time, exit=None):
|
||||||
def run_job(data):
|
def run_job(data):
|
||||||
subprocess.run(["git", "clone", must_get_env("REPO_URL")])
|
subprocess.run(["git", "clone", must_get_env("REPO_URL")])
|
||||||
os.chdir(os.path.basename(must_get_env("REPO_URL")))
|
os.chdir(os.path.basename(must_get_env("REPO_URL")))
|
||||||
subprocess.run(["git", "checkout", must_get_env("GIT_SHA")])
|
subprocess.run(["git", "checkout", data['git_sha']])
|
||||||
|
|
||||||
# run actual job
|
# run actual job
|
||||||
take_some_time()
|
take_some_time()
|
||||||
|
|
@ -87,7 +87,7 @@ def main():
|
||||||
print("running {dispatch_data}")
|
print("running {dispatch_data}")
|
||||||
|
|
||||||
time_started = datetime.datetime.now(tz=datetime.timezone.utc).isoformat(timespec='seconds')
|
time_started = datetime.datetime.now(tz=datetime.timezone.utc).isoformat(timespec='seconds')
|
||||||
report_status(data["action"], time_started)
|
report_status(data['git_sha'], data["action"], time_started)
|
||||||
|
|
||||||
ok = True
|
ok = True
|
||||||
try:
|
try:
|
||||||
|
|
@ -101,7 +101,7 @@ def main():
|
||||||
if global_fail:
|
if global_fail:
|
||||||
ok = False
|
ok = False
|
||||||
|
|
||||||
report_status(data["action"], time_started, ok)
|
report_status(data['git_sha'], data["action"], time_started, ok)
|
||||||
|
|
||||||
return 0 if ok else 1
|
return 0 if ok else 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,11 @@ def spawn_job(name):
|
||||||
'content-type':'application/json'
|
'content-type':'application/json'
|
||||||
},
|
},
|
||||||
data=bytes(json.dumps({
|
data=bytes(json.dumps({
|
||||||
'ref': must_get_env("GIT_SHA"),
|
'ref': 'refs/heads/new-ci',
|
||||||
'inputs': {
|
'inputs': {
|
||||||
'dispatchData': json.dumps({
|
'dispatchData': json.dumps({
|
||||||
'action': name,
|
'action': name,
|
||||||
|
'sha': must_get_env("GIT_SHA"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}), 'UTF-8')
|
}), 'UTF-8')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue