Commit 77229090 authored by nimrod's avatar nimrod
Browse files

Replace TravisCI with GitLab CI.

Also:

- Update the README.
- Test more environments (every supported CPythong and PyPy version and
CPython 2.7).
parent 8616f7e1
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+69 −0
Original line number Diff line number Diff line
---
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"

.travis.yml

deleted100644 → 0
+0 −43
Original line number Diff line number Diff line
# 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
+1 −1
Original line number Diff line number Diff line
@@ -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
+16 −19
Original line number Diff line number Diff line
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.