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

ci: upload WASM and download in other workflows #147

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

sd2k
Copy link
Collaborator

@sd2k sd2k commented Nov 7, 2024

Summary by CodeRabbit

  • New Features

    • Updated workflow configurations to trigger jobs based on the completion of the prophet-wasmstan workflow.
    • Added functionality to download and upload artifacts for improved workflow efficiency.
  • Bug Fixes

    • Removed outdated triggers for push and pull_request events in Rust workflow.

Copy link
Contributor

coderabbitai bot commented Nov 7, 2024

Walkthrough

The pull request modifies several GitHub workflow configurations to change their triggering mechanisms to workflow_run, specifically linking them to the completion of the prophet-wasmstan workflow. The .github/workflows/release-plz.yml and .github/workflows/rust.yml files now trigger jobs based on this new event. Additionally, the Rust workflow introduces a new step to download an artifact from the prophet-wasmstan workflow. The wasmstan workflow is updated to include a step for uploading the prophet-wasmstan.wasm artifact.

Changes

File Change Summary
.github/workflows/release-plz.yml Trigger changed from push to workflow_run on completion of prophet-wasmstan.
.github/workflows/rust.yml Trigger changed from push and pull_request to workflow_run on completion of prophet-wasmstan. New step added to download prophet-wasmstan.wasm artifact.
.github/workflows/wasmstan.yml New step added to upload prophet-wasmstan.wasm artifact after running tests.

Possibly related PRs

  • ci: run Rust CI workflow on PRs to non-main bases #122: The changes in this PR also involve modifying the workflow triggers in .github/workflows/rust.yml to use workflow_run, similar to the changes made in the main PR for .github/workflows/release-plz.yml.
  • fix: fix several issues with JS bindings #131: This PR includes updates to the .github/workflows/wasmstan.yml file, which is related to the prophet-wasmstan workflow mentioned in the main PR, indicating a connection through the shared workflow context.
  • chore: release v0.4.1 #132: This PR documents the release of version 0.4.1, which may be impacted by the workflow changes in the main PR that affect how releases are triggered.
  • chore: release v0.4.2 #133: Similar to chore: release v0.4.1 #132, this PR documents the release of version 0.4.2, which is also relevant to the workflow changes in the main PR regarding release triggers.
  • chore: release v0.4.3 #134: This PR continues the versioning updates, releasing version 0.4.3, and is related to the overall workflow and release process impacted by the changes in the main PR.

🐇 In the meadow, the workflows dance,
Triggered by events, they take a chance.
With artifacts flying, and tests that run,
The rabbit's delight, oh what fun!
From push to run, the changes are bright,
In the world of code, everything feels right! 🌼


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.

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

🧹 Outside diff range and nitpick comments (1)
.github/workflows/wasmstan.yml (1)

32-35: Consider enhancing artifact upload configuration.

To improve reliability for downstream workflows, consider adding:

  1. Artifact retention period
  2. Compression settings for the WASM file
 - uses: actions/upload-artifact@v4
   with:
     name: prophet-wasmstan.wasm
     path: components/cpp/prophet-wasmstan.wasm
+    retention-days: 1
+    compression-level: 6
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5b71bad and 1ac2f7b.

📒 Files selected for processing (3)
  • .github/workflows/release-plz.yml (1 hunks)
  • .github/workflows/rust.yml (2 hunks)
  • .github/workflows/wasmstan.yml (1 hunks)

Comment on lines +8 to +12
workflow_run:
workflows:
- prophet-wasmstan
types:
- "completed"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add conclusion: success to the workflow trigger.

The workflow should only run when the prophet-wasmstan workflow succeeds, not when it fails. This is especially important for a release workflow.

Apply this diff to ensure releases only happen after successful WASM builds:

  workflow_run:
    workflows:
      - prophet-wasmstan
    types:
      - "completed"
+    conclusion: success
    branches:
      - main
📝 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
workflow_run:
workflows:
- prophet-wasmstan
types:
- "completed"
workflow_run:
workflows:
- prophet-wasmstan
types:
- "completed"
conclusion: success

Comment on lines +32 to +35
- uses: actions/upload-artifact@v4
with:
name: prophet-wasmstan.wasm
path: components/cpp/prophet-wasmstan.wasm
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

The artifact path in the workflow needs to be updated

The current path components/cpp/prophet-wasmstan.wasm in the workflow is incorrect. According to the build configuration in components/justfile, the WASM artifact is generated as prophet-wasmstan-component.wasm in the cpp/prophet-wasmstan directory. The correct path should be:

path: components/cpp/prophet-wasmstan/prophet-wasmstan-component.wasm
  • The build process generates prophet-wasmstan-component.wasm as shown in the build target of the justfile
  • The README also confirms this is the expected output filename
  • The rust.yml workflow attempts to download this artifact with a different name, indicating a mismatch in the artifact configuration
🔗 Analysis chain

LGTM! Verify the artifact path exists.

