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

Use better release-artifact names. #8

Merged
merged 3 commits into from
Nov 7, 2024
Merged

Conversation

floitsch
Copy link
Member

@floitsch floitsch commented Nov 7, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced installation logic for Toit, supporting additional operating systems and architectures.
    • Improved error messaging for unsupported architectures and version checks.
  • Bug Fixes

    • Clarified version handling logic to ensure accurate installation paths and URLs.
  • Chores

    • Updated CI workflow to include macOS 13 and specified version updates.

@floitsch floitsch requested a review from kasperl November 7, 2024 12:29
Copy link

coderabbitai bot commented Nov 7, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes in this pull request focus on updates to the CI workflow configuration and the action script for handling Toit installation files. The CI workflow now includes macOS 13 in the job matrix and specifies version handling more clearly. In the action script, logic for determining the appropriate installation file based on operating system and architecture has been enhanced, including version comparisons and specific error messaging for unsupported architectures.

Changes

File Change Summary
.github/workflows/ci.yml Updated job matrix to include macos-13 and modified version array to include v2.0.0-alpha.164. Clarified logic for handling version argument with explicit conditions and error handling.
action.yml Introduced BETTER_NAME_VERSION for version comparison. Enhanced logic for determining installation files based on OS and architecture with specific error messages for unsupported cases.

Sequence Diagram(s)

sequenceDiagram
    participant CI as CI Workflow
    participant Action as Action Script
    participant User as User

    User->>CI: Trigger CI workflow
    CI->>Action: Execute installation logic
    Action->>Action: Check OS and architecture
    Action->>Action: Determine installation file
    Action-->>CI: Return installation file URL
    CI-->>User: Notify completion
Loading

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.

@floitsch
Copy link
Member Author

floitsch commented Nov 7, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Nov 7, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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 (5)
.github/workflows/ci.yml (1)

14-14: LGTM! Consider documenting version selection strategy.

The version matrix is well structured with:

  • Specific alpha versions for regression testing
  • Latest version for compatibility testing
  • Empty string for testing default behavior

Consider adding a comment explaining the rationale for maintaining multiple alpha versions in the matrix, particularly why v2.0.0-alpha.130 and v2.0.0-alpha.164 were chosen as test versions.

action.yml (4)

35-38: Consider using a more descriptive constant name.

The constant BETTER_NAME_VERSION could be renamed to something more descriptive like ARTIFACT_NAMING_THRESHOLD_VERSION to better indicate its purpose in determining which naming scheme to use.

Consider this improvement:

-BETTER_NAME_VERSION=v2.0.0-alpha.163
+# Version threshold for using the new artifact naming scheme
+ARTIFACT_NAMING_THRESHOLD_VERSION=v2.0.0-alpha.163

39-73: Well-structured architecture handling with clear error messages.

The architecture detection and naming logic is comprehensive and robust. The error messages for unsupported architectures are clear and helpful.

Minor suggestion: Consider aligning the case statements for better readability:

 case "$(uname -m)" in
-  x86_64)
-    TOIT_FILE=toit-linux-x64.tar.gz
-    ;;
+    x86_64)
+        TOIT_FILE=toit-linux-x64.tar.gz
+        ;;

75-98: Consider refactoring to reduce code duplication.

The legacy architecture handling block largely duplicates the structure of the new architecture handling, differing only in file naming. This could be refactored to reduce maintenance burden while maintaining clarity.

Consider extracting the architecture detection into a function and parameterizing the file naming:

get_arch_suffix() {
    local version=$1
    local arch=$2
    
    if [[ "$(echo -e "$ARTIFACT_NAMING_THRESHOLD_VERSION\n$version" | sort -V | tail -n 1)" == "$version" ]]; then
        case "$arch" in
            x86_64)  echo "x64" ;;
            armv7l)  echo "armv7" ;;
            aarch64) echo "aarch64" ;;
        esac
    else
        case "$arch" in
            x86_64)  echo "" ;;
            armv7l)  echo "rpi" ;;
            aarch64) echo "aarch64" ;;
        esac
    fi
}

# Usage example:
arch=$(uname -m)
suffix=$(get_arch_suffix "$TOIT_VERSION" "$arch")
TOIT_FILE="toit-linux${suffix:+-$suffix}.tar.gz"

35-98: Overall implementation aligns well with PR objectives.

The changes successfully implement a version-based transition to better release artifact names while maintaining backward compatibility. The implementation is robust, handling all supported platforms and architectures with appropriate error handling.

Consider documenting the naming scheme transition in the repository's documentation to help users understand the changes in artifact naming across versions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5c8e4df and 369b053.

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

13-13: LGTM! Consider verifying macOS runner compatibility.

The addition of macos-13 to the matrix is good for testing against a specific macOS version alongside the latest.

Let's verify the runner availability:

✅ Verification successful

✓ macOS 13 runner is properly supported

The verification confirms that macos-13 is an officially supported GitHub Actions runner, making it a valid choice for the CI matrix. This ensures reliable testing across both specific and latest macOS versions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that macos-13 is a supported GitHub Actions runner
# Expect: macos-13 to be listed in the supported runners

gh api /repos/actions/runner-images/contents/images/macos/macos-13-Readme.md > /dev/null
if [ $? -eq 0 ]; then
    echo "macos-13 runner is supported"
else
    echo "Warning: macos-13 runner might not be supported"
fi

Length of output: 163

Copy link
Member

@kasperl kasperl left a comment

Choose a reason for hiding this comment

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

Looks good to me.

action.yml Outdated
TOIT_FILE=toit-macos.tar.gz
elif [[ "$RUNNER_OS" = "Windows" ]]; then
TOIT_FILE=toit-windows.tar.gz
ARTIFACT_NAMING_THRESHOLD_VERSION=v2.0.0-alpha.163
Copy link
Member

Choose a reason for hiding this comment

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

Want this to be 164 too?

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

action.yml Outdated
TOIT_FILE=toit-macos.tar.gz
elif [[ "$RUNNER_OS" = "Windows" ]]; then
TOIT_FILE=toit-windows.tar.gz
ARTIFACT_NAMING_THRESHOLD_VERSION=v2.0.0-alpha.163
Copy link
Member

Choose a reason for hiding this comment

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

ASSETS?

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@floitsch floitsch merged commit c81f2dd into main Nov 7, 2024
17 checks passed
@floitsch floitsch deleted the floitsch/use-newer-names branch November 7, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants