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

Add version number consistency check for conda recipe #189

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fabianegli
Copy link
Collaborator

@fabianegli fabianegli commented Jan 22, 2025

User description

This PR adds a version number consistency check for the conda recipe.

It is implemented so the conda package build fails fast if the version number doesn't match.


PR Type

Enhancement, Tests


Description

  • Added a version number consistency check in the CI workflow.

  • Updated the version number in the conda recipe to 0.0.31.

  • Ensured the conda build process fails fast on version mismatch.


Changes walkthrough 📝

Relevant files
Enhancement
conda-build.yml
Add version consistency check to CI workflow                         

.github/workflows/conda-build.yml

  • Added a step to check version consistency between the package and the
    conda recipe.
  • Implemented a Python script to compare version numbers.
  • Modified the conda build command to remove the --no-anaconda-upload
    flag.
  • +28/-1   
    meta.yaml
    Update version number in conda recipe                                       

    recipe/meta.yaml

    • Updated the version number from 0.0.30 to 0.0.31.
    +1/-1     

    Need help?
  • Type /help how to ... in the comments thread for any question about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • Chores
      • Updated package version from 0.0.30 to 0.0.31
      • Enhanced GitHub Actions workflow with version consistency check for Conda build
      • Modified Conda build command to potentially change upload behavior

    Copy link
    Contributor

    coderabbitai bot commented Jan 22, 2025

    Walkthrough

    This pull request introduces a version consistency check in the Conda build GitHub Actions workflow and updates the package version from 0.0.30 to 0.0.31. The new workflow step ensures that the version numbers in the package and Conda recipe match, adding an extra validation layer during the build process. The build command has also been slightly modified by removing the --no-anaconda-upload flag.

    Changes

    File Change Summary
    .github/workflows/conda-build.yml Added a new step to check version number consistency between package and Conda recipe
    recipe/meta.yaml Updated package version from "0.0.30" to "0.0.31"

    Sequence Diagram

    sequenceDiagram
        participant Workflow as GitHub Actions
        participant Package as sdrf-pipelines
        participant Recipe as meta.yaml
        participant Build as Conda Build
    
        Workflow->>Package: Retrieve package version
        Workflow->>Recipe: Read recipe version
        Workflow->>Workflow: Compare versions
        alt Versions Match
            Workflow-->>Build: Proceed with build
        else Versions Mismatch
            Workflow-->>Workflow: Raise ValueError
        end
    
    Loading

    Possibly related PRs

    Suggested labels

    version-bump, ci-improvement

    Suggested reviewers

    • ypriverol

    Poem

    🐰 A rabbit's build, with version in sync,
    Checking numbers quick as a blink!
    No mismatched lines, no build astray,
    Conda magic on display today! 🔧✨


    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 generate docstrings to generate docstrings for this PR. (Beta)
    • @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

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Path Hardcoding

    The hardcoded path '/home/runner/work/sdrf-pipelines/sdrf-pipelines' may cause issues if the workflow runs in a different environment or if the repository name changes

    sys.path.append("/home/runner/work/sdrf-pipelines/sdrf-pipelines")
    Error Handling

    The version check script should handle cases where the version string is not found in meta.yaml file or if the file cannot be opened

    with open("./recipe/meta.yaml", encoding="utf-8") as f:
        for line in f.readlines():
            if line.startswith("  version: "):
                recipe_version = line.lstrip("  version:").strip().strip('"')
                break

    Copy link

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Add error handling for failures

    Add error handling for file operations and version extraction to handle cases where
    the file might be missing or have unexpected format.

    .github/workflows/conda-build.yml [28-32]

    -with open("./recipe/meta.yaml", encoding="utf-8") as f:
    -    for line in f.readlines():
    -        if line.startswith("  version: "):
    -            recipe_version = line.lstrip("  version:").strip().strip('"')
    -            break
    +try:
    +    with open("./recipe/meta.yaml", encoding="utf-8") as f:
    +        for line in f.readlines():
    +            if line.startswith("  version: "):
    +                recipe_version = line.lstrip("  version:").strip().strip('"')
    +                break
    +        else:
    +            raise ValueError("Version not found in meta.yaml")
    +except FileNotFoundError:
    +    raise ValueError("Could not find meta.yaml file")
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion adds crucial error handling for file operations and version extraction, which is important for workflow reliability and better error reporting in CI/CD pipelines.

    8
    Initialize variables before use

    Initialize the recipe_version variable before the loop to ensure it's always defined
    when used in the comparison.

    .github/workflows/conda-build.yml [28-32]

    +recipe_version = None
     with open("./recipe/meta.yaml", encoding="utf-8") as f:
         for line in f.readlines():
             if line.startswith("  version: "):
                 recipe_version = line.lstrip("  version:").strip().strip('"')
                 break
    +if recipe_version is None:
    +    raise ValueError("Version not found in meta.yaml")
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion improves code robustness by ensuring the recipe_version variable is properly initialized and validated, preventing potential undefined variable issues in the version comparison.

    7

    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: 2

    🧹 Nitpick comments (1)
    .github/workflows/conda-build.yml (1)

    39-40: Use relative paths in error messages.

    The error message references specific file paths that may not match the actual repository structure. Use relative paths for better portability.

    -                  f"\nVersion in ./sdrf_pipelines/__init__.py: {package_version}"
    -                  f"\nVersion in ./recipe/meta.yaml:           {recipe_version}"
    +                  f"\nPackage version: {package_version}"
    +                  f"\nRecipe version:  {recipe_version}"
    📜 Review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between e76d014 and 85cd4ae.

    📒 Files selected for processing (2)
    • .github/workflows/conda-build.yml (2 hunks)
    • recipe/meta.yaml (1 hunks)
    ✅ Files skipped from review due to trivial changes (1)
    • recipe/meta.yaml
    ⏰ Context from checks skipped due to timeout of 90000ms (2)
    • GitHub Check: Codacy Static Code Analysis
    • GitHub Check: build
    🔇 Additional comments (1)
    .github/workflows/conda-build.yml (1)

    59-59: Verify if package upload to Anaconda is intended.

    The --no-anaconda-upload flag has been removed from the conda build command. This change could potentially lead to package uploads to Anaconda. Please confirm if this is intentional.

    .github/workflows/conda-build.yml Show resolved Hide resolved
    .github/workflows/conda-build.yml Show resolved Hide resolved
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant