diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2933a67..9c46f1b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,31 +4,54 @@ variables: PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" cache: + key: "${CI_JOB_NAME}" paths: - .cache/pip + - .venv -test: +stages: + - quality + - tests + +.install-deps-template: &install-deps before_script: - - python -V - - curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python - - source $HOME/.poetry/env && poetry install - - script: - - poetry run pytest --cov-report term --cov=lambda_layer_whitelisting tests/ - -create_badge_svg: - stage: build - image: python:3.6.6 - tags: - - docker - script: - - echo "Python other dependencies installation" - after_script: - - pip install anybadge - - commits=$(git rev-list --all --count) - - anybadge -l commits -v $commits -f commits.svg -c green + - pip install poetry + - poetry --version + - poetry config --local virtualenvs.in-project true + - poetry install -vv + +.quality-template: &quality + <<: *install-deps + image: python:3.6 + stage: quality + +.test-script: &test-script + - python -V + - poetry run pytest --cov-report term --cov=lambda_layer_whitelisting tests/ + +.test-template: &test + <<: *install-deps + stage: tests + coverage: '/TOTAL.*\s(\d+\.\d+\%)/' + script: *test-script artifacts: paths: - - commits.svg + - tests/logs when: always - expire_in: 4 weeks + expire_in: 1 week + +# Quality jobs ---------------------- +# TODO: black/lint code on task -> feature merge request + +# Tests jobs ------------------------ +python3.6: + <<: *test + image: python:3.6 + +python3.7: + <<: *test + image: python:3.7 + +python3.8: + <<: *test + image: python:3.8