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

automations #16

Merged
merged 10 commits into from
Sep 9, 2024
Merged

automations #16

merged 10 commits into from
Sep 9, 2024

Conversation

builderjer
Copy link
Member

@builderjer builderjer commented Sep 8, 2024

Summary by CodeRabbit

  • New Features

    • Introduced automated workflows for publishing alpha and stable releases to PyPI.
    • Implemented a new workflow for pushing changes from the dev branch to the master branch.
    • Enhanced license checking with detailed reporting capabilities.
    • Added a versioning system for better management of software updates.
  • Bug Fixes

    • Improved the build process for better efficiency and flexibility across multiple Python versions.
  • Chores

    • Streamlined installation steps in workflows and optimized dependency management.
    • Added auditing for installed packages in the build process.
    • Introduced scripts for managing version updates and alpha designations.

Copy link

coderabbitai bot commented Sep 8, 2024

Warning

Rate limit exceeded

@JarbasAl has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 43 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between b7af3e2 and e51f528.

Walkthrough

This pull request introduces multiple new GitHub Actions workflows and modifies existing ones to automate build tests, license checks, and release publishing. It includes new workflows for managing versioning and publishing to PyPI, alongside streamlined installation processes and enhanced license checking. The updates adhere to Semantic Versioning principles, ensuring a structured and efficient development workflow.

Changes

File Path Change Summary
.github/workflows/build_tests.yml Modified to support multiple Python versions and optimize installation steps.
.github/workflows/dev2master.yml New workflow for manually pushing changes from dev to master.
.github/workflows/license_tests.yml Updated to use a new license checking action and refined branch triggers.
.github/workflows/publish_alpha.yml New workflow for generating and publishing alpha releases to PyPI based on pull request labels.
.github/workflows/publish_stable.yml New workflow for generating and publishing stable releases to PyPI on master branch updates.
.github/workflows/release_workflow.yml New workflow for managing alpha releases and proposing stable releases.
scripts/remove_alpha.py New script to remove alpha version designation from a version file.
scripts/update_version.py New script for updating version numbers based on Semantic Versioning principles.
ovos_PHAL_plugin_mk1/version.py New file defining a structured versioning system with constants for major, minor, build, and alpha.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub Actions
    participant PyPI

    Developer->>GitHub Actions: Push changes to dev branch
    GitHub Actions->>GitHub Actions: Run tests and label PR
    GitHub Actions->>GitHub Actions: Check for alpha release
    GitHub Actions->>PyPI: Publish alpha release
    Developer->>GitHub Actions: Merge to master
    GitHub Actions->>GitHub Actions: Run stable release workflow
    GitHub Actions->>PyPI: Publish stable release
Loading

🐇 In the meadow where bunnies play,
New workflows hop in, brightening the day!
From alpha to stable, our versions will soar,
With labels and scripts, we’ll do so much more!
Let's celebrate changes, both big and small,
In our coding garden, we’ll flourish for all! 🌼✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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

@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: 11

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 66f3668 and 5894819.

Files selected for processing (10)
  • .github/workflows/build_tests.yml (1 hunks)
  • .github/workflows/conventional-label.yml (1 hunks)
  • .github/workflows/dev2master.yml (1 hunks)
  • .github/workflows/license_tests.yml (2 hunks)
  • .github/workflows/publish_alpha.yml (1 hunks)
  • .github/workflows/publish_stable.yml (1 hunks)
  • ovos_PHAL_plugin_mk1/mk1_serial.py (1 hunks)
  • scripts/remove_alpha.py (1 hunks)
  • scripts/update_version.py (1 hunks)
  • version.py (1 hunks)
Files skipped from review due to trivial changes (2)
  • .github/workflows/conventional-label.yml
  • version.py
Additional context used
actionlint
.github/workflows/dev2master.yml

11-11: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

.github/workflows/build_tests.yml

19-19: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


21-21: the runner of "actions/setup-python@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

.github/workflows/publish_stable.yml

22-22: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


27-27: the runner of "actions/setup-python@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


34-34: shellcheck reported issue in this script: SC2086:info:1:47: Double quote to prevent globbing and word splitting

(shellcheck)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

.github/workflows/publish_alpha.yml

24-24: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


30-30: the runner of "actions/setup-python@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


95-95: shellcheck reported issue in this script: SC2086:info:1:88: Double quote to prevent globbing and word splitting

