Commit eb06a0b0 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

reorganization of ci/cd stages

parent 4d5d7beb
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
stages:
  - prebuild
  - compile
  - lint
  - test
  - labm1
  - lab0
  - lab1

#stages:
#  - prebuild
#  - compile
#  - lint
#  - test

include:
  - local: 'ci_cd/labm1.yml'   # Lab -1
+7 −19
Original line number Diff line number Diff line
stages:
  - prebuild
  - compile
  - lint
  - test

.only_run_if_lab0_available: &common_rules_0
  rules:
    - changes:
      - lab0.cpp

### Lab 0
prebuild_lab_0:
  stage: prebuild
  <<: *common_rules_0
  stage: lab0
  script:
    - git clone https://agile.bu.edu/gitlab/configs/ec327/lab-configs/current.git base_0
  when: on_success # only runs if the previous stage succeeds
@@ -20,11 +8,13 @@ prebuild_lab_0:
    paths:
      - base_0
      - lab0.cpp
  rules:
    - changes:
        - lab0.cpp
  tags: [c++-17]

compile_lab_0:
  stage: compile
  <<: *common_rules_0
  stage: lab0
  script:
    - echo "Compiling lab0.cpp"
    - g++ -c lab0.cpp
@@ -36,8 +26,7 @@ compile_lab_0:
  tags: [c++-17]

lint_lab_0:
  stage: lint
  <<: *common_rules_0
  stage: lab0
  script:
    - echo "Static code check of lab0.cpp"
    - cppcheck --check-config --enable=all --inconclusive --error-exitcode=1 lab0.cpp tests/LabZero.cpp
@@ -50,8 +39,7 @@ lint_lab_0:
  tags: [cppcheck]

test_lab_0:
  stage: test
  <<: *common_rules_0
  stage: lab0
  script:
    - echo "Testing Lab 0";
    - cp lab0.o base_0/tests
+7 −19
Original line number Diff line number Diff line
stages:
  - prebuild
  - compile
  - lint
  - test

.only_run_if_lab1_available: &common_rules_1
  rules:
    - changes:
        - lab1.cpp

### Lab 1
prebuild_lab_1:
  stage: prebuild
  <<: *common_rules_1
  stage: lab1
  script:
    - git clone https://agile.bu.edu/gitlab/configs/ec327/lab-configs/current.git base_1
  when: on_success # only runs if the previous stage succeeds
@@ -20,11 +8,13 @@ prebuild_lab_1:
    paths:
      - base_1
      - lab1.cpp
  rules:
    - changes:
        - lab1.cpp
  tags: [c++-17]

compile_lab_1:
  stage: compile
  <<: *common_rules_1
  stage: lab1
  script:
    - echo "Compiling lab1.cpp"
    - g++ -c lab1.cpp
@@ -36,8 +26,7 @@ compile_lab_1:
  tags: [c++-17]

lint_lab_1:
  stage: lint
  <<: *common_rules_1
  stage: lab1
  script:
    - echo "Static code check of lab1.cpp"
    - cppcheck --check-config --enable=all --inconclusive --error-exitcode=1 lab1.cpp tests/LabOne.cpp
@@ -50,8 +39,7 @@ lint_lab_1:
  tags: [cppcheck]

test_lab_1:
  stage: test
  <<: *common_rules_1
  stage: lab1
  script:
    - echo "Testing Lab 1";
    - cp lab1.o base_1/tests
+7 −18
Original line number Diff line number Diff line
stages:
  - prebuild
  - compile
  - lint
  - test

.only_run_if_lab-1_available: &common_rules_m1
  rules:
    - changes:
      - lab-1.cpp

### Lab -1
prebuild_lab_m1:
  stage: prebuild
  <<: *common_rules_m1
  stage: labm1
  script:
    - |
      if [ ! -f 'lab-1.cpp' ]; then
        echo "ERROR - could not find file lab-1.cpp";
        exit 1;
      fi
  rules:
    - changes:
        - lab-1.cpp
  tags: [shell]

compile_lab_m1:
  stage: compile
  <<: *common_rules_m1
  stage: labm1
  script:
    - echo "Compiling lab-1.cpp"
    - g++ -c lab-1.cpp
@@ -31,8 +21,7 @@ compile_lab_m1:
  tags: [c++-17]

lint_lab_m1:
  stage: lint
  <<: *common_rules_m1
  stage: labm1
  script:
      - echo "Static code check of lab-1.cpp"
      - cppcheck --enable=all --inconclusive --error-exitcode=1 lab-1.cpp
@@ -42,7 +31,7 @@ lint_lab_m1:

# don't run the test in the master branch
test_lab_m1:
  stage: test
  stage: labm1
  rules:
    - if: '$CI_COMMIT_BRANCH != "master" && $CI_COMMIT_TAG == null'
  script: