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 GH workflow to run lint checks daily as well as for every commit and PR. #14

Merged
merged 4 commits into from
Oct 3, 2024

Conversation

kirkrodrigues
Copy link
Member

@kirkrodrigues kirkrodrigues commented Oct 3, 2024

Description

This PR adds a workflow to run task lint:check daily as well as for every commit and PR. This is largely based on the workflows in y-scope/yscope-log-viewer and y-scope/log-surgeon.

Validation performed

  • Validated the workflow ran successfully.
  • Added a lint violation in lint.yaml and validated the lint workflow failed due to the violation.

Summary by CodeRabbit

  • New Features

    • Introduced a new automated linting workflow to enhance code quality checks.
    • The workflow can be triggered automatically on pull requests, pushes, and daily schedules, as well as manually.
  • Improvements

    • Enhanced efficiency with concurrency settings to manage in-progress jobs effectively.

Copy link

coderabbitai bot commented Oct 3, 2024

Walkthrough

A new GitHub Actions workflow file named lint.yml has been added to automate linting tasks. This workflow is triggered by specific events such as pull requests, push events, and daily schedules. It includes concurrency settings to manage job execution, and it runs on both macOS and Ubuntu using a matrix strategy. The workflow performs various steps, including checking out the repository, setting up Python, installing necessary tools, and executing the linting task defined in the project's configuration.

Changes

File Change Summary
.github/workflows/lint.yml Introduced a new workflow for linting tasks with defined triggers, concurrency settings, and job steps.

Possibly related PRs

Suggested reviewers

  • junhaoliao

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3b72bc7 and cf77a00.

📒 Files selected for processing (1)
  • .github/workflows/lint.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/lint.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.

@junhaoliao junhaoliao self-requested a review October 3, 2024 10:03
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 and nitpick comments (3)
.github/workflows/lint.yml (3)

12-19: Excellent job on permissions and concurrency settings.

The "write" permission for contents is correctly set to allow cancelling in-progress jobs. The concurrency setup is well-configured to prevent redundant runs, improving efficiency.

Consider adding a comment explaining why the "write" permission is needed, to improve clarity for future maintainers:

permissions:
  # "write" permission is required to cancel in-progress jobs
  contents: "write"

27-34: Good setup for repository checkout and Python.

The checkout step correctly includes submodules, which is crucial if the project depends on them. Setting up Python is also handled appropriately.

Consider using a more recent version of Python, such as 3.9 or 3.10, unless there's a specific requirement for 3.8. You could also use a matrix strategy for Python versions to ensure compatibility across multiple versions:

strategy:
  matrix:
    os: ["macos-latest", "ubuntu-latest"]
    python-version: ["3.8", "3.9", "3.10"]
runs-on: ${{ matrix.os }}
steps:
  # ...
  - uses: "actions/setup-python@v5"
    with:
      python-version: ${{ matrix.python-version }}

36-44: Good setup for tool installation and lint task execution.

The installation of necessary tools and the execution of the lint task are well-structured. The conditional step for installing coreutils on macOS is a good practice to ensure cross-platform compatibility.

Consider the following improvements:

  1. Specify a version for the task CLI tool to ensure consistency:

    - name: "Install task"
      run: "npm install -g @go-task/[email protected]"  # Replace with the desired version
  2. Add a step to cache npm dependencies to speed up future runs:

    - uses: actions/cache@v3
      with:
        path: ~/.npm
        key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
        restore-keys: |
          ${{ runner.OS }}-node-
  3. Consider adding a step to output the versions of installed tools for debugging purposes:

    - name: "Output tool versions"
      run: |
        task --version
        python --version
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1d19bf0 and 3b72bc7.

📒 Files selected for processing (1)
  • .github/workflows/lint.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/lint.yml (2)

1-10: LGTM! Comprehensive trigger configuration.

The workflow name is concise and the trigger configuration is comprehensive. It covers all necessary scenarios for running lint checks, including pull requests, pushes, and a daily schedule. The daily run at 00:15 UTC is a good choice to avoid high load periods.


21-26: Well-structured job setup with cross-platform support.

The matrix strategy to run the lint job on both macOS and Ubuntu latest versions is excellent. This ensures cross-platform compatibility and catches any potential OS-specific issues early in the development process.

junhaoliao
junhaoliao previously approved these changes Oct 3, 2024
Copy link
Collaborator

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

LGTM.

I agree with the Rabbit on this one:

Consider adding a step to output the versions of installed tools for debugging purposes.

Copy link
Collaborator

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

The PR title is fine for the final commit message.

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.

2 participants