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

chore(ci): simplify the CI and image building #1015

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

Conversation

goldmedal
Copy link
Contributor

@goldmedal goldmedal commented Dec 26, 2024

Description

  • Remove the testing for windows and mac(intel) platform.
  • Add CI flow for wren-core-base
  • Build amd64 image for testing image

Summary by CodeRabbit

  • New Features

    • Introduced a new GitHub Actions workflow for automating the build and testing processes of a Rust project.
  • Improvements

    • Streamlined existing workflows by focusing on Linux and macOS ARM architecture, removing support for Windows and standard macOS.
    • Added a rule to the .gitignore file to prevent tracking of .venv directories.
  • Bug Fixes

    • Removed support for building images for the ARM64 platform in the build workflow.

Copy link

coderabbitai bot commented Dec 26, 2024

Walkthrough

The pull request introduces modifications to GitHub Actions workflows and the .gitignore file. The changes focus on streamlining build and testing processes for a Rust project by removing multi-platform support for Docker image builds and test configurations. Specifically, the workflows now concentrate on AMD64 architecture for Docker images and maintain Linux and macOS-aarch64 testing environments. Additionally, a new workflow for the Rust project has been added, and the .gitignore file now excludes .venv directories.

Changes

File Change Summary
.github/workflows/build-image.yml Removed linux/arm64 platform support, limiting builds to linux/amd64
.github/workflows/wren-core-base.yml New workflow added for Rust project with jobs for building, testing, formatting, and linting
.github/workflows/wren-core.yml Removed windows and macos jobs, retained Linux and macOS-aarch64 testing
.gitignore Added **/.venv/ to ignore virtual environment directories

Sequence Diagram

sequenceDiagram
    participant PR as Pull Request
    participant Workflow as GitHub Actions
    participant Build as Build Job
    participant Test as Test Job
    participant Lint as Linting Job

    PR->>Workflow: Trigger
    Workflow->>Build: Compile Rust
    Build-->>Workflow: Build Complete
    Workflow->>Test: Run Tests
    Test-->>Workflow: Tests Passed
    Workflow->>Lint: Check Formatting
    Lint-->>Workflow: Linting Complete
    Workflow->>PR: Status Report
Loading

Poem

🐰 A Rabbit's Build Ballad 🚀
AMD64, our platform of choice,
No more ARM64, we rejoice!
Workflows trimmed, lean and bright,
Rust tests running with pure delight
One architecture, swift and clean! 🌟


🪧 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.

@github-actions github-actions bot added the ci label Dec 26, 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: 1

🧹 Nitpick comments (3)
.gitignore (1)

22-22: Consider removing redundant venv entry

The new **/.venv/ pattern effectively covers all .venv directories at any depth. Consider removing the redundant venv/ entry since it's now covered by this more comprehensive pattern.

-venv/
**/.venv/
.github/workflows/wren-core-base.yml (1)

3-6: Consider adding push events for main branch

The workflow currently only triggers on pull requests affecting the wren-core-base directory. Consider also triggering on push events to the main branch to ensure continuous validation of the main branch state.

on:
  pull_request:
    paths:
      - 'wren-core-base/**'
+  push:
+    branches:
+      - main
+    paths:
+      - 'wren-core-base/**'
.github/workflows/build-image.yml (1)

Line range hint 156-183: Consider simplifying merge job for single platform

Since we're now building for a single platform, the merge job could be simplified. Consider whether this complex manifest creation is still necessary for a single platform build.

You could potentially replace this with a simpler tag-based approach since there's no need to merge multiple platform manifests anymore.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bdf25ea and f2db7fc.

