Commit 9b067c95 authored by XingyuChen's avatar XingyuChen
Browse files

implement autograder

parent e13cb800
Loading
Loading
Loading
Loading

ci_cd/.gitlab-ci.yml

0 → 100644
+13 −0
Original line number Diff line number Diff line
stages:
  - prebuild
  - compile
  - test
  - extra

include:
  - local: 'ci_cd/problem3a.yml'
  - local: 'ci_cd/problem3b.yml'
  - local: 'ci_cd/problem3c.yml'

default:
  timeout: 5m

ci_cd/problem3a.yml

0 → 100644
+59 −0
Original line number Diff line number Diff line
prebuild_problem_3a:
  stage: prebuild
  script:
    - |
      # Check if source files exist
      if [ ! -f "impl/Device.cpp" ]; then
        echo "Device.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/Password.cpp" ]; then
        echo "Password.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/Service.cpp" ]; then
        echo "Service.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/System.cpp" ]; then
        echo "System.cpp does not exist under impl directory";
        exit 1;
      fi
    - git clone https://agile.bu.edu/gitlab/configs/ec330/homeworks/homeworkfive.git hw5
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3a"'
  tags: [c++-17]

compile_problem_3a:
  stage: compile
  needs:
    - job: prebuild_problem_3a
      artifacts: true
  script:
    - cp impl/*.cpp hw5/tests/impl
    - cd hw5/tests
    - make problem3a
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3a"'
  tags: [c++-17]

exec_problem_3a:
  stage: test
  needs:
    - job: compile_problem_3a
      artifacts: true
  script:
    - cd hw5/tests
    - ./problem3a
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3a"'
  tags: [c++-17]
 No newline at end of file

ci_cd/problem3b.yml

0 → 100644
+63 −0
Original line number Diff line number Diff line
prebuild_problem_3b:
  stage: prebuild
  script:
    - |
      # Check if source files exist
      if [ ! -f "impl/Device.cpp" ]; then
        echo "Device.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/Password.cpp" ]; then
        echo "Password.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/Service.cpp" ]; then
        echo "Service.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/System.cpp" ]; then
        echo "System.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/MakeSecure.cpp" ]; then
        echo "MakeSecure.cpp does not exist under impl directory";
        exit 1;
      fi
    - git clone https://agile.bu.edu/gitlab/configs/ec330/homeworks/homeworkfive.git hw5
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3b"'
  tags: [c++-17]

compile_problem_3b:
  stage: compile
  needs:
    - job: prebuild_problem_3b
      artifacts: true
  script:
    - cp impl/*.cpp hw5/tests/impl
    - cd hw5/tests
    - make problem3b
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3b"'
  tags: [c++-17]

exec_problem_3b:
  stage: test
  needs:
    - job: compile_problem_3b
      artifacts: true
  script:
    - cd hw5/tests
    - ./problem3b
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3b"'
  tags: [c++-17]
 No newline at end of file

ci_cd/problem3c.yml

0 → 100644
+63 −0
Original line number Diff line number Diff line
prebuild_problem_3c:
  stage: prebuild
  script:
    - |
      # Check if source files exist
      if [ ! -f "impl/Device.cpp" ]; then
        echo "Device.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/Password.cpp" ]; then
        echo "Password.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/Service.cpp" ]; then
        echo "Service.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/System.cpp" ]; then
        echo "System.cpp does not exist under impl directory";
        exit 1;
      fi
      if [ ! -f "impl/MakeSecure.cpp" ]; then
        echo "MakeSecure.cpp does not exist under impl directory";
        exit 1;
      fi
    - git clone https://agile.bu.edu/gitlab/configs/ec330/homeworks/homeworkfive.git hw5
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3c"'
  tags: [c++-17]

compile_problem_3c:
  stage: compile
  needs:
    - job: prebuild_problem_3c
      artifacts: true
  script:
    - cp impl/*.cpp hw5/tests/impl
    - cd hw5/tests
    - make problem3c
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3c"'
  tags: [c++-17]

exec_problem_3c:
  stage: test
  needs:
    - job: compile_problem_3c
      artifacts: true
  script:
    - cd hw5/tests
    - ./problem3c
  artifacts:
    paths:
      - hw5/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3c"'
  tags: [c++-17]
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -4,11 +4,17 @@

#ifndef HW5_ADMIN_SYSTEM_H
#define HW5_ADMIN_SYSTEM_H

#include <map>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <string>

#include "Service.h"

using namespace std;

/**
 * Represents a system of devices and their servicess.
 */
Loading