Skip to content

Commit

Permalink
[REF] auto deploy
Browse files Browse the repository at this point in the history
Enable auto deploying and make tests work with latest git.
  • Loading branch information
oerp-odoo committed May 15, 2024
1 parent 2075032 commit f058b6d
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 34 deletions.
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"]

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 }}
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'
22 changes: 15 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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='[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',
'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,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 .* _*

0 comments on commit f058b6d

Please sign in to comment.