diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8bcaf12e9c5086dbbb8a194689d8964f2b20ff74..066904d7dd073fc48485db1316d54d449652a65f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,11 +13,14 @@ variables: ##### ##### PLAYBOOK_NAME_FOR_ROLE_TEST: "playbook_example_01_test.yml" + PLAYBOOK_NAME_FOR_ROLE_DEPENDENCIES: "playbook_example_02_dependencies.yml" + PLAYBOOK_NAME_FOR_ROLE_CLONE_REPOSITORIES: "playbook_example_03_clone_repositories.yml" stages: - debug - build - test + - lint-tests - docs - deploy @@ -44,77 +47,31 @@ build: ### TESTS ### ansible-lint-test: - stage: test + stage: lint-tests before_script: - # - apt-get update && apt-get install -y python3-pip libcups2-dev && apt-get clean && rm -rf /var/lib/apt/lists/* - apt-get update && apt-get install -y python3-pip && apt-get clean && rm -rf /var/lib/apt/lists/* - # - pip3 install -r ci-cd/requirements.txt - pip3 install -r requirements.txt script: - echo "Running ansible-lint tests at the role-> 'test'" - # - pycodestyle -v --config=./src/pycodestyle.cfg src/ - # - ansible-lint playbook_example_01_dependencies.yml - ansible-lint $PLAYBOOK_NAME_FOR_ROLE_TEST allow_failure: false -# pylint: -# stage: test -# before_script: -# - apt-get update && apt-get install -y python3-pip libcups2-dev && apt-get clean && rm -rf /var/lib/apt/lists/* -# - pip3 install -r ci-cd/requirements.txt -# script: -# - echo "Running pylint tests..." -# ### Fix pylint 'import-error' --> hardcode init-hook on .pylintrc :( -# - cat .pylintrc | grep init-hook -# - rm .pylintrc -# - cp ci-cd/.pylintrc . -# - cat .pylintrc | grep init-hook -# ### RUN -# - pylint src/ -# allow_failure: false - -# unit-tests: -# stage: test -# before_script: -# - apt-get update && apt-get install -y python3-pip libcups2-dev && apt-get clean && rm -rf /var/lib/apt/lists/* -# - pip3 install -r ci-cd/requirements.txt -# script: -# - echo "Running pep8 tests..." -# - python3 -m pytest -# allow_failure: false - -# ### -# ### DOCS -# ### -# sphinx-docs: -# stage: docs -# before_script: -# - pip3 install sphinx sphinx-rtd-theme -# script: -# - echo "Running sphinx-docs..." -# - mkdir -vp $DOC_PATH_TMP -# - cd $DOC_PATH_TMP -# - sphinx-quickstart -p '$DOC_NAME' -a '$DOC_AUTHOR' -v '$DOC_VERSION' -l '$DOC_LANGUAGE' -q -# - cd .. -# - sphinx-apidoc -o $DOC_PATH_TMP . -# - cd $DOC_PATH_TMP -# - make html -# artifacts: -# paths: -# - $DOC_PATH_TMP/* -# # expire_in: '$DOC_RETENTION' # <--- DON'T WORK :( -# expire_in: 1 day -# allow_failure: false -# only: -# - main +ansible-lint-dependencies: + stage: lint-tests + before_script: + - apt-get update && apt-get install -y python3-pip && apt-get clean && rm -rf /var/lib/apt/lists/* + - pip3 install -r requirements.txt + script: + - echo "Running ansible-lint tests at the role-> 'dependencies'" + - ansible-lint $PLAYBOOK_NAME_FOR_ROLE_DEPENDENCIES + allow_failure: false -# ### -# ### DEPLOY -# ### -# deploy: -# stage: deploy -# script: -# - echo "Deploying the application..." -# - echo "TODO --> where to deploy this?" -# only: -# - main +ansible-lint-clone-repositories: + stage: lint-tests + before_script: + - apt-get update && apt-get install -y python3-pip && apt-get clean && rm -rf /var/lib/apt/lists/* + - pip3 install -r requirements.txt + script: + - echo "Running ansible-lint tests at the role-> 'clone_repositories'" + - ansible-lint $PLAYBOOK_NAME_FOR_ROLE_CLONE_REPOSITORIES + allow_failure: false