-
Notifications
You must be signed in to change notification settings - Fork 89
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
test: Add github action to test code graph #471
Conversation
WalkthroughThis pull request introduces several workflow and configuration changes across GitHub Actions and project dependencies. The modifications include a new profiling workflow configuration, an enhancement to a reusable Python workflow to support optional arguments, a new code graph example test workflow, removal of an unused import in a repository processing task, and the addition of optional dependencies for code analysis in the project's dependency management. Changes
Sequence DiagramsequenceDiagram
participant Workflow as GitHub Actions
participant Script as Python Script
participant Secrets as Secret Manager
Workflow->>Secrets: Retrieve API Keys
Secrets-->>Workflow: Return Secrets
Workflow->>Script: Execute with Arguments
Script->>Script: Process Repository
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (1)
.github/workflows/test_code_graph_example.yml (1)
4-6
: Consider adding a label filter for PR triggers.The workflow currently runs on any labeled PR event. To prevent unnecessary runs, consider filtering for specific labels related to code graph testing.
pull_request: types: [labeled, synchronize] + if: contains(github.event.pull_request.labels.*.name, 'code-graph')
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
poetry.lock
is excluded by!**/*.lock
📒 Files selected for processing (5)
.github/workflows/profiling.yaml
(1 hunks).github/workflows/reusable_python_example.yml
(2 hunks).github/workflows/test_code_graph_example.yml
(1 hunks)cognee/tasks/repo_processor/get_non_code_files.py
(0 hunks)pyproject.toml
(2 hunks)
💤 Files with no reviewable changes (1)
- cognee/tasks/repo_processor/get_non_code_files.py
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/profiling.yaml
88-88: shellcheck reported issue in this script: SC2086:info:3:14: Double quote to prevent globbing and word splitting
(shellcheck)
🔇 Additional comments (4)
.github/workflows/test_code_graph_example.yml (1)
17-18
: Verify the repository path argument.The
--repo_path ./evals
argument assumes the existence of anevals
directory. This path should be verified to ensure it exists in the repository.✅ Verification successful
The repository path argument is valid and correct
The
--repo_path ./evals
argument points to an existing directory that contains the necessary evaluation-related files.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of the evals directory # Expected: Directory exists and contains relevant files echo "Checking for evals directory..." if [ -d "./evals" ]; then echo "Directory exists. Listing contents:" ls -la ./evals else echo "Directory ./evals not found!" fiLength of output: 1767
.github/workflows/reusable_python_example.yml (1)
10-13
: LGTM! Well-structured optional input parameter.The addition of the optional
arguments
parameter is well-defined with clear description and appropriate required flag.pyproject.toml (2)
80-81
: LGTM! Dependencies align with code analysis requirements.The addition of
parso
andjedi
as optional dependencies is appropriate for code analysis functionality.
99-99
: LGTM! Well-organized extra group.The new
codegraph
extra properly groups the related dependencies.
@@ -53,4 +57,4 @@ jobs: | |||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |||
GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }} | |||
GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }} | |||
run: poetry run python ${{ inputs.example-location }} | |||
run: poetry run python ${{ inputs.example-location }} ${{ inputs.arguments }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Quote the input arguments to handle spaces.
The command should quote the arguments to handle cases where they contain spaces.
- run: poetry run python ${{ inputs.example-location }} ${{ inputs.arguments }}
+ run: poetry run python "${{ inputs.example-location }}" ${{ inputs.arguments != '' && format('"{0}"', inputs.arguments) || '' }}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
run: poetry run python ${{ inputs.example-location }} ${{ inputs.arguments }} | |
run: poetry run python "${{ inputs.example-location }}" ${{ inputs.arguments != '' && format('"{0}"', inputs.arguments) || '' }} |
# - name: Run profiler on base branch | ||
# env: | ||
# HEAD_SHA: ${{ env.HEAD_SHA }} | ||
# BASE_SHA: ${{ env.BASE_SHA }} | ||
# run: | | ||
# echo "Profiling the head branch for code_graph_pipeline.py" | ||
# echo "Checking out head SHA: $HEAD_SHA" | ||
# git checkout $HEAD_SHA | ||
# echo "Profiling the base branch for code_graph_pipeline.py" | ||
# echo "Checking out base SHA: $BASE_SHA" | ||
# git checkout $BASE_SHA | ||
# echo "This is the working directory: $PWD" | ||
# # Ensure the script is executable | ||
# chmod +x cognee/api/v1/cognify/code_graph_pipeline.py | ||
# # Run Scalene | ||
# poetry run pyinstrument --renderer json -o head_results.json cognee/api/v1/cognify/code_graph_pipeline.py | ||
# poetry run pyinstrument --renderer json -o base_results.json cognee/api/v1/cognify/code_graph_pipeline.py | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider keeping base branch profiling for comparison.
While the PR objective is to run profiling on HEAD, removing the base branch profiling eliminates the ability to compare performance changes. Consider keeping both for meaningful performance analysis.
git checkout $HEAD_SHA | ||
echo "This is the working directory: $PWD" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote the SHA variable to prevent word splitting.
The git checkout
command should quote the SHA variable to handle special characters safely.
- git checkout $HEAD_SHA
+ git checkout "$HEAD_SHA"
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
git checkout $HEAD_SHA | |
echo "This is the working directory: $PWD" | |
git checkout "$HEAD_SHA" | |
echo "This is the working directory: $PWD" |
chmod +x cognee/api/v1/cognify/code_graph_pipeline.py | ||
# Run Scalene | ||
poetry run pyinstrument --renderer json -o head_results.json cognee/api/v1/cognify/code_graph_pipeline.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Verify script existence and add error handling.
The workflow assumes the script exists and is executable. Add checks and error handling.
- chmod +x cognee/api/v1/cognify/code_graph_pipeline.py
- poetry run pyinstrument --renderer json -o head_results.json cognee/api/v1/cognify/code_graph_pipeline.py
+ SCRIPT_PATH="cognee/api/v1/cognify/code_graph_pipeline.py"
+ if [ ! -f "$SCRIPT_PATH" ]; then
+ echo "Error: Script not found at $SCRIPT_PATH"
+ exit 1
+ fi
+ chmod +x "$SCRIPT_PATH"
+ if ! poetry run pyinstrument --renderer json -o head_results.json "$SCRIPT_PATH"; then
+ echo "Error: Profiling failed"
+ exit 1
+ fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
chmod +x cognee/api/v1/cognify/code_graph_pipeline.py | |
# Run Scalene | |
poetry run pyinstrument --renderer json -o head_results.json cognee/api/v1/cognify/code_graph_pipeline.py | |
SCRIPT_PATH="cognee/api/v1/cognify/code_graph_pipeline.py" | |
if [ ! -f "$SCRIPT_PATH" ]; then | |
echo "Error: Script not found at $SCRIPT_PATH" | |
exit 1 | |
fi | |
chmod +x "$SCRIPT_PATH" | |
if ! poetry run pyinstrument --renderer json -o head_results.json "$SCRIPT_PATH"; then | |
echo "Error: Profiling failed" | |
exit 1 | |
fi |
Description
DCO Affirmation
I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin
Summary by CodeRabbit
Release Notes
GitHub Actions
Dependencies
parso
jedi
Code Changes