Commit 4e8eac96 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

Merge remote-tracking branch 'origin/master'

parents 07eb1daa b27b8efd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ stages:
  - prebuild
  - compile
  - test
  - extra
  - compete

include:
  - local: 'ci_cd/problem3.yml'
+80 −2
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ prebuild_problem_3b:
        exit 1;
      fi

    - git clone https://trachten-gitlab:${HW_INTERNAL}@agile.bu.edu/gitlab/ec330/ec330_staff/homeworks_internal/hw8_ec.git hw8_ec
    - git clone https://trachten-gitlab:${HW_INTERNAL_WRITE}@agile.bu.edu/gitlab/ec330/ec330_staff/homeworks_internal/hw8_ec.git hw8_ec

    - cp include/MyPlayer.h hw8_ec/Players/Student/include
    - cp impl/MyPlayer.cpp hw8_ec/Players/Student/impl/
@@ -39,7 +39,7 @@ compile_problem_3:
    - if: '$CI_COMMIT_REF_NAME == "problem3b"'
  tags: [c++-17]

test_opponents:
test_standard_opponents:
  stage: test
  needs:
    - job: compile_problem_3
@@ -84,3 +84,81 @@ test_opponents:
  parallel:
    matrix:
      - OPPO: ["Random", "Smarter", "Smartest"]

register_player:
  stage: compete
  needs:
    - job: test_standard_opponents
      artifacts: true
  script:
    - cd hw8_ec
    #
    # copy to the student directory
    - mkdir -p Players/${GITLAB_USER_LOGIN}/include
    - mkdir -p Players/${GITLAB_USER_LOGIN}/impl
    - cp Players/Student/include/MyPlayer.h Players/${GITLAB_USER_LOGIN}/include
    - cp Players/Student/impl/MyPlayer.cpp Players/${GITLAB_USER_LOGIN}/impl/
    #
    # upload to git repo
    - git config --global user.email "trachten@bu.edu"
    - git config --global user.name "Ari Trachtenberg"
    - git add Players/${GITLAB_USER_LOGIN}/include/MyPlayer.h
    - git add Players/${GITLAB_USER_LOGIN}/impl/MyPlayer.cpp
    - git commit -m "Adding player ${GITLAB_USER_LOGIN}"
    - git push
    #
    - echo "Player registered for ${GITLAB_USER_LOGIN}"
  artifacts:
    paths:
      - hw8_ec/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3"'
  tags: [c++-17]

test_all_opponents:
  stage: compete
  needs:
    - job: register_player
      artifacts: true
  script:
    - cd hw8_ec
    - |
      if [ $((RANDOM % 2)) -eq 0 ]; then
        STUDENT_COLOR="White"
        OPPO_COLOR="Black"
      else
        STUDENT_COLOR="Black"
        OPPO_COLOR="White"
      fi
      
      echo "YOU play: $STUDENT_COLOR"
      echo "$OPPO plays:  OPPO_COLOR"
    - ./loadOppo.sh "$OPPO" "$OPPO_COLOR"
    - make play
    - |
      # Run the program and capture exit status
      set +e
      ./play
      status=$?
      set -e
      
      case "$status:$STUDENT_COLOR" in
      1:White|2:Black)
      echo "You win!"
      curl "https://agile.bu.edu/ec330_scripts/chessScores.pl?key=${MAGIC_KEY}&name=${GITLAB_USER_LOGIN}&result=1"
      ;;
      *)
      echo "You lost :-("
      curl "https://agile.bu.edu/ec330_scripts/chessScores.pl?key=${MAGIC_KEY}&name=${GITLAB_USER_LOGIN}&result=1"
      ;;
      esac
  allow_failure: true
  artifacts:
    paths:
      - hw8_ec/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3"'
  tags: [c++-17]
  parallel:
    matrix:
      - OPPO: ["AbAlmasri", "AndrewAmona", "AnthonyAparicio", "PeterCarr", "SusanChen", "EthanChin", "YechanCho", "MitchellFreitas", "DavidGao", "PranayaGovindaraj", "AliceHope", "ParthKheni", "LoganKidd", "AryanKumar", "AustinLi", "CalvinLi", "JasmineLi", "JavinLi", "ShiqiLin", "QuanLy", "AdamMhal", "JoonseoMoon", "ChiNguyen", "JoeNguyen", "NidhiPrasad", "SophiaPutermanGhitelman", "PratiushRegmi", "JohnRossi", "LaytonSahler", "EthanShan", "DylanSheehan", "CalvinSilver", "KristaSmith", "MathisSouefMyers", "JacquelineTran", "MaxWang", "TimothyWright", "EricYang", "JacobYen", "OwenZhang", "BrianZhao", "Ec330Student"]
 No newline at end of file