(shellcheck)


112-112: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

Ruff
scripts/remove_alpha.py

6-6: sys imported but unused

Remove unused import: sys

(F401)


7-7: os.path.join imported but unused

Remove unused import

(F401)


7-7: os.path.dirname imported but unused

Remove unused import

(F401)

ovos_PHAL_plugin_mk1/mk1_serial.py

10-10: SyntaxError: Expected a statement


10-11: SyntaxError: Expected a statement

scripts/update_version.py

7-7: sys imported but unused

Remove unused import: sys

(F401)


19-19: Ambiguous variable name: l

(E741)


20-20: Ambiguous variable name: l

(E741)

Additional comments not posted (5)
.github/workflows/dev2master.yml (1)

3-20: Workflow setup looks good.

The configuration for triggering the workflow and the job setup is appropriate for the intended purpose of pushing changes from dev to master.

Tools
actionlint

11-11: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

.github/workflows/license_tests.yml (3)

4-8: Good practice: Explicit branch targeting for workflow triggers.

The changes to trigger the workflow only on specific branches (master for push and dev for pull requests) are a good practice as they help in managing CI resources more efficiently.


37-39: Good practice: Printing the license check report.

Adding a step to always print the license check report enhances transparency and aids in debugging. This is a good practice.


30-36: Enhanced license checking using a dedicated action.

The use of pilosus/[email protected] for license checking is a good practice as it simplifies the workflow. However, ensure that the version v0.5.0 of the action is the most stable and appropriate for your needs.

Run the following script to verify the action's version:

scripts/update_version.py (1)

32-57: Well-implemented version update logic.

The logic to update the version components based on the specified part (major, minor, build, alpha) is correctly implemented. Resetting the lower version components when updating a higher component is a good practice and is well followed here.

.github/workflows/dev2master.yml Outdated Show resolved Hide resolved
scripts/remove_alpha.py Outdated Show resolved Hide resolved
.github/workflows/build_tests.yml Outdated Show resolved Hide resolved
ovos_PHAL_plugin_mk1/mk1_serial.py Outdated Show resolved Hide resolved
ovos_PHAL_plugin_mk1/mk1_serial.py Outdated Show resolved Hide resolved
.github/workflows/publish_stable.yml Show resolved Hide resolved
.github/workflows/publish_stable.yml Outdated Show resolved Hide resolved
.github/workflows/publish_stable.yml Outdated Show resolved Hide resolved
.github/workflows/publish_alpha.yml Outdated Show resolved Hide resolved
.github/workflows/publish_alpha.yml Outdated Show resolved Hide resolved
Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5894819 and 58ff301.

Files selected for processing (1)
  • .github/workflows/build_tests.yml (1 hunks)
Additional context used
actionlint
.github/workflows/build_tests.yml

19-19: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


21-21: the runner of "actions/setup-python@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Additional comments not posted (5)
.github/workflows/build_tests.yml (5)

4-5: Branch specification for push events is correctly set.

The workflow is now configured to trigger on pushes to the master branch, which is a standard practice for mainline development.


7-8: Branch specification for pull request events is correctly set.

The workflow is now configured to trigger on pull requests to the dev branch, ensuring that all changes are tested before merging.


13-16: Job strategy configuration is well-defined.

The strategy allows for parallel execution with a matrix of Python versions, enhancing the testing process across multiple environments.


23-23: Dynamic Python version setup is implemented correctly.

The use of ${{ matrix.python-version }} allows for dynamic selection of Python versions, which is a significant improvement for flexibility in testing.


37-37: Installation step name change enhances clarity.

Renaming the step to "Install skill" better describes the action being performed, improving the readability and maintainability of the workflow.

Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 58ff301 and b08178d.

Files selected for processing (1)
  • .github/workflows/build_tests.yml (1 hunks)
Additional context used
actionlint
.github/workflows/build_tests.yml

19-19: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


21-21: the runner of "actions/setup-python@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Additional comments not posted (6)
.github/workflows/build_tests.yml (6)

4-8: Branch specifications added for workflow triggers.

The addition of specific branches (master and dev) for both push and pull request events is a good practice as it prevents unnecessary workflow runs on branches that do not require these checks. This change aligns with the PR's objective to enhance automation efficiently.


13-16: Strategy for parallel execution and Python version matrix defined.