The artifact upload step is correctly configured using the latest version of the upload-artifact action.

Let's verify the artifact path exists in the repository:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the WASM artifact path exists and is generated during the build
# Expected: Find references to the WASM file in build scripts or configuration

# Check for references to the WASM file path in build scripts
rg -l "prophet-wasmstan\.wasm" components/

# Check if there are any build/compilation steps that generate this file
fd -t f "just.*" components/ -x grep -l "prophet-wasmstan\.wasm" {} \;

Length of output: 120


Script:

#!/bin/bash
# Let's try a broader search to understand the WASM build setup

# Check for any WASM-related build configurations
rg -l "\.wasm" components/cpp/

# Look for build scripts or configuration files in cpp component
fd -t f "(CMakeLists\.txt|Makefile|\.cmake|build\.rs|\.toml)" components/cpp/

# Check for any justfile in the repository
fd justfile

# Look for workflow files that might reference this artifact
rg -l "prophet-wasmstan" .github/workflows/

Length of output: 333


Script:

#!/bin/bash
# Let's check the content of relevant files to understand the build process

# Check the README for WASM build instructions
cat components/cpp/prophet-wasmstan/README.md

# Check the justfiles for WASM build targets
cat components/justfile
cat justfile

# Check other workflows that reference this component
cat .github/workflows/rust.yml

Length of output: 8743

Comment on lines +31 to +34
- uses: actions/download-artifact@v4
with:
name: prophet-wasmstan.wasm
path: crates/augurs-prophet/prophet-wasmstan.wasm
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Move artifact download after checkout.

The artifact download step is positioned before the repository checkout, which could cause issues:

  1. The target directory structure doesn't exist yet
  2. The downloaded artifact might be affected by the subsequent checkout

Apply this change to fix the ordering:

-      - uses: actions/download-artifact@v4
-        with:
-          name: prophet-wasmstan.wasm
-          path: crates/augurs-prophet/prophet-wasmstan.wasm
      - name: Checkout sources
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: moonrepo/setup-rust@v1
+      - name: Download WASM artifact
+        uses: actions/download-artifact@v4
+        with:
+          name: prophet-wasmstan.wasm
+          path: crates/augurs-prophet/prophet-wasmstan.wasm
📝 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/download-artifact@v4
with:
name: prophet-wasmstan.wasm
path: crates/augurs-prophet/prophet-wasmstan.wasm
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: moonrepo/setup-rust@v1
- name: Download WASM artifact
uses: actions/download-artifact@v4
with:
name: prophet-wasmstan.wasm
path: crates/augurs-prophet/prophet-wasmstan.wasm

Comment on lines +4 to +8
workflow_run:
workflows:
- prophet-wasmstan
types:
- "completed"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Sequential workflow dependency is justified but can be optimized

The sequential dependency on prophet-wasmstan workflow is necessary but only for the test job. The current setup has these inefficiencies:

  • Only the test job requires the WASM artifact (prophet-wasmstan.wasm)
  • check, fmt, and clippy jobs are blocked unnecessarily

Recommend splitting this into two workflows:

  1. A parallel workflow for check, fmt, and clippy that runs on push/PR
  2. Keep the current sequential workflow only for test job that depends on prophet-wasmstan

This will optimize CI time while maintaining the required dependencies.

🔗 Analysis chain

Verify the sequential workflow dependency requirement.

The workflow now runs sequentially after prophet-wasmstan completes, which could increase overall CI time. Consider:

  1. Whether all jobs need the WASM artifact (currently only test job uses it)
  2. If jobs like check, fmt, and clippy could run in parallel with prophet-wasmstan
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the prophet-wasmstan workflow exists and its artifact usage

# Test 1: Check if the prophet-wasmstan workflow exists
echo "Verifying prophet-wasmstan workflow existence:"
fd -p ".github/workflows/*" -x grep -l "name:.*prophet-wasmstan"

# Test 2: Check which jobs/steps use the WASM artifact
echo -e "\nChecking WASM artifact usage in test commands:"
rg "prophet-wasmstan\.wasm" -A 3

Length of output: 313


Script:

#!/bin/bash
# Let's try a broader search to understand the workflow dependencies and WASM usage

# Check all workflow files
echo "=== All GitHub Workflow Files ==="
fd -p ".github/workflows/"

# Look for any WASM-related content in workflows
echo -e "\n=== WASM-related content in workflows ==="
rg -i "wasm" .github/workflows/

# Check for artifact download/usage in the rust.yml
echo -e "\n=== Artifact usage in rust.yml ==="
cat .github/workflows/rust.yml

# Look for any prophet-wasmstan references
echo -e "\n=== prophet-wasmstan references ==="
rg -i "prophet-wasmstan" .github/workflows/

Length of output: 3506

@sd2k sd2k merged commit 33048ec into main Nov 7, 2024
18 checks passed
@sd2k sd2k deleted the upload-and-download-wasmtime branch November 7, 2024 15:12
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.

1 participant