Skip to content

Commit

Permalink
minor changes (#7)
Browse files Browse the repository at this point in the history
* minor refactor for readability

* improve vagrant action output

* improve GH action

* add support for dev versions

* no automatic releases yet
  • Loading branch information
russoz authored Jun 5, 2023
1 parent 07133ab commit 064197a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 39 deletions.
6 changes: 4 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
current_version = 0.46
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?
serialize =
parse = (?P<major>\d+)\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?(?:\.dev(?P<dev>\d+))?
serialize =
{major}.{minor}.{patch}.dev{dev}
{major}.{minor}.{patch}
{major}.{minor}.dev{dev}
{major}.{minor}

[bumpversion:file:andeboxlib/cli.py]
Expand Down
40 changes: 12 additions & 28 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: Andebox application

on:
push:
Expand All @@ -20,28 +18,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 -v . --count --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 -v . --count --exit-zero --statistics
- name: Test with pytest
run: |
poetry run pytest -v
- name: Publish to Test PyPI
env:
POETRY_PYPI_TOKEN_TEST_PYPI: ${{ env.test_pypi_token }}
run: |
poetry config --local repositories.test-pypi https://test.pypi.org/legacy/
poetry publish --repository test-pypi
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test package
run: tox
6 changes: 3 additions & 3 deletions andeboxlib/actions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def ansible_collection_tree(self, namespace, collection, keep=False):
yield coll_dir

finally:
if not keep:
if keep:
print('Keeping temporary directory: {0}'.format(coll_dir))
else:
print('Removing temporary directory: {0}'.format(coll_dir))
shutil.rmtree(top_dir)
else:
print('Keeping temporary directory: {0}'.format(coll_dir))

@classmethod
def make_parser(cls, subparser):
Expand Down
6 changes: 3 additions & 3 deletions andeboxlib/actions/vagrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def run(self, args):
machine_name = args.name or self.default_name
venv = args.venv or self.default_venv

print(f"== SETUP vagrant VM: {machine_name} {'=' * 80}")
print(f"== SETUP vagrant VM: {machine_name} ".ljust(80, "="))
v = vagrant.Vagrant()
for line in v.up(vm_name=machine_name, stream_output=True):
print(line, end="")
Expand All @@ -66,7 +66,7 @@ def run(self, args):
},
) as c:

print(f"== BEGIN vagrant andebox: {machine_name} {'=' * 80}")
print(f"== BEGIN vagrant andebox: {machine_name} ".ljust(80, "="))
with c.cd("/vagrant"):
andebox_path = self.binary_path(venv, "andebox")
cmd = f"{andebox_path} test --venv {venv} -R -- integration {' '.join(args.andebox_params)}"
Expand All @@ -79,4 +79,4 @@ def run(self, args):
finally:
if args.destroy:
v.destroy()
print(f"==== END vagrant andebox: {machine_name} {'=' * 80}")
print(f"== END vagrant andebox: {machine_name} ".ljust(80, "="))
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py39, py310, py311
isolated_build = true
skip_missing_interpreters = True

[testenv]
Expand All @@ -19,9 +19,8 @@ allowlist_externals =
passenv = POETRY_PYPI_TOKEN_TEST_PYPI
commands =
{[testenv]commands}
poetry run bumpversion --verbose --no-tag --no-commit --allow-dirty {posargs}
poetry run bumpversion --no-tag --no-commit --allow-dirty dev
poetry publish --build --repository test-pypi
git checkout .

[testenv:release]
deps = poetry
Expand All @@ -31,6 +30,7 @@ allowlist_externals =
passenv = POETRY_PYPI_TOKEN_PYPI
commands =
{[testenv]commands}
[[ $(git --show-current) == "main" ]] || exit 1
poetry run bumpversion --verbose {posargs}
poetry build
git push --tags
Expand Down

0 comments on commit 064197a

Please sign in to comment.