Setting max-parallel: 2 and defining a matrix for Python versions (3.7, 3.8, 3.9, "3.10") are significant improvements. These changes allow for more efficient testing across multiple versions of Python, ensuring compatibility and catching potential issues across versions.


23-23: Dynamic Python version setup.

Updating the Python version setup to utilize the matrix version (${{ matrix.python-version }}) instead of a fixed version enhances the flexibility of the workflow. This allows each job to run with the specified version in the matrix, improving test coverage across different Python environments.


30-30: Streamlined installation of system dependencies.

The removal of some packages (libfann-dev, portaudio19-dev, libpulse-dev) and the removal of the workaround for tflite_runtime indicate an optimization of the build environment. This should lead to faster build times and less maintenance overhead.


37-39: Renamed installation step to 'Install skill'.

Renaming the step from "Install core repo" to "Install skill" while retaining the installation command (pip install .) clarifies the purpose of the step without altering its functionality. This change improves the readability and understandability of the workflow file.


40-49: Added package auditing step using pypa/gh-action-pip-audit.

The inclusion of a step to audit installed packages using pypa/gh-action-pip-audit is a proactive measure to ensure security. The specified ignore list for vulnerabilities that are irrelevant to the project is a thoughtful addition, although it's important to periodically review these exceptions to ensure they remain valid.

.github/workflows/build_tests.yml Outdated Show resolved Hide resolved
@builderjer builderjer added the enhancement New feature or request label Sep 8, 2024
Copy link

@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

Outside diff range, codebase verification and nitpick comments (1)
.github/workflows/license_tests.yml (1)

30-39: Approved new steps for license checking and report printing.

The use of pilosus/[email protected] for license checking is a streamlined approach. The step to print the report using always() ensures that the output is visible regardless of previous steps' success or failure.

Consider adding a brief comment before the echo command in the report printing step to clarify what is being printed for better maintainability.

+ # Print the license check report
  echo "${{ steps.license_check_report.outputs.report }}"
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b08178d and 0d029f2.

Files selected for processing (5)
  • .github/workflows/build_tests.yml (1 hunks)
  • .github/workflows/dev2master.yml (1 hunks)
  • .github/workflows/license_tests.yml (2 hunks)
  • .github/workflows/publish_alpha.yml (1 hunks)
  • .github/workflows/publish_stable.yml (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/build_tests.yml
  • .github/workflows/dev2master.yml
Additional context used
actionlint
.github/workflows/publish_stable.yml

34-34: shellcheck reported issue in this script: SC2086:info:1:47: Double quote to prevent globbing and word splitting

(shellcheck)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

.github/workflows/publish_alpha.yml

55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


95-95: shellcheck reported issue in this script: SC2086:info:1:88: Double quote to prevent globbing and word splitting

(shellcheck)


112-112: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

Additional comments not posted (1)
.github/workflows/license_tests.yml (1)

4-8: Approved trigger conditions.

The addition of specific branches (master for push and dev for pull_request) is a good practice to ensure the workflow runs only on relevant branches.

.github/workflows/publish_stable.yml Outdated Show resolved Hide resolved
.github/workflows/publish_alpha.yml Outdated Show resolved Hide resolved
Copy link

@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: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0d029f2 and 2c0f9ca.

Files selected for processing (4)
  • .github/workflows/publish_alpha.yml (1 hunks)
  • .github/workflows/publish_stable.yml (1 hunks)
  • scripts/remove_alpha.py (1 hunks)
  • scripts/update_version.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • scripts/remove_alpha.py
Additional context used
Ruff
scripts/update_version.py

18-18: Ambiguous variable name: l

(E741)


19-19: Ambiguous variable name: l

(E741)

actionlint
.github/workflows/publish_stable.yml

55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

.github/workflows/publish_alpha.yml

55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


55-55: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


112-112: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)

Additional comments not posted (2)
scripts/update_version.py (2)

31-56: LGTM!

The logic to update version components based on the specified part is correctly implemented.


58-65: Well-implemented CLI handling.

The command-line interface setup and function invocation are correctly implemented using argparse and abspath.

scripts/update_version.py Outdated Show resolved Hide resolved
.github/workflows/publish_stable.yml Outdated Show resolved Hide resolved
.github/workflows/publish_alpha.yml Outdated Show resolved Hide resolved
Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2c0f9ca and a621878.

Files selected for processing (3)
  • .github/workflows/publish_stable.yml (1 hunks)
  • .github/workflows/release_workflow.yml (1 hunks)
  • ovos_PHAL_plugin_mk1/version.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • ovos_PHAL_plugin_mk1/version.py