📒 Files selected for processing (4)
  • .github/workflows/build-image.yml (1 hunks)
  • .github/workflows/wren-core-base.yml (1 hunks)
  • .github/workflows/wren-core.yml (0 hunks)
  • .gitignore (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/wren-core.yml
🔇 Additional comments (3)
.github/workflows/wren-core-base.yml (1)

1-129: Well-structured workflow that aligns with PR objectives

The workflow is well-organized with appropriate job dependencies and comprehensive checks. It correctly implements the PR's platform simplification goals by focusing on Linux (amd64) and macOS (arm64) only.

.github/workflows/build-image.yml (2)

81-81: Platform specification aligns with PR objectives

The removal of linux/arm64 platform support successfully simplifies the image building process, aligning with the PR's goals.


Line range hint 89-95: Matrix configuration properly simplified

The matrix configuration has been correctly updated to remove arm64 support, maintaining consistency with the platform changes.

Comment on lines 30 to 41
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./wren-core/target/
# this key equals the ones on `linux-build-lib` for re-use
key: cargo-cache-benchmark-${{ hashFiles('wren-core/Cargo.toml') }}

Copy link

@coderabbitai coderabbitai bot Dec 26, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix cache key to match working directory

The cache key references wren-core but the working directory is set to wren-core-base. This mismatch could lead to cache misses.

-          key: cargo-cache-benchmark-${{ hashFiles('wren-core/Cargo.toml') }}
+          key: cargo-cache-benchmark-${{ hashFiles('wren-core-base/Cargo.toml') }}
📝 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
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./wren-core/target/
# this key equals the ones on `linux-build-lib` for re-use
key: cargo-cache-benchmark-${{ hashFiles('wren-core/Cargo.toml') }}
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./wren-core/target/
# this key equals the ones on `linux-build-lib` for re-use
key: cargo-cache-benchmark-${{ hashFiles('wren-core-base/Cargo.toml') }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 9cc2356

Copy link

Choose a reason for hiding this comment

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

@goldmedal Thanks for addressing this in commit 9cc2356! Everything looks good now; no further changes needed.

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

🧹 Nitpick comments (2)
.github/workflows/wren-core-base.yml (2)

125-127: Add caching for taplo binary.

Consider caching the taplo binary to speed up workflow runs. The binary is currently installed fresh in each run.

+      - name: Cache taplo
+        uses: actions/cache@v4
+        with:
+          path: ~/.cargo/bin/taplo
+          key: ${{ runner.os }}-taplo-0.9
       - name: Install taplo
+        if: steps.cache-taplo.outputs.cache-hit != 'true'
         run: cargo +stable install taplo-cli --version ^0.9 --locked

94-94: Optimize job dependencies.

Consider running the clippy and cargo-toml-formatting-checks jobs in parallel with tests instead of depending on linux-build-lib. Since these are independent checks, they could run earlier and provide faster feedback.

   clippy:
     name: clippy
-    needs: [ linux-build-lib ]
+    needs: [ ]

   cargo-toml-formatting-checks:
     name: check Cargo.toml formatting
-    needs: [ linux-build-lib ]
+    needs: [ ]

Also applies to: 113-113

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f2db7fc and 9cc2356.

📒 Files selected for processing (1)
  • .github/workflows/wren-core-base.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/wren-core-base.yml (2)

1-15: LGTM! Well-structured workflow configuration.

The workflow configuration is properly set up with:

  • Appropriate path filters for PR triggers
  • Concurrency controls to prevent redundant runs
  • Correct working directory configuration

61-61: Verify intentional exclusion of doctests.

Both Linux and macOS test jobs exclude doctests (--lib --tests --bins). Please confirm if this is intentional, as doctests can be valuable for documentation accuracy.

rust" wren-core-base/src



Also applies to: 76-76

<details>
<summary>✅ Verification successful</summary>

rust' wren-core-base/src/

# Also check for #[doc = "..."] attributes that might contain code examples
rg -l '#\[doc.*```rust' wren-core-base/src/

# Check if there are any doc comments with code blocks
rg -l '//!.*```rust|///.*```rust' wren-core-base/src/

" wren-core-base/src/mdl/cls.rs wren-core-base/src/mdl/builder.rs wren-core-base/src/mdl/manifest.rs


---

' wren-core-base/src/mdl/cls.rs wren-core-base/src/mdl/builder.rs wren-core-base/src/mdl/manifest.rs

Excluding doctests appears appropriate for this codebase

Based on the analysis of the documentation in the codebase, while there are documented functions and methods, there don't appear to be any actual Rust code examples (```rust blocks) in the documentation that would be executed as doctests. The documentation consists mainly of descriptive comments and method/field explanations without executable examples. Therefore, excluding doctests in the test configuration is appropriate for this codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any doctests in the codebase that would be skipped
rg -l "

Length of output: 116


Script:

#!/bin/bash
# Check if there are any doctests in the codebase that would be skipped
rg -l '

Length of output: 116


Script:

#!/bin/bash
# Search for Rust documentation tests in the codebase
rg --type rust -l "(//!|///|#\[doc)" wren-core-base/src/

Length of output: 157


Script:

#!/bin/bash
# Check the content of doc comments to see if they contain actual code examples
rg "(//!|///|#\[doc).*

Length of output: 116


Script:

#!/bin/bash
# Check the content of doc comments to see if they contain actual code examples
rg -U '(//!|///|#\[doc =)(.|\n)*

Length of output: 116


Script:

#!/bin/bash
# Check for documentation content in the files
cat wren-core-base/src/mdl/cls.rs wren-core-base/src/mdl/builder.rs wren-core-base/src/mdl/manifest.rs | grep -A 2 "//\|#\[doc"

Length of output: 2743

.github/workflows/wren-core-base.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

🧹 Nitpick comments (1)
.github/workflows/wren-core.yml (1)

Line range hint 1-124: Workflow structure aligns with PR objectives

The workflow has been successfully streamlined by:

  • Removing Windows testing
  • Removing Mac (Intel) testing
  • Maintaining Linux (amd64) and macOS-aarch64 support
  • Keeping essential checks (fmt, clippy, Cargo.toml formatting)

The job dependencies and concurrency controls are properly configured.

Consider these potential optimizations:

  1. Add cargo cache for macOS-aarch64 job to improve build times
  2. Consider matrix strategy for Rust versions if backward compatibility is needed
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9cc2356 and 668d979.

📒 Files selected for processing (2)
  • .github/workflows/wren-core-base.yml (1 hunks)
  • .github/workflows/wren-core.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/wren-core-base.yml
🔇 Additional comments (1)
.github/workflows/wren-core.yml (1)

42-42: Verify the impact of checking all targets

The step has been changed from checking specific features to checking all targets. While this provides better coverage, it might increase the build time.

Run the following script to analyze the available targets and their impact:

✅ Verification successful

Checking all targets is consistent with the project's CI practices

After analyzing the workflow files, I can see that checking all targets is already being used in the wren-core-base.yml workflow, and this change aligns the wren-core.yml workflow with that practice. The change from checking specific features to checking all targets is part of a consistent CI strategy across the project's Rust components.

Key observations:

  • Both wren-core and wren-core-base workflows use cargo check --all-targets
  • The change maintains consistency between related components
  • The workflow has proper caching configured to optimize build times
  • The step is part of the initial compilation check before running more intensive tests
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Analyze cargo targets and their dependencies
# Note: This helps verify if all targets are necessary

# Check available targets
cd wren-core && cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "wren-core") | .targets[] | {name: .name, kind: .kind}'

# Check build time impact by searching for relevant discussions
rg -l 'cargo.*check.*all-targets' .github/

Length of output: 335


Script:

#!/bin/bash
# Let's try a different approach to analyze the workflow file and check targets

# First, let's check if the workflow file exists and examine its content
fd -t f "wren-core.yml" .github/workflows/ --exec cat {}

# Let's also search for any other workflow files that might provide context
fd -t f "\.ya?ml$" .github/workflows/ --exec echo "=== {} ===" \; --exec cat {}

# Search for cargo check commands in all workflow files
rg "cargo.+check" .github/workflows/

Length of output: 31110

@goldmedal goldmedal requested a review from wwwy3y3 December 26, 2024 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant