-
Notifications
You must be signed in to change notification settings - Fork 154
ci: add import-time gate for rogue (<= 1.0s best-of-5 cold imports) #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d2f8317
ci: add import-time gate for rogue (<= 1.0s best-of-5 cold imports)
MANASAB805 6874604
ci: pin Python 3.12 and harden import timing subprocess parsing/errors
MANASAB805 eed5cbf
ci: use uv and local SDK, measure import time via /usr/bin/time + bc …
MANASAB805 0ac7f56
Merge branch 'main' into feat/import-time-ci
yuval-qf 93fca47
Update .github/workflows/import-time.yml
yuval-qf da42403
Update .github/workflows/import-time.yml
yuval-qf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| name: Import Time CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| import-time: | ||
| name: Import Time Gate | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| PACKAGE_NAME: rogue | ||
| THRESHOLD_SECONDS: "2.0" | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version-file: ".python-version" | ||
|
|
||
| - name: Create venv | ||
| run: uv venv | ||
|
|
||
| - name: Install rogue with local sdk | ||
| run: | | ||
| source .venv/bin/activate | ||
| uv pip install -e . | ||
| uv pip uninstall -y rogue-ai-sdk || true | ||
| uv pip install -e sdks/python --force-reinstall | ||
|
|
||
| - name: Install timing tools | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y time bc | ||
|
|
||
| - name: Check import time (best-of-5) | ||
| shell: bash | ||
| env: | ||
| THRESHOLD: ${{ env.THRESHOLD_SECONDS }} | ||
| run: | | ||
| set -euo pipefail | ||
| source .venv/bin/activate | ||
| best=9999 | ||
| for i in 1 2 3 4 5; do | ||
| /usr/bin/time -f "%e" -o elapsed.txt python -c "import ${PACKAGE_NAME}" >/dev/null 2>&1 || true | ||
| elapsed=$(cat elapsed.txt) | ||
| echo "Run #$i: ${elapsed}s" | ||
| # keep the best (minimum) | ||
| if [ "$(echo "$elapsed < $best" | bc -l)" -eq 1 ]; then | ||
| best=$elapsed | ||
| fi | ||
| done | ||
| echo "Best import time for '${PACKAGE_NAME}': ${best}s (threshold ${THRESHOLD}s)" | ||
| if [ "$(echo "$best <= $THRESHOLD" | bc -l)" -eq 1 ]; then | ||
| echo "PASS: Import time within threshold" | ||
| exit 0 | ||
| else | ||
| echo "FAIL: Import time exceeded threshold" >&2 | ||
| exit 1 | ||
| fi | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.