Skip to content
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

fix: Fix pre release tests #1219

Merged
merged 12 commits into from
Oct 22, 2024
Merged

fix: Fix pre release tests #1219

merged 12 commits into from
Oct 22, 2024

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Oct 22, 2024

closes #1211
closes #1217

Summary by Sourcery

Fix the pre-release test workflow by adding a new test job and updating existing jobs to ensure tests run with the correct package constraints and environments.

Bug Fixes:

  • Fix pre-release test workflow to correctly run tests with specific package constraints and environments.

CI:

  • Update CI workflow to include a new test job using tox base with specific environment variables and package constraints.
  • Modify existing test job to specify test directories for more targeted testing.

Summary by CodeRabbit

  • New Features

    • Enhanced testing capabilities with the addition of a new test step using tox for pre-release dependencies.
    • Updated dependency management commands for improved efficiency.
  • Bug Fixes

    • Excluded the problematic version of the ipykernel package to prevent installation issues.

@Czaki Czaki added this to the 0.16.0 milestone Oct 22, 2024
Copy link
Contributor

sourcery-ai bot commented Oct 22, 2024

Reviewer's Guide by Sourcery

This pull request addresses issues #1211 and #1217 by modifying the pre-release test workflow. The changes include splitting the test execution, updating the dependency management tool, and adjusting the installation process.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Split test execution in the workflow
  • Added a new 'Test with tox base' step to run specific tests
  • Modified the existing 'Test with tox linux' step to run a subset of tests
  • Both steps use the 'aganders3/headless-gui@v2' action with a 60-minute timeout
.github/workflows/test_prereleases.yml
Updated dependency management tool from pip-tools to uv
  • Replaced 'pip install pip-tools' with 'pip install uv'
  • Updated commands to use 'uv pip' instead of 'pip-compile' and 'pip-sync'
  • Modified compilation command to use '--prerelease allow' flag
.github/workflows/test_prereleases.yml
Adjusted package installation process
  • Changed 'pip install .' to 'uv pip install .'
.github/workflows/test_prereleases.yml

Assessment against linked issues

Issue Objective Addressed Explanation
#1211 Fix the failing --pre Test workflow on ubuntu-24.04 py3.12
#1211 Update the test configuration to resolve pip install --pre failures
#1217 Fix the failing --pre Test workflow on linux py3.12
#1217 Update the test configuration to resolve PyInstaller bundle issues

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

coderabbitai bot commented Oct 22, 2024

Walkthrough

The pull request modifies the GitHub Actions workflow in .github/workflows/test_prereleases.yml by introducing concurrency settings for job cancellation and adding a new testing step using tox. It also updates the requirements/pre_test_problematic_version.txt file to exclude version 7.0.0a0 of the ipykernel package. These changes aim to improve testing processes and manage package dependencies effectively.

Changes

File Change Summary
.github/workflows/test_prereleases.yml - Introduced concurrency configuration for job cancellation.
- Added "Test with tox base" step.
- Modified "Test with tox linux" command.
- Updated dependency management to use uv instead of pip-tools.
requirements/pre_test_problematic_version.txt - Excluded ipykernel version 7.0.0a0 from installation requirements.

Assessment against linked issues

