Commit a01a6152 authored by Federico Falconieri's avatar Federico Falconieri
Browse files

Merge branch 'pip' into 'main'

feat: (extra) args for user package pip install

See merge request just-ci/templates!103
parents 838175b1 f7fe20cf
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
---
include:
  - local: c/generic.yml

variables:
  CPPCHECK_DEFAULT_ARGS: --report-progress --verbose
  CPPCHECK_EXTRA_ARGS: ""
  CPPCHECK_ENABLE: all
  CPPCHECK_EXIT_CODE: 1

c:cppcheck:
  stage: test
  image: registry.gitlab.com/just-ci/images/c:latest
  extends: .c:pre
  variables:
    CHECK_PATH: "." # Can be a file
    DEFAULT_ARGS: "--report-progress --verbose"
    EXTRA_ARGS: ""
    ENABLE: "all"
    ERROR_EXIT_CODE: 1 # Which exit code on failure
    JOB_PACKAGE: cppcheck-junit
  script:
    - cppcheck --xml-version=2 ${DEFAULT_ARGS} ${EXTRA_ARGS} --enable=${ENABLE}
      --error-exitcode=0 ${CHECK_PATH} 2> cppcheck-result.xml
    - cppcheck_junit cppcheck-result.xml cppcheck-junit.xml
    - cppcheck ${EXTRA_ARGS} --enable=${ENABLE}
      --error-exitcode=${ERROR_EXIT_CODE} ${CHECK_PATH}
    - !reference [".c:pre", script]
    - cppcheck --xml-version=2 ${CPPCHECK_DEFAULT_ARGS} ${CPPCHECK_EXTRA_ARGS}
      --enable=${CPPCHECK_ENABLE} --error-exitcode=${CPPCHECK_EXIT_CODE} . 2>
      ${CI_PROJECT_DIR}/cppcheck-result.xml
  after_script:
    - cppcheck_junit ${CI_PROJECT_DIR}/cppcheck-result.xml
      ${CI_PROJECT_DIR}/cppcheck-junit.xml
  needs: []
  artifacts:
    reports:
      junit: cppcheck-junit.xml
    when: always

c/flawfinder.yml

0 → 100644
+19 −0
Original line number Diff line number Diff line
---
# https://dwheeler.com/flawfinder/
include:
  - local: c/generic.yml

variables:
  FLAWFINDER_ERROR_LEVEL: "3"
  FLAWFINDER_MIN_LEVEL: "1"
  FLAWFINDER_DEFAULT_ARGS: --falsepositive --immediate --context
  FLAWFINDER_EXTRA_ARGS: ""

c:flawfinder:
  extends: .c:pre
  variables:
    JOB_PACKAGE: flawfinder
  script:
    - !reference [".c:pre", script]
    - flawfinder ${FLAWFINDER_DEFAULT_ARGS} ${FLAWFINDER_EXTRA_ARGS} --minlevel
      ${FLAWFINDER_MIN_LEVEL} --error-level=${FLAWFINDER_ERROR_LEVEL} .

c/generic.yml

0 → 100644
+19 −0
Original line number Diff line number Diff line
---
variables:
  C_EXCLUDE_PATHS: tests
  C_EXCLUDE_REGEX: (tests)

.c:pre:
  image:
    name: registry.gitlab.com/just-ci/images/c:latest
    entrypoint: [""]
  stage: test
  script:
    - pip3 install -q ${JOB_PACKAGE} && echo "[+] ${JOB_PACKAGE} successfully
      installed."
    - |
      echo "[*] Job info:"
      echo "Context path: ${C_CONTEXT:=.}"
      echo "Excluded paths: ${C_EXCLUDE_PATHS:-(not specified)}"
      echo "Excluded regex: ${C_EXCLUDE_REGEX:-(not specified)}"
    - cd ${C_CONTEXT}
+1 −5
Original line number Diff line number Diff line
---
include:
  - local: project-automation/workflow.yml
  - local: python/flawfinder.yml
  - local: c/flawfinder.yml
  - local: c/cppcheck.yml

variables:
  FLAWFINDER_ERROR_LEVEL: "3"
  DIRECTORIES: "."
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ variables:
python:bandit:
  extends: .python:pre
  variables:
    PACKAGE: bandit
    JOB_PACKAGE: bandit
  script:
    - !reference [".python:pre", script]
    - BANDIT_EXCLUDE_PATHS="./$(echo ${PYTHON_EXCLUDE_PATHS} | sed
Loading