From eb06a0b0e72fac030bfbedd13765c0ea58edc5f9 Mon Sep 17 00:00:00 2001 From: Ari Trachtenberg Date: Thu, 12 Sep 2024 17:16:32 -0400 Subject: [PATCH] reorganization of ci/cd stages --- ci_cd/.gitlab-ci.yml | 13 +++++++++---- ci_cd/lab0.yml | 26 +++++++------------------- ci_cd/lab1.yml | 26 +++++++------------------- ci_cd/labm1.yml | 25 +++++++------------------ 4 files changed, 30 insertions(+), 60 deletions(-) diff --git a/ci_cd/.gitlab-ci.yml b/ci_cd/.gitlab-ci.yml index 1d1166c..08a63b3 100644 --- a/ci_cd/.gitlab-ci.yml +++ b/ci_cd/.gitlab-ci.yml @@ -1,8 +1,13 @@ stages: - - prebuild - - compile - - lint - - test + - labm1 + - lab0 + - lab1 + +#stages: +# - prebuild +# - compile +# - lint +# - test include: - local: 'ci_cd/labm1.yml' # Lab -1 diff --git a/ci_cd/lab0.yml b/ci_cd/lab0.yml index 0e3d46d..12c4403 100644 --- a/ci_cd/lab0.yml +++ b/ci_cd/lab0.yml @@ -1,18 +1,6 @@ -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 diff --git a/ci_cd/lab1.yml b/ci_cd/lab1.yml index c33dced..a380d0a 100644 --- a/ci_cd/lab1.yml +++ b/ci_cd/lab1.yml @@ -1,18 +1,6 @@ -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 diff --git a/ci_cd/labm1.yml b/ci_cd/labm1.yml index 821ba43..fb7e3f8 100644 --- a/ci_cd/labm1.yml +++ b/ci_cd/labm1.yml @@ -1,29 +1,19 @@ -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: -- GitLab