Skip to content

Commit

Permalink
Merge pull request #36 from starkware-libs/dori/merge-main-v0.13.2-in…
Browse files Browse the repository at this point in the history
…to-main

Dori/Merge main-v0.13.2 into main
  • Loading branch information
dorimedini-starkware authored Jul 23, 2024
2 parents afbfcf5 + b4bbc8e commit c13342e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
ci/bin/python scripts/run_tests.py --changes_only --commit_id ${{ github.event.pull_request.base.sha }}
ci/bin/python scripts/run_tests.py --changes_only --features concurrency --commit_id ${{ github.event.pull_request.base.sha }}
ci/bin/python scripts/run_tests.py --changes_only --concurrency --commit_id ${{ github.event.pull_request.base.sha }}
env:
SEED: 0

Expand All @@ -116,7 +116,7 @@ jobs:
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
ci/bin/python scripts/run_tests.py
ci/bin/python scripts/run_tests.py --features concurrency
ci/bin/python scripts/run_tests.py --concurrency
env:
SEED: 0

Expand Down
1 change: 0 additions & 1 deletion scripts/merge_paths.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"main-v0.13.1": "main-v0.13.2",
"main-v0.13.2": "main"
}
20 changes: 13 additions & 7 deletions scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,27 @@ def get_package_dependencies(package_name: str) -> Set[str]:
return deps


def run_test(changes_only: bool, commit_id: Optional[str], features: Optional[str] = None):
def run_test(changes_only: bool, commit_id: Optional[str], concurrency: bool):
local_changes = get_local_changes(".", commit_id=commit_id)
modified_packages = get_modified_packages(local_changes)
args = []
tested_packages = set()
if changes_only:
for p in modified_packages:
deps = get_package_dependencies(p)
print(f"Running tests for {deps}")
for d in deps:
args.extend(["--package", d])
tested_packages.update(deps)
if len(args) == 0:
print("No changes detected.")
return

for package in tested_packages:
args.extend(["--package", package])

cmd = ["cargo", "test"] + args

if features is not None:
cmd.extend(["--features", features])
if concurrency and "blockifier" in tested_packages:
cmd.extend(["--features", "concurrency"])

print("Running tests...")
print(cmd, flush=True)
Expand All @@ -93,15 +97,17 @@ def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Presubmit script.")
parser.add_argument("--changes_only", action="store_true")
parser.add_argument(
"--features", type=str, help="Which services to deploy. For multi services separate by ','."
"--concurrency",
action="store_true",
help="If blockifier is to be tested, add the concurrency flag.",
)
parser.add_argument("--commit_id", type=str, help="GIT commit ID to compare against.")
return parser.parse_args()


def main():
args = parse_args()
run_test(changes_only=args.changes_only, commit_id=args.commit_id, features=args.features)
run_test(changes_only=args.changes_only, commit_id=args.commit_id, concurrency=args.concurrency)


if __name__ == "__main__":
Expand Down

0 comments on commit c13342e

Please sign in to comment.