Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 44 additions & 21 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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