Commit 30ea6cc2 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

Merge remote-tracking branch 'origin/master'

parents d0245f7a 627c97ab
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ stages:
  - lab0
  - lab1
  - lab2
  - lab3
  - tests

include:
@@ -10,3 +11,4 @@ include:
  - local: 'ci_cd/lab0.yml'    # Lab 0
  - local: 'ci_cd/lab1.yml'    # Lab 1
  - local: 'ci_cd/lab2.yml'    # Lab 2
  - local: 'ci_cd/lab3.yml'    # Lab 3
 No newline at end of file
+4 −6
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ prebuild_lab_2:
  script:
    - echo "Changes Detected (if any):";
    - git diff --name-only $CI_COMMIT_SHA~ $CI_COMMIT_SHA || echo "No changes found";
    - FILES_ADDED=$(git diff --name-only --diff-filter=A HEAD~1 | wc -l)
    - |
      # Check if lab2.cpp exists
      if [ ! -f "lab2.cpp" ]; then
@@ -11,12 +12,9 @@ prebuild_lab_2:
        exit 1;
      fi
      
      # Check if lab0.cpp has been merged into master
      git fetch origin master  # Fetch the latest master branch
      if git ls-tree -r origin/master --name-only | grep -q 'lab0.cpp'; then
        echo "Lab 0 complete";
      else
        echo "Please have lab 0 merged first";
      # Check that only one file was checked in
      if [ "FILES_ADDED" -ne 1 ]; then
        echo "Error: Only one file should be committed.";
        exit 1;
      fi

ci_cd/lab3.yml

0 → 100644
+98 −0
Original line number Diff line number Diff line
### Lab 3
prebuild_lab_3:
  stage: lab3
  script:
    - echo "Changes Detected (if any):";
    - git diff --name-only $CI_COMMIT_SHA~ $CI_COMMIT_SHA || echo "No changes found";
    - FILES_ADDED=$(git diff --name-only --diff-filter=A HEAD~1 | wc -l)
    - |
    
      # Check if lab3.cpp exists
      if [ ! -f "lab3.cpp" ]; then
        echo "lab3.cpp does not exist";
        exit 1;
      fi

      # Check that only one file was checked in
      if [ "FILES_ADDED" -ne 1 ]; then
        echo "Error: Only one file should be committed.";
        exit 1;
      fi
      
      # Check if lab2.cpp has been merged into master
      if git ls-tree -r origin/master --name-only | grep -q 'lab2.cpp'; then
        echo "Lab 2 complete";
      else
        echo "Please have lab 2 merged first";
        exit 1;
      fi
    - git clone https://agile.bu.edu/gitlab/configs/ec327/lab-configs/current.git base_3
  artifacts:
    paths:
      - base_3
  rules:
    - if: '$CI_COMMIT_REF_NAME == "lab3"'
  tags: [c++-17]

prebuild_lab_3_SKIP:
  stage: lab3
  script:
    - echo "SKIPPING Lab 3 checks because the branch name is not 'lab3'"
  rules:
    - if: '$CI_COMMIT_REF_NAME != "lab3"'
  tags: [c++-17]

compile_lab_3:
  stage: lab3
  script:
    - echo "Compiling lab3.cpp"
    - g++ -c lab3.cpp
  artifacts:
    paths:
      - base_3
  dependencies:
    - prebuild_lab_3
  rules:
    - if: '$CI_COMMIT_REF_NAME == "lab3"'
  tags: [c++-17]

lint_lab_3:
  stage: lab3
  script:
    - echo "Static code check of lab3.cpp"
    - cppcheck --check-config --enable=all --inconclusive --error-exitcode=1 lab3.cpp tests/LabTwo.cpp
  allow_failure: false
  artifacts:
    paths:
      - base_3
  dependencies:
    - prebuild_lab_3
  rules:
    - if: '$CI_COMMIT_REF_NAME == "lab3"'
  tags: [cppcheck]

test_lab_3:
  stage: lab3
  script:
    - echo "Testing Lab 3";
    - git clone https://agile.bu.edu/gitlab/configs/ec327/lab-configs/current.git base_3
    - cp lab3.cpp base_3/tests
    - cd base_3/tests
    - make lab3
  dependencies:
    - compile_lab_3
  rules:
    - if: '$CI_COMMIT_REF_NAME == "lab3"'
  tags: [c++-17]

## trigger internal tests only upon a merge request into master
#internal_tests_lab_3:
#  stage: tests
#  script:
#    - git clone https://trachten-gitlab:$INTERNAL_LAB_TESTS@agile.bu.edu/gitlab/ec337/ec337-staff/lab-tests.git
#    - cp -f lab3.cpp lab-tests/internal_tests/
#    - cd lab-tests/internal_tests
#    - make lab3
#  rules:
#    - if: '$CI_COMMIT_REF_NAME == "lab3" && $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
#  tags: [ c++-17 ]
+3 −3
Original line number Diff line number Diff line
@@ -23,7 +23,9 @@ using namespace std;
 * Then student.getAverageScore() should return 80, the average of 100, 70, and 70.
 */
// please provide the implementation in your cpp file
class labThree_pTwo;
class labThree_pTwo {

};


/**
@@ -52,8 +54,6 @@ class labThree_pTwo;
 * person2.getFriendsOfFriends() - returns "Jane, Bob"
 *
 */

// PLEASE PROVIDE ONLY THE IMPLEMENTATION in your solution
class labThree_pThree {
public:
    labThree_pThree(char *name);
+14 −5
Original line number Diff line number Diff line
@@ -8,8 +8,7 @@
#include <string>
#include <cstring>

#include "../problems/labThree_ChapterEight.h"
#include "../problems/labThree_ChapterNine.h"
#include "lab3.cpp"

using namespace std;

@@ -44,7 +43,15 @@ bool test_labThree_pOne() {
}

bool test_labThree_pTwo() {
    // no easy way to test this, since it is a class declaration
  labThree_pTwo student("Jack Daniels");
  student.addQuizScore(100);
  student.addQuizScore(70);
  student.addQuizScore(70);

  if (student.getAverageScore()!=80) {
    cout << "Test 2a failed" << endl;
    return false;
  }

    // All tests passed
    return true;
@@ -78,7 +85,7 @@ bool test_labThree_pThree() {
        return false;
    }

    string result2 = person1.getFriends();
    string result2 = person2.getFriends();
    if (result2.find("Jim")==string::npos || result2.length()!=3) {
        cout << "Test 3e failed" << endl;
        return false;
@@ -90,7 +97,7 @@ bool test_labThree_pThree() {
        return false;
    }

    string result4 = person1.getFriendsOfFriends();
    string result4 = person2.getFriendsOfFriends();
    if (result4.find("Jane")==string::npos || result4.find("Bob")==string::npos) {
        cout << "Test 3g failed" << endl;
        return false;
@@ -107,6 +114,8 @@ int main() {
    bool t2 = test_labThree_pTwo();
    bool t3 = test_labThree_pThree();

    cout << endl << endl << endl;

    cout << "pZero: " << (t0 ? "passed" : "failed") << endl;
    cout << "pOne: " << (t1 ? "passed" : "failed") << endl;
    cout << "pTwo: " << (t2 ? "passed" : "failed") << endl;
Loading