diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..7e482737bc707c2403696089ce6031b9b7d364fb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,69 @@ +--- +stages: + - lint + - test + +pre-commit: + stage: lint + image: adarnimrod/ci-images:pre-commit + variables: &variables + XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache" + PIPENV_VENV_IN_PROJECT: "1" + LANG: C.UTF-8 + before_script: + - apt-get update + - apt-get install -y libdbus-1-dev + - pipenv install --dev && rm pyproject.toml + script: + - pipenv run lint + cache: &cache + key: "$CI_JOB_NAME" + paths: + - .cache/ + - .venv/ + +test: + stage: test + image: $project:$version-slim + allow_failure: true + before_script: + - apt-get update + - >- + apt-get install -y + bats + build-essential + git + libdbus-1-dev + libffi-dev + libglib2.0-dev + libssl-dev + - |- + if [ "$project" = 'pypy' ] + then + ln -sf /opt/pypy/bin/pypy "/usr/local/bin/python$version" + fi + - pip install pipenv + - pipenv install --dev --python=$version + script: + - pipenv run bats + - pipenv run check + - pipenv run doctest + - pipenv run build + variables: + <<: *variables + PIPENV_SKIP_LOCK: 1 + cache: *cache + parallel: + matrix: + - project: python + version: + - "2.7" + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - project: pypy + version: + - "2.7" + - "3.6" + - "3.7" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 78897da6f49a305fce11cbf4f9e56992fe369743..0000000000000000000000000000000000000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -# vim:ff=unix ts=2 sw=2 ai expandtab ---- -language: python -python: - - "2.7" - - "3.5" - - "3.6" - - "3.7" -dist: xenial -sudo: false -cache: - - pip - - $HOME/.pre-commit - -matrix: - include: - - python: "3.7" - env: - PIPENV_IGNORE_VIRTUALENVS: "1" - install: - - pipenv install --dev - addons: - apt: - packages: - - libdbus-1-dev - - libglib2.0-dev - script: - - pipenv run lint - - pipenv run check - -install: - - git clone --depth 1 https://github.com/bats-core/bats-core "$HOME/bats" - - pip install . | cat - -env: - PATH: "$PATH:$HOME/bats/bin:$HOME/.local/bin" - -script: - - bats -t tests/ - - python -m doctest template/*.py - -notifications: - email: false diff --git a/MANIFEST.in b/MANIFEST.in index bc8756d871ba08f8804ca67ba57e4033e0df2653..f9da9fac83d65d0021ca40d286726cd7cd0136e3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,7 +2,7 @@ recursive-include template *.py include *.rst include *.txt exclude .pre-commit-config.yaml -exclude .travis.yml +exclude .gitlab-ci.yml exclude .gitignore exclude Pipfile* exclude tests diff --git a/README.rst b/README.rst index dfe8dd443de6be4c76f6e3a6f97ba38a79b441c5..2edc1d415a46d36250131d14648a7fe71b466e3c 100644 --- a/README.rst +++ b/README.rst @@ -1,12 +1,11 @@ Template ######## -.. image:: https://travis-ci.org/adarnimrod/template.svg?branch=master - :target: https://travis-ci.org/adarnimrod/template +.. image:: https://git.shore.co.il/nimrod/template/badges/master/pipeline.svg + :target: https://git.shore.co.il/nimrod/template/-/commits/master A CLI tool for generating files from `Jinja2 <http://jinja.pocoo.org/>`_ -templates and environment variables. Tested on Python versions 2.7, 3.5 and -later. +templates and environment variables. Examples -------- @@ -50,7 +49,7 @@ The following Jinja filters were added: query language. - :code:`run`: Runs a command and returns the stdout, stderr and returncode using `run - <https://docs.python.org/3.5/library/subprocess.html?highlight=popen#subprocess.run>`_. + <https://docs.python.org/3.6/library/subprocess.html?highlight=popen#subprocess.run>`_. Example usage can be seen in :code:`tests` and for specific filters in the docstrings in :code:`template/filters.py`. @@ -58,28 +57,28 @@ docstrings in :code:`template/filters.py`. Testing ------- -Tests require Python 3.7, `pipenv <https://docs.pipenv.org>`_ and -`Bats <https://github.com/bats-core/bats-core>`_. Run the tests with the +Tests require `Pipenv <https://docs.pipenv.org>`_ and `Bats +<https://github.com/bats-core/bats-core>`_. Run the tests with the following commands: .. code:: shell pipenv run lint # Pre-commit hooks. - pipenv run check # Twine check. pipenv run doctest # Doc tests. pipenv run bats # Bats tests. + pipenv run check # Twine check. -Also, Travis CI is setup for this project so every push to this repository is -checked with all supported Python versions. +Also, GitLab CI is setup for this project so every push to this repository is +checked with all Python 2.7, Python 3.6 and later and all supported versions of +PyPy. Release ------- -Release requires Python 3.7 and `pipenv <https://docs.pipenv.org>`_. To bump the -version run :code:`pipenv run bumpversion major|minor|patch` to update the -version and git commit and tag. Then run :code:`pipenv run upload` to upload the -new version to PyPI and :code:`git push --follow-tags` to push the git commit -and tag. +Release requires `Pipenv <https://docs.pipenv.org>`_. To bump the version run +:code:`pipenv run bumpversion major|minor|patch` to update the version and git +commit and tag. Then run :code:`pipenv run upload` to upload the new version to +PyPI and :code:`git push --follow-tags` to push the git commit and tag. License ------- @@ -93,11 +92,9 @@ Author Nimrod Adar, `contact me <nimrod@shore.co.il>`_ or visit my `website <https://www.shore.co.il/>`_. Patches are welcome via `git send-email <http://git-scm.com/book/en/v2/Git-Commands-Email>`_. The repository is located -at: https://www.shore.co.il/git/. +at: https://git.shore.co.il/nimrod/. Pending tasks ------------- -- Release on tagged commits to PyPI in Travis CI - (https://docs.travis-ci.com/user/deployment/pypi/ and - https://docs.travis-ci.com/user/encryption-keys/). +- Release on tagged commits to PyPI in CI.