diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..6033b8ed8b805e35e27ba689b4748d6c83c7b897 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,119 @@ +# image: python:3.10.15-bullseye +image: ansible:latest + +variables: + TEST_VAR_BUILD: "Building the application..." + DOC_PATH_TMP: tmp_docs + DOC_NAME: c3InfoDesk Printing + DOC_AUTHOR: fejao + DOC_VERSION: 1.0.0 + DOC_LANGUAGE: english + # DOC_RETENTION: 1 day # <--- DON'T WORK :( + ##### + ##### + ##### + PLAYBOOK_NAME_FOR_ROLE_TEST: "playbook_example_01_test.yml" + +stages: + - debug + - build + - test + - docs + - deploy + +### +### DEBUG +### +runner-debug: + stage: debug + script: + - echo "Testing local gitlab-runner config..." + - echo $PWD + - echo "list local folder..." + - ls -hal + +### +### BUILD +### +build: + stage: build + script: + - echo "Here should be the images build and pushed" + +### +### TESTS +### +ansible-lint-test: + 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 + - 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 + +# ### +# ### DEPLOY +# ### +# deploy: +# stage: deploy +# script: +# - echo "Deploying the application..." +# - echo "TODO --> where to deploy this?" +# only: +# - main