diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..c37205d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,76 @@ +--- +name: Test & Deploy +# yamllint disable-line rule:truthy +on: + push: + branches: + - "master" + tags: + - "*.*.*" + pull_request: + +jobs: + + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Install tox + run: pip install tox + - name: Run lint + run: tox -e lint + + test: + runs-on: ubuntu-latest + strategy: + matrix: + python: [3.7, 3.8, 3.9, "3.10"] + + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + pip install -U pip + pip install -U setuptools + sudo apt update + sudo apt install -y build-essential libpq-dev python-dev-is-python3 + - name: Install tox & git + run: | + pip install tox + pip install git + - name: Allow git to submodule filesystem + run: git config --global protocol.file.allow always + - name: Run tox + # Run tox using the version of Python in `PATH` + run: tox -e py + + deploy: + runs-on: ubuntu-latest + needs: [lint, test] + if: startsWith(github.ref, 'refs/tags') + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install dependencies + run: | + pip install -U pip + pip install -U wheel setuptools + - name: Build package + run: python setup.py sdist bdist_wheel + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index b2dc3e1..d97f4a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,32 @@ -*.pyc -*~ +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +-*~ +*$py.class + +# C extensions +*.so # Distribution / packaging -.eggs/ -*.egg-info/ +.Python +env/ build/ +develop-eggs/ dist/ -MANIFEST -# mypy -.mypy_cache/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg +.mypy_cache +.pytest_cache + +.venv +pyrightconfig.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e069a5d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: python -python: - - "3.5" - - "3.6" -# Enable 3.7 without globally enabling sudo and dist: xenial for other build jobs -matrix: - include: - - python: 3.7 - dist: xenial - sudo: true -# command to install dependencies -install: - - "sudo apt install git" - - "pip install ." - -# command to run tests -script: - - python -m unittest discover -v diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..74ba69c --- /dev/null +++ b/MANIFEST @@ -0,0 +1,10 @@ +# file GENERATED by distutils, do NOT edit +LICENSE +README.rst +setup.py +bin/git-trunk +git_trunk/__init__.py +git_trunk/git_trunk_base.py +git_trunk/git_trunk_commands.py +git_trunk/git_trunk_config.py +git_trunk/version.py diff --git a/README.rst b/README.rst index bf54fda..c3dca09 100644 --- a/README.rst +++ b/README.rst @@ -118,7 +118,17 @@ By default squash message generated is to concatenate all commit messages (inclu By default squash message edit is enabled, which allows to edit tag message before it is saved. Can be disabled if needed. -| +Testing +======= + +To test with newer ``git``, adding submodules from files must be enabled: + +.. code-block:: + + git config --global protocol.file.allow always + +This is used as a workaround, because setting this on temp tested repo does not work +for some reason. *Contributors* diff --git a/git_trunk/__init__.py b/git_trunk/__init__.py index 2b8877c..e69de29 100644 --- a/git_trunk/__init__.py +++ b/git_trunk/__init__.py @@ -1 +0,0 @@ -__version__ = '0.5.0' diff --git a/setup.py b/setup.py index 587d2bd..edae1ad 100644 --- a/setup.py +++ b/setup.py @@ -1,25 +1,33 @@ -from distutils.core import setup -from git_trunk import __version__ +from setuptools import setup, find_packages + +test_deps = ["pytest"] +extras = {'test': test_deps} setup( name='git_trunk', - version=__version__, - packages=['git_trunk'], + use_scm_version=True, + packages=find_packages(), license='LGPLv3', url='https://github.com/focusate/git-trunk', description="Git Trunk based workflow", long_description=open('README.rst').read(), install_requires=['footil>=0.24.0', 'gitpython'], + tests_require=test_deps, + extras_require=extras, + setup_requires=[ + 'setuptools_scm', + ], scripts=['bin/git-trunk'], maintainer='Andrius Laukavičius', - maintainer_email='dev@focusate.eu', + maintainer_email='andrius@timefordev.com', python_requires='>=3.5', classifiers=[ 'Environment :: Other Environment', 'Intended Audience :: Developers', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Topic :: Software Development', 'Topic :: Utilities', ], diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..204f4ae --- /dev/null +++ b/tox.ini @@ -0,0 +1,16 @@ +[tox] +envlist = py37,py38,py39,py310,lint + +[testenv] +extras = test +commands = py.test {posargs} + +[testenv:lint] +basepython = python3.9 +skip_install=true +deps = flake8 +commands = flake8 {posargs} git_trunk/ git_trunk/tests/ + +[pytest] +addopts = -q +norecursedirs = *.egg .git .* _*