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 Rust programming template #8802

Merged
merged 71 commits into from
Aug 26, 2024

Conversation

magaupp
Copy link
Contributor

@magaupp magaupp commented Jun 16, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server coding and design guidelines.

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 locally with Gitlab and Jenkins.
  • I tested all changes and their related features with all corresponding user types on a test server configured with Gitlab and GitLab CI.

Motivation and Context

Description

This PR adds a programming language template for Rust.

The template runs standard cargo tests using the cargo-nextest runner for JUnit output.

In the server code Rust is added to the ProgrammingLanguage enum and its switch statements.

The template exercise example is the Strategy Pattern exercise as used in Java, Python and Swift.
Rust's reference rules and the long lived references of OOP patterns do not combine well. To not over-complicate the implementation, I moved the dates member of Context to the respective method parameters with shorter lifetimes.

For testing code to be able to query the runtime type of trait objects (Box<dyn SortStrategy>) the trait needs to have Any as a supertrait.
Because Rust has no reflection, structural tests are implemented by parsing the source code files.

Steps for Testing

Prerequisites:

  • Rust development tools installed
  • 1 Instructor
  • 1 Course
  • 1 Student

High-Level Instructions

  1. Create a Rust Programming Exercise
  2. Run the Cargo Test Suite locally
  3. Add your own tasks
  4. Solve the exercise as a Student

Setup

  1. Log in as Instructor to Artemis
  2. Navigate to Course Administration
  3. Create a new Programming Exercise
  4. Select Rust as the programming language
  5. Fill out the required fields and click on Generate
  6. The Template Result should build and fail with 13 test cases
  7. The Solution Result should build and pass with 13 test cases

Local Test

  1. Clone the Test Repository into test/
  2. Clone the Solution Repository into test/assignment/
  3. Enter the test/ directory
  4. Run cargo test
  5. The test should pass

Exercise Participation

  1. Log in as a Student
  2. Navigate to the exercise
  3. Start the exercise
  4. Solve the exercise incorrectly
  5. The tests should fail
  6. Solve the exercise correctly
  7. The tests should pass

Cleanup

  1. Log in as an Instructor
  2. Delete the exercise

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for the Rust programming language across various services and configurations.
    • Implemented build and test scripts for Rust projects in Jenkins and GitLab CI.
    • Developed structured sorting algorithms using the Strategy Pattern in Rust.
    • Introduced new files for Rust exercises and testing, including sorting algorithms and utility functions.
  • Documentation

    • Updated documentation to clarify capabilities of programming exercise templates with Rust support.

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) config-change Pull requests that change the config in a way that they require a deployment via Ansible. template labels Jun 16, 2024
@magaupp magaupp added the stacked-pr PR that depends on another PR label Jun 16, 2024
@magaupp magaupp changed the base branch from develop to chore/programming-exercises/allow-all-template-filenames June 16, 2024 20:57
coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 17, 2024
@magaupp magaupp requested a review from b-fein August 22, 2024 09:36
Copy link
Contributor

@b-fein b-fein left a comment

Choose a reason for hiding this comment

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

👍 for code and manual test in Jenkins setup.

Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

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

Reapprove Artemis 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.

Tested on Ts3 and works

Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

LGTM on TS3

@krusche krusche added this to the 7.5.1 milestone Aug 26, 2024
@krusche krusche merged commit f055750 into develop Aug 26, 2024
39 of 44 checks passed
@krusche krusche deleted the feature/programming-exercises/rust-template branch August 26, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) config-change Pull requests that change the config in a way that they require a deployment via Ansible. documentation ready to merge server Pull requests that update Java code. (Added Automatically!) template tests
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants