From 93993991de1b05b5a36acbf5c2a0cca19dc82f69 Mon Sep 17 00:00:00 2001 From: Karl Dagenais Date: Sun, 12 Apr 2020 09:55:41 -0400 Subject: [PATCH 1/4] PR pipe test --- .gitlab-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2933a67..9ae9960 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,13 +8,14 @@ cache: - .cache/pip test: - before_script: + stage: test + 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/ + rules: + - if: $CI_MERGE_REQUEST_ID create_badge_svg: stage: build From 37d3ab2db63ad396377cba2d373f803765ee30d8 Mon Sep 17 00:00:00 2001 From: Karl Dagenais Date: Sun, 12 Apr 2020 12:34:26 -0400 Subject: [PATCH 2/4] wip --- .gitlab-ci.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ae9960..98c7062 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,21 +15,4 @@ test: - source $HOME/.poetry/env && poetry install - poetry run pytest --cov-report term --cov=lambda_layer_whitelisting tests/ rules: - - if: $CI_MERGE_REQUEST_ID - -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 - artifacts: - paths: - - commits.svg - when: always - expire_in: 4 weeks + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'develop' \ No newline at end of file From 56c3c301a56d843f51ca34b34658539598cb04d2 Mon Sep 17 00:00:00 2001 From: Karl Dagenais Date: Sun, 12 Apr 2020 12:43:45 -0400 Subject: [PATCH 3/4] wip --- .gitlab-ci.yml | 81 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98c7062..a448c96 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,15 +4,78 @@ variables: PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" cache: + key: "${CI_JOB_NAME}" paths: - .cache/pip + - .venv -test: - stage: test - script: - - python -V - - curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python - - source $HOME/.poetry/env && poetry install - - poetry run pytest --cov-report term --cov=lambda_layer_whitelisting tests/ - rules: - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'develop' \ No newline at end of file +stages: + - quality + - tests + +.install-deps-template: &install-deps + before_script: + - pip install poetry + - poetry --version + - poetry config settings.virtualenvs.in-project true + - poetry install -vv + +.quality-template: &quality + <<: *install-deps + image: python:3.6 + stage: quality + +.test-template: &test + <<: *install-deps + stage: tests + coverage: '/TOTAL.*\s(\d+\.\d+\%)/' + script: make test + artifacts: + paths: + - tests/logs + when: always + expire_in: 1 week + +# Quality jobs ---------------------- +check-bandit: + <<: *quality + script: make check-bandit + +check-black: + <<: *quality + script: make check-black + +check-flake8: + <<: *quality + script: make check-flake8 + +check-isort: + <<: *quality + script: make check-isort + +check-safety: + <<: *quality + script: make check-safety + +# Tests jobs ------------------------ +python3.6: + <<: *test + image: python:3.6 + +python3.7: + <<: *test + image: python:3.7 + +python3.8: + <<: *test + image: python:3.8 + +#test: +# stage: test +# script: +# - python -V +# - curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python +# - source $HOME/.poetry/env && poetry install +# - poetry run pytest --cov-report term --cov=lambda_layer_whitelisting tests/ +# rules: +# - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'develop' \ No newline at end of file From 9c604681ed5dbccbc974be118f2c585f087934a1 Mon Sep 17 00:00:00 2001 From: Karl Dagenais Date: Sun, 12 Apr 2020 13:01:30 -0400 Subject: [PATCH 4/4] remove make reference --- .gitlab-ci.yml | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a448c96..9c46f1b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ stages: before_script: - pip install poetry - poetry --version - - poetry config settings.virtualenvs.in-project true + - poetry config --local virtualenvs.in-project true - poetry install -vv .quality-template: &quality @@ -25,11 +25,15 @@ stages: 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: make test + script: *test-script artifacts: paths: - tests/logs @@ -37,25 +41,7 @@ stages: expire_in: 1 week # Quality jobs ---------------------- -check-bandit: - <<: *quality - script: make check-bandit - -check-black: - <<: *quality - script: make check-black - -check-flake8: - <<: *quality - script: make check-flake8 - -check-isort: - <<: *quality - script: make check-isort - -check-safety: - <<: *quality - script: make check-safety +# TODO: black/lint code on task -> feature merge request # Tests jobs ------------------------ python3.6: @@ -69,13 +55,3 @@ python3.7: python3.8: <<: *test image: python:3.8 - -#test: -# stage: test -# script: -# - python -V -# - curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python -# - source $HOME/.poetry/env && poetry install -# - poetry run pytest --cov-report term --cov=lambda_layer_whitelisting tests/ -# rules: -# - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'develop' \ No newline at end of file