Skip to content

Commit

Permalink
feat(ci): feature combos build in nightly (#3296)
Browse files Browse the repository at this point in the history
Signed-off-by: Dori Medini <[email protected]>
  • Loading branch information
dorimedini-starkware authored Jan 14, 2025
1 parent 458a935 commit 7417fd9
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,30 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

feature_combos:
runs-on: starkware-ubuntu-latest-large
steps:
- uses: actions/checkout@v4

# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
id: setup-pypy
with:
python-version: "pypy3.9"
- run: ln -s '${{ steps.setup-pypy.outputs.python-path }}' /usr/local/bin/pypy3.9
- env:
LD_LIBRARY_PATH: ${{ steps.setup-pypy.outputs.pythonLocation }}/bin
run: echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV

# Install rust components.
- uses: ./.github/actions/bootstrap

- name: Setup Python venv
run: |
python3 -m venv ci
ci/bin/pip install -r scripts/requirements.txt
# Run feature combo test.
- name: "Run feature combo on all crates."
run: ci/bin/python scripts/run_feature_combos_test.py
30 changes: 30 additions & 0 deletions scripts/run_feature_combos_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/env python3

import subprocess
from tests_utils import get_workspace_packages


def build_without_features(package: str):
cmd = f"cargo build --package {package}"
print(f"Running '{cmd}'", flush=True)
subprocess.run(cmd, check=True)


def build_with_all_features(package: str):
cmd = f"cargo build --all-features --package {package}"
print(f"Running '{cmd}'", flush=True)
subprocess.run(cmd, check=True)


def main():
packages = get_workspace_packages()
print(f"Building {len(packages)} packages without features.", flush=True)
for package in packages:
build_without_features(package)
print(f"Building {len(packages)} packages with all features.", flush=True)
for package in packages:
build_with_all_features(package)


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions scripts/tests_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def get_workspace_tree() -> Dict[str, str]:
return tree


def get_workspace_packages() -> Set[str]:
return set(get_workspace_tree().keys())


def get_local_changes(repo_path, commit_id: Optional[str]) -> List[str]:
os.environ["GIT_PYTHON_REFRESH"] = "quiet" # noqa
repo = Repo(repo_path)
Expand Down

0 comments on commit 7417fd9

Please sign in to comment.