Skip to content

Hotfix/update gitlab ci #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
97 changes: 79 additions & 18 deletions {{ cookiecutter.repo_name }}/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,88 @@
image: python:3.8-slim-buster

variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache
ARANGO_ROOT_PASSWORD: admin
TOX_CACHE_DIR: .tox/py38
PYTEST_CACHE: pytest

cache:
paths:
- .cache/pip
- venv/
stages:
- Clean_Up
- Tests

before_script:
- python -V
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate

test:
allow_failure: true
.tests-template:
stage: Tests
script:
- pip install -U tox
- tox
- python -V
only:
- master
- develop
- merge_requests
changes:
- {{ cookiecutter.repo_name }}/**/*.py
- tests/**/*.py
- .gitlab-ci.yml
refs:
- develop
- merge_request
artifacts:
expire_in: 1 week

flake8:
extends: .tests-template
allow_failure: true
before_script:
- python -V
- pip install flake8
script:
- flake8 {{ cookiecutter.repo_name }} tests --ignore=F401
except:
refs:
- schedules
cache: {}

pytest:
extends: .tests-template
image: image: python:3.8-buster
before_script:
- python -V
- cp env.example.py env.py
- pip install -U tox
script:
- tox
only:
changes:
- {{ cookiecutter.repo_name }}/**/*
- tests/**/*
- .gitlab-ci.yml
- requirements_dev.txt
- tox.ini
- "*.py"
refs:
- develop
- schedules
cache:
key: $PYTEST_CACHE
paths:
- $TOX_CACHE_DIR

pytest:mr:
extends: pytest
only:
refs:
- merge_requests
except:
refs:
- schedules
cache:
policy: pull

clean:on-schedule:
stage: Clean_Up
script:
- echo "Cleaning up cache!"
only:
refs:
- schedules
cache:
key: "$CACHE_KEY"
policy: push
paths:
- $CACHE_AT
4 changes: 2 additions & 2 deletions {{ cookiecutter.repo_name }}/requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coverage
flake8
{% if cookiecutter.use_pytest == 'y' -%}
pytest
pytest-cov
pylint
pytest-cov{%- endif %}
8 changes: 1 addition & 7 deletions {{ cookiecutter.repo_name }}/tox.ini
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
[tox]
envlist = py38, flake8

[testenv:flake8]
deps = flake8
; igores 'imported but unused' traceback
commands = flake8 --ignore=F401
envlist = py38

[testenv]
setenv =
PYTHONPATH = {toxinidir}
{% if cookiecutter.use_pytest == 'y' -%}
deps =
-r{toxinidir}/requirements_dev.txt
-r{toxinidir}/requirements.txt
; If you want to make tox run the tests with the same versions, create a
; requirements.txt with the pinned versions and uncomment the following line:
; -r{toxinidir}/requirements.txt
Expand Down