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

Programming exercises: Add compile cache to Rust #10421

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

magaupp
Copy link
Contributor

@magaupp magaupp commented Feb 27, 2025

Checklist

General

Server

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server configured with LocalVC and Jenkins.

Motivation and Context

Rust exercises compile all dependencies on every build. This results in long build times.

Description

This PR updates the Docker image to enable compile caching using sccache.
This reduces build times from 15 seconds to 5 seconds.

The changes of the Docker image are in this commit: ls1intum/artemis-rust-docker@09b7608
Code reviews should include the Docker image.

The image installs sccache as a wrapper for rustc and builds a stubbed copy of the exercise template.
This adds the dependency sources to cargo's package cache and the compile artifacts to sccache.

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Create a Rust exercise
  2. Wait until the first build finishes
  3. Refresh the page
  4. Click on the rebuild icon of the solution result:
    image
    (This is necessary because the docker image needs to be downloaded the first time the image is used on a server. This would lengthen the build time.)
  5. Wait until the second build finishes
  6. Verify that the build completed within 10 seconds.

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Performance Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

  • Chores
    • Updated the build process so that testing is now integrated during the build. This enhancement uses a dedicated build profile, which may result in differences in output and performance characteristics, ultimately contributing to more consistent and reliable builds.

@github-actions github-actions bot added config-change Pull requests that change the config in a way that they require a deployment via Ansible. template labels Feb 27, 2025
@helios-aet helios-aet bot temporarily deployed to artemis-test5.artemis.cit.tum.de February 27, 2025 19:24 Inactive
@magaupp magaupp marked this pull request as ready for review February 27, 2025 19:39
@magaupp magaupp requested a review from a team as a code owner February 27, 2025 19:39
Copy link

coderabbitai bot commented Feb 27, 2025

Walkthrough

This pull request updates the build function in two shell script templates used for Rust projects. Both scripts now invoke cargo build --tests --profile test instead of the original cargo build --verbose, which modifies the build behavior by compiling tests under a specified profile. The remaining structure and function logic of the scripts remains unchanged, and no public entities were altered.

Changes

File(s) Change Summary
src/main/resources/templates/aeolus/rust/default.sh
src/main/resources/templates/aeolus/rust/default_static.sh
Updated the build function to replace cargo build --verbose with cargo build --tests --profile test, altering build options.

Sequence Diagram(s)

sequenceDiagram
    participant S as Script
    participant B as Build Function
    participant C as Cargo Build Process

    S->>B: Invoke build function
    B->>C: Execute "cargo build --tests --profile test"
    C-->>B: Return build output
    B-->>S: Provide build results

Possibly related PRs

Suggested labels

buildagent, programming, tests

Suggested reviewers

  • JohannesStoehr
  • SimonEntholzer
  • coolchock

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fede0c3 and c8536af.

⛔ Files ignored due to path filters (3)
  • src/main/resources/config/application.yml is excluded by !**/*.yml
  • src/main/resources/templates/aeolus/rust/default.yaml is excluded by !**/*.yaml
  • src/main/resources/templates/aeolus/rust/default_static.yaml is excluded by !**/*.yaml
📒 Files selected for processing (2)
  • src/main/resources/templates/aeolus/rust/default.sh (1 hunks)
  • src/main/resources/templates/aeolus/rust/default_static.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
src/main/resources/templates/aeolus/rust/default_static.sh (1)

12-15: Updated Build Command - Verification of sccache Integration
The modified build function now invokes cargo build --tests --profile test instead of the previous verbose build, aligning with the objective of ensuring test builds compile under the test profile. Please verify that the Docker image (and its environment variables) correctly enable sccache so that caching of compiler artifacts is effective.

src/main/resources/templates/aeolus/rust/default.sh (1)

4-7: Consistent Build Command Update
The change to cargo build --tests --profile test in the build function ensures consistency with the static template and supports the compile caching approach. Confirm that compiling tests with the test profile is intentional and does not slow down production builds if test artifacts are not required.

✨ Finishing Touches
  • 📝 Generate Docstrings

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 generate docstrings to generate docstrings for this 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 or @coderabbitai title anywhere in the PR title to generate the title automatically.

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.

@helios-aet helios-aet bot temporarily deployed to artemis-test1.artemis.cit.tum.de March 7, 2025 11:35 Inactive
Copy link
Contributor

@coolchock coolchock left a comment

Choose a reason for hiding this comment

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

tested on ts1, works as expected and builds are faster due to cache

Copy link
Contributor

@dmytropolityka dmytropolityka left a comment

Choose a reason for hiding this comment

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

The second build was finished quickly, as described.

Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

code

Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config-change Pull requests that change the config in a way that they require a deployment via Ansible. ready for review template
Projects
Status: Ready For Review
Status: In review
Development

Successfully merging this pull request may close these issues.

5 participants