Skip to content
Snippets Groups Projects
Forked from Configs / EC327 / Labs / Current
165 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
labm1.yml 1.14 KiB
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
  script:
    - |
      if [ ! -f 'lab-1.cpp' ]; then
        echo "ERROR - could not find file lab-1.cpp";
        exit 1;
      fi
  tags: [shell]

compile_lab_m1:
  stage: compile
  <<: *common_rules_m1
  script:
    - echo "Compiling lab-1.cpp"
    - g++ -c lab-1.cpp
  needs: [prebuild_lab_m1]
  tags: [c++-17]

lint_lab_m1:
  stage: lint
  <<: *common_rules_m1
  script:
      - echo "Static code check of lab-1.cpp"
      - cppcheck --enable=all --inconclusive --error-exitcode=1 lab-1.cpp
  allow_failure: false
  needs: [compile_lab_m1]
  tags: [cppcheck]

# don't run the test in the master branch
test_lab_m1:
  stage: test
  rules:
    - if: '$CI_COMMIT_BRANCH != "master" && $CI_COMMIT_TAG == null'
  script:
    - echo "Testing Lab -1";
    - |
      if ! grep -q "$GITLAB_USER_LOGIN" lab-1.cpp; then
        echo "Could not find your WikiName $GITLAB_USER_LOGIN in file lab-1.cpp";
        exit 1;
      fi
  needs: [lint_lab_m1]
  tags: [shell]