Skip to content

Commit

Permalink
[ci skip] add triggerable ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianmarco Fraccaroli authored and Gianmarco Fraccaroli committed May 3, 2024
1 parent 0d9b622 commit 05d2eae
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/scripts/integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import json
import os
import subprocess
import sys
import time

TESTS = [
"integration::masp::cross_epoch_unshield",
"integration::masp::dynamic_assets",
"integration::masp::masp_incentives",
"integration::masp::masp_pinned_txs",
"integration::masp::masp_txs_and_queries",
"integration::masp::multiple_unfetched_txs_same_block",
"integration::masp::spend_unconverted_asset_type",
"integration::masp::wrapper_fee_unshielding",
"integration::masp::wrapper_fee_unshielding_out_of_gas",
]

NIGHTLY_VERSION = open("rust-nightly-version", "r").read().strip()
CARGO_TEST_COMMAND = "RUST_BACKTRACE=1 cargo +{} test --lib {} --features integration -Z unstable-options -- --test-threads=1 --exact -Z unstable-options --report-time"

test_results = {}
has_failures = False

for task in TESTS:
try:
start = time.time()
command = CARGO_TEST_COMMAND.format(NIGHTLY_VERSION, task)
end = time.time()
subprocess.check_call(command, shell=True, stdout=sys.stdout, stderr=subprocess.STDOUT)
test_results[task] = {
'status': 'ok',
'time': round(end - start),
'command': command
}
except:
test_results[task] = {
'status': 'fail',
'time': -1,
'command': command
}
has_failures = True
continue

for test_name in test_results.keys():
test_status = test_results[test_name]['status']
time = test_results[test_name]['time']
print("- Test {} ({}s) -> status: {}".format(test_name, time, test_status))
if test_results[test_name]['status'] != 'ok':
test_command = test_results[test_name]['command']
print(" Run locally with: {}".format(test_command))

if has_failures:
exit(1)
7 changes: 5 additions & 2 deletions .github/workflows/scripts/schedule-e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import subprocess
import sys
import time

N_OF_MACHINES = 6

Expand Down Expand Up @@ -46,17 +47,19 @@ def find_freer_machine():

for task in tasks:
try:
start = time.time()
command = CARGO_TEST_COMMAND.format(NIGHTLY_VERSION, task['name'])
end = time.time()
subprocess.check_call(command, shell=True, stdout=sys.stdout, stderr=subprocess.STDOUT)
test_results[task['name']] = {
'status': 'ok',
'time': task['time'],
'time': round(end - start),
'command': command
}
except:
test_results[task['name']] = {
'status': 'fail',
'time': task['time'],
'time': -1,
'command': command
}
has_failures = True
Expand Down

0 comments on commit 05d2eae

Please sign in to comment.