Objective Addressed Explanation
Ensure --pre test workflow is functional (#1211)
Resolve pyinstaller bundle --pre failures (#1217)

Possibly related PRs

Suggested labels

skip check PR title

🐇 In the meadow, we hop and play,
With tox and uv, we test all day.
Excluding versions, we keep it neat,
In our code garden, we can’t be beat!
So let’s celebrate, with joy and cheer,
For every change brings us near! 🌼✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9f0a131 and baa0ead.

📒 Files selected for processing (1)
  • .github/workflows/test_prereleases.yml (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test_prereleases.yml

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Czaki - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
requirements/pre_test_problematic_version.txt (1)

1-2: Consider adding comments for better documentation.

To improve maintainability, it would be helpful to add comments explaining why these specific versions are excluded. This context can be valuable for future developers working on the project.

Example:

+# Exclude due to [specific issue or incompatibility]
 mpmath!=1.4.0a0
+# Exclude due to [specific issue or incompatibility]
 ipykernel!=7.0.0a0
.github/workflows/test_prereleases.yml (2)

77-90: LGTM! Consider adding a comment for clarity.

The new "Test with tox base" step is well-structured and aligns with the workflow's purpose. It correctly uses the headless GUI action and sets appropriate environment variables for pre-release testing.

Consider adding a brief comment explaining the purpose of this specific test step, especially how it differs from the "Test with tox linux" step. This would improve maintainability. For example:

      - name: Test with tox base
        # Run core and image tests with pre-release dependencies
        uses: aganders3/headless-gui@v2
        ...

132-132: LGTM! Consider documenting the switch to uv.

The change from pip-tools to uv is a good optimization. uv is known for its performance improvements in dependency management.

Consider adding a comment explaining the switch to uv for future reference. For example:

    - name: Install dependencies
      run: |
        pip install --upgrade pip
        pip install uv  # Using uv for faster dependency resolution and installation

    - name: Compile and install PyInstaller requirements
      run: |
        # Using uv for faster compilation and syncing of requirements
        uv pip compile --upgrade -o requirements.txt pyproject.toml requirements/pre_test_problematic_version.txt --extra pyinstaller  --prerelease allow
        uv pip sync requirements.txt
        uv pip install .

This documentation will help future maintainers understand the rationale behind using uv.

Also applies to: 135-137

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bc5eabd and 38e595a.

📒 Files selected for processing (2)
  • .github/workflows/test_prereleases.yml (2 hunks)
  • requirements/pre_test_problematic_version.txt (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
requirements/pre_test_problematic_version.txt (1)

2-2: LGTM: New exclusion added correctly.

The addition of ipykernel!=7.0.0a0 is consistent with the existing exclusion format and aligns with the file's purpose of specifying problematic versions for pre-release testing.

.github/workflows/test_prereleases.yml (2)

Line range hint 1-170: Overall, the changes improve the workflow's efficiency and test coverage.

The modifications to this workflow enhance its capabilities in several ways:

  1. The addition of the "Test with tox base" step provides more comprehensive testing.
  2. The use of uv in the pyinstaller job potentially improves dependency management performance.
  3. The workflow maintains its focus on pre-release testing, which aligns with the PR objectives.

These changes should help in identifying issues earlier in the development process, particularly for pre-release versions. To further improve the workflow, consider adding comments to explain the rationale behind the test split and the switch to uv, as suggested in the previous comments.


96-96: Please clarify the rationale for splitting the tests.

The test command has been changed to only run package/tests/test_PartSeg. While this avoids duplication with the new "Test with tox base" step, it's not immediately clear why this specific test is run separately.

Could you provide more context on why test_PartSeg is tested in isolation? This information would be valuable for future maintenance.

To help verify the test coverage, you can run the following command:

✅ Verification successful

Test splitting rationale confirmed.

The test_PartSeg directory contains numerous tests, supporting the decision to run it separately for an optimized and organized testing pipeline.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the content of test files to understand the test split

# List the content of the test directories
echo "Content of package/tests/test_PartSegImage:"
fd . package/tests/test_PartSegImage -t f -x echo {}
echo "\nContent of package/tests/test_PartSegCore:"
fd . package/tests/test_PartSegCore -t f -x echo {}
echo "\nContent of package/tests/test_PartSeg:"
fd . package/tests/test_PartSeg -t f -x echo {}

Length of output: 3620

@Czaki Czaki changed the title Fix pre release tests fix: Fix pre release tests Oct 22, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/test_prereleases.yml (1)

77-90: LGTM! Consider adding a comment explaining the purpose of this new test step.

The addition of this new test step using tox is a good improvement to the workflow. It enhances test coverage by specifically targeting test_PartSegImage and test_PartSegCore packages.

Consider adding a brief comment above this step to explain its purpose and how it differs from the existing "Test with tox linux" step. This will help future maintainers understand the workflow structure more easily.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 38e595a and 8048321.

📒 Files selected for processing (1)
  • .github/workflows/test_prereleases.yml (2 hunks)
🧰 Additional context used
🔇 Additional comments (2)
.github/workflows/test_prereleases.yml (2)

Line range hint 1-170: Overall, these changes significantly improve the pre-release testing workflow.

The modifications in this file align well with the PR objectives of fixing pre-release tests. Key improvements include:

  1. Addition of a new, more specific test step using tox.
  2. Refinement of existing test steps to reduce potential redundancy.
  3. Upgrade to uv for more efficient dependency management.

These changes should lead to more robust and efficient pre-release testing, helping to catch issues earlier in the development process.


132-132: LGTM! Update documentation to reflect the switch to uv.

The change from pip-tools to uv for dependency management is a good improvement. uv is known for its speed and efficiency in handling Python dependencies.

Consider updating any relevant documentation or README files to reflect this change in dependency management. This will help other contributors understand the new workflow.

To ensure the switch to uv doesn't introduce any issues, please run the following script:

This script will verify that uv is installed correctly and can compile requirements without issues.

Also applies to: 135-137

- name: Test with tox linux
# run tests using pip install --pre
uses: aganders3/headless-gui@v2
timeout-minutes: 60
with:
run: python -m tox run -v -- -v
run: python -m tox run -v -- -v package/tests/test_PartSeg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Incomplete Test Coverage: 'package/tests/' not included in tox commands.

The current tox commands do not include the package/tests/ directory, which may result in missing tests located directly under it.

  • Action Required: Update the tox commands to include package/tests/ to ensure all tests are executed.
🔗 Analysis chain

LGTM! Verify complete test coverage across both tox steps.

The modification to run tests only for package/tests/test_PartSeg in this step is good, as it complements the new "Test with tox base" step.

To ensure we haven't inadvertently missed any tests, please run the following script to verify complete test coverage:

Compare the output to ensure all necessary test directories are included in the tox commands.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all test directories are covered by the tox commands

# Test: Check if all test directories are included in either tox command
echo "Test directories in tox commands:"
grep -E "python -m tox run.*package/tests" .github/workflows/test_prereleases.yml

echo -e "\nAll test directories in the project:"
fd -t d "test" package

Length of output: 554

Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.14%. Comparing base (f6f30e8) to head (9581847).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1219      +/-   ##
===========================================
+ Coverage    93.13%   93.14%   +0.01%     
===========================================
  Files          210      210              
  Lines        33172    33172              
===========================================
+ Hits         30894    30899       +5     
+ Misses        2278     2273       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
.github/workflows/test_prereleases.yml (1)

81-94: LGTM: New tox test step added.

The addition of this new test step is beneficial as it provides more granular testing for specific packages. The use of the aganders3/headless-gui@v2 action is appropriate for GUI testing, and the environment variables are well-configured for the project's needs.

Consider adding a comment explaining the purpose of testing these specific packages separately, to improve maintainability for future contributors.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8048321 and 9f0a131.

📒 Files selected for processing (1)
  • .github/workflows/test_prereleases.yml (3 hunks)
🧰 Additional context used
🔇 Additional comments (4)
.github/workflows/test_prereleases.yml (4)

21-23: LGTM: Concurrency configuration added.

The addition of the concurrency configuration is a good practice. It helps manage CI resources by canceling in-progress jobs when a new run is triggered, while ensuring separate concurrency groups for different branches or PRs.


131-131: Consider keeping Python version consistent.

The change from a fixed Python version (3.12) to a more flexible version (3.x) introduces potential inconsistencies across different runs. This might lead to difficulties in reproducing issues or ensuring consistent behavior.

Could you please clarify the rationale behind this change? If there's no specific reason, consider keeping it consistent with the Python version used in other jobs (3.12) to ensure reproducibility.


100-100: LGTM: Test scope refined.

The modification to run tests only for package/tests/test_PartSeg in this step is good, as it complements the new "Test with tox base" step.

To ensure we haven't inadvertently missed any tests, please run the following script to verify complete test coverage:

Compare the output to ensure all necessary test directories are included in the tox commands.

✅ Verification successful

LGTM: Complete test coverage verified.

All test directories are included in the tox commands, ensuring comprehensive test coverage.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all test directories are covered by the tox commands

# Test: Check if all test directories are included in either tox command
echo "Test directories in tox commands:"
grep -E "python -m tox run.*package/tests" .github/workflows/test_prereleases.yml

echo -e "\nAll test directories in the project:"
fd -t d "test" package

Length of output: 554


133-142: LGTM: Upgraded dependency management to uv.

The switch from pip-tools to uv is a positive change. uv is known for better performance and dependency resolution, which could help address pre-release test issues.

Consider updating the project's documentation to reflect this change in dependency management. This will help other contributors understand the new workflow.

To ensure the uv commands are working as expected, please run the following script:

Review the output to confirm that all uv commands are correctly formatted and that the uv installation step is present.

Also applies to: 149-149

✅ Verification successful

Verified: UV commands are correctly implemented in the workflow.

All uv commands and the uv installation step are properly configured.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify uv commands in the workflow

# Test: Check if uv commands are correctly formatted
echo "uv commands in the workflow:"
grep -E "uv (pip|run|venv|sync)" .github/workflows/test_prereleases.yml

echo -e "\nVerify uv installation command:"
grep -E "pip install uv" .github/workflows/test_prereleases.yml

Length of output: 634

Copy link

sonarcloud bot commented Oct 22, 2024

@Czaki Czaki merged commit fec1eb3 into develop Oct 22, 2024
58 checks passed
@Czaki Czaki deleted the fix_pre branch October 22, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[test-bot] pyinstaller bundle --pre is failing [test-bot] pip install --pre is failing
1 participant