Additional context used
actionlint
.github/workflows/publish_stable.yml

22-22: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

.github/workflows/release_workflow.yml

31-31: the runner of "actions/setup-python@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


37-37: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)


49-49: shellcheck reported issue in this script: SC2034:warning:2:1: BRANCH_NAME appears unused. Verify use (or export if used externally)

(shellcheck)

Additional comments not posted (1)
.github/workflows/release_workflow.yml (1)

49-55: The BRANCH_NAME variable flagged as unused by shellcheck is likely used for documentation purposes or for future use. No action needed.

Tools
actionlint

49-49: shellcheck reported issue in this script: SC2034:warning:2:1: BRANCH_NAME appears unused. Verify use (or export if used externally)

(shellcheck)

ref: dev

- name: Setup Python
uses: actions/setup-python@v2
Copy link

Choose a reason for hiding this comment

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

Update GitHub Action to the latest version.

The actions/setup-python@v2 action is outdated. Consider updating it to the latest version to ensure compatibility and access to the latest features.

Apply this update:

- uses: actions/setup-python@v2
+ uses: actions/setup-python@v3
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.

Suggested change
uses: actions/setup-python@v2
uses: actions/setup-python@v3
Tools
actionlint

31-31: the runner of "actions/setup-python@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Comment on lines +37 to +39
run: |
VERSION=$(python setup.py --version)
echo "VERSION=$VERSION" >> $GITHUB_ENV
Copy link

Choose a reason for hiding this comment

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

Quote variable in shell script to prevent issues.

The shell script does not quote the $VERSION variable, which could lead to word splitting or globbing issues.

Apply this fix:

- echo "VERSION=$VERSION" >> $GITHUB_ENV
+ echo "VERSION=$VERSION" >> "$GITHUB_ENV"
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.

Suggested change
run: |
VERSION=$(python setup.py --version)
echo "VERSION=$VERSION" >> $GITHUB_ENV
run: |
VERSION=$(python setup.py --version)
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
Tools
actionlint

37-37: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)

Copy link

@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, codebase verification and nitpick comments (1)
setup.py (1)

7-28: LGTM! Suggestions to enhance error handling.

The get_version function looks good. It provides a centralized way to manage versioning by reading from a dedicated version file. This approach enhances maintainability as the version only needs to be updated in one place.

However, consider the following enhancements to improve error handling:

  1. Validate the existence of the version file before reading. Raise an error or return a default version if the file is missing.
  2. Handle missing version components gracefully by providing default values. This will prevent the function from breaking if the version file format changes.

Here's an updated version of the function with the suggested enhancements:

def get_version():
    """ Find the version of this skill"""
    version_file = join(dirname(__file__), 'ovos_PHAL_plugin_mk1/version.py')
    major, minor, build, alpha = (0, 0, 0, 0)  # Default values
    try:
        with open(version_file) as f:
            for line in f:
                if 'VERSION_MAJOR' in line:
                    major = line.split('=')[1].strip()
                elif 'VERSION_MINOR' in line:
                    minor = line.split('=')[1].strip()
                elif 'VERSION_BUILD' in line:
                    build = line.split('=')[1].strip()
                elif 'VERSION_ALPHA' in line:
                    alpha = line.split('=')[1].strip()

                if ((major and minor and build and alpha) or
                        '# END_VERSION_BLOCK' in line):
                    break
    except FileNotFoundError:
        print(f"Version file not found: {version_file}. Using default version.")

    version = f"{major}.{minor}.{build}"
    if int(alpha):
        version += f"a{alpha}"
    return version
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a621878 and b7af3e2.

Files selected for processing (2)
  • .github/workflows/build_tests.yml (1 hunks)
  • setup.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/build_tests.yml
Additional comments not posted (1)
setup.py (1)

34-34: LGTM!

Replacing the hardcoded version string with a call to get_version() is a good change. It ensures that the version specified in setup() is always in sync with the version defined in the version file. This eliminates the need to manually update the version in setup.py every time it changes.

@JarbasAl JarbasAl merged commit dc04d5d into dev Sep 9, 2024
4 of 5 checks passed
@JarbasAl JarbasAl deleted the automations branch September 9, 2024 22:37
@coderabbitai coderabbitai bot mentioned this pull request Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants