Skip to content
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

[REF] auto deploy #9

Merged
merged 1 commit into from
May 15, 2024
Merged
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
76 changes: 76 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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", "3.11", "3.12"]
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
run: pip install tox
- name: Allow git to submodule filesystem and set identity
run: |
git config --global protocol.file.allow always
git config --global user.email "[email protected]"
git config --global user.name "Test User"
- 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 }}
35 changes: 28 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -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
12 changes: 11 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
1 change: 0 additions & 1 deletion git_trunk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__version__ = '0.5.0'
7 changes: 4 additions & 3 deletions git_trunk/git_trunk_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def _get_message_for_squash(
return None

def _amend_commit_for_squash(
self, message: Union[None, str]=None):
self, message: Union[None, str] = None):
args = ['--amend']
if message:
args.extend(['-m', message])
Expand All @@ -566,11 +566,11 @@ def check_run(self, count: int = 1, **kwargs):
if trunk_branch_name == self.active_branch_name:
raise ValueError(
"Branch to be squashed must be different than trunk "
"branch: %s" % trunk_branch_name)
+ "branch: %s" % trunk_branch_name)
if self.git.diff('--stat'):
raise ValueError(
"There are uncommitted changes. To squash, first stash"
" changes or commit them.")
+ " changes or commit them.")
max_count = self.max_squash_commits_count
if max_count <= 0:
raise ValueError("No Commits to squash.")
Expand Down Expand Up @@ -605,6 +605,7 @@ def run(
- git reset --soft HEAD~COUNT
- git commit --amend -m 'MSG' (message depends on options)
- git push --force (if enabled in config)

"""
if not count:
count = self.max_squash_commits_count
Expand Down
24 changes: 17 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
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='[email protected]',
maintainer_email='[email protected]',
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',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Software Development',
'Topic :: Utilities',
],
Expand Down
16 changes: 16 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tox]
envlist = py37,py38,py39,py310,py311,py312,lint

[testenv]
extras = test
commands = py.test {posargs}

[testenv:lint]
basepython = python3.10
skip_install=true
deps = flake8
commands = flake8 {posargs} git_trunk/ git_trunk/tests/

[pytest]
addopts = -q
norecursedirs = *.egg .git .* _*