diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..9df6360 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,47 @@ +name: CI + +on: + # Trigger the workflow on push or pull request, + # but only for the master branch + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]') && ! contains(toJSON(github.event.commits.*.message), '[ci skip]')" + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.6', '3.7', '3.8'] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + make init + - name: Lint with flake8, mypy, pylint and checkdocs + run: | + # stop the build if there are Python syntax errors or undefined names + make lint + - name: Run tests + run: | + make test + - name: Check coverage + run: | + make coverage + - name: Make docs + run: | + make docs + - name: Make dist package + run: | + make dist + - name: Install the package locally + run: | + make install diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0c6b231..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -# -# K2HR3 OpenStack Notification Listener -# -# Copyright 2018 Yahoo! Japan Corporation. -# -# K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers -# common management information for the cloud. -# K2HR3 can dynamically manage information as "who", "what", "operate". -# These are stored as roles, resources, policies in K2hdkc, and the -# client system can dynamically read and modify these information. -# -# For the full copyright and license information, please view -# the licenses file that was distributed with this source code. -# -# AUTHOR: Hirotaka Wakabayashi -# CREATE: Tue Sep 11 2018 -# REVISION: -# - -language: python -dist: xenial -python: -- 3.7 -- 3.6 -- 3.5 - -install: make init - -script: -- make lint test-with-version coverage docs dist install - -deploy: - provider: pypi - user: "antpickax" - password: ${PYPI_TOKEN} - on: - tags: true - distributions: "sdist bdist_wheel" - skip_existing: true - -# -# VIM modelines -# -# vim:set ts=4 fenc=utf-8: -# - diff --git a/HISTORY.rst b/HISTORY.rst index 3fda693..7f813ef 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,16 @@ History ======= +0.9.5 (2020-12-01) +------------------- + +* Removes the --user option from pip command + +0.9.4 (2020-12-01) +------------------- + +* Changes CI from Travis to GitHub Actions + 0.9.3 (2020-11-30) ------------------- diff --git a/Makefile b/Makefile index 4b7610c..1d39611 100644 --- a/Makefile +++ b/Makefile @@ -48,11 +48,29 @@ BROWSER := python3 -c "$$BROWSER_PYSCRIPT" help: @python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) +# Initialize development environment +# Initialization fails if dependency problems happens or security vulnerabilities are detected. +# +# Note: +# Make sure python3-devel or python3-dev is installed. Because oslo-message(or dependent libs) requires Python.h init: - python3 -m pip install pipenv - pipenv install --skip-lock + python3 -m pip install --upgrade pip + python3 -m pip install --upgrade pipenv + pipenv install --dev --skip-lock pipenv graph - pipenv install --dev + pipenv check + +# Lint code and docs +# lint fails if there are syntax errors or undefined names. +# +# Note: +# lint commands should be emit in virtualenv activated environment. +lint: + pipenv run flake8 --version + pipenv run flake8 k2hr3_osnl tests + pipenv run mypy k2hr3_osnl tests + pipenv run pylint k2hr3_osnl tests --py3k -r n + pipenv run python3 setup.py checkdocs clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts @@ -76,74 +94,76 @@ clean-test: ## remove test and coverage artifacts rm -fr htmlcov/ rm -fr .pytest_cache -lint: ## check style with flake8 - flake8 --version - flake8 k2hr3_osnl tests - mypy k2hr3_osnl tests - pylint k2hr3_osnl tests --py3k -r n - python3 -m pip install collective.checkdocs - python3 setup.py checkdocs - -test: ## run tests quickly with the default Python - python3 -m unittest +test-only: ## run tests quickly with the default Python + pipenv run python3 -m unittest +# Check version strings consistency +# Make sure the following version strings are same. +# 1. HISTORY.rst +# 2. python-k2hr3-osnl.spec +# 3. __init__.py version: @rm -f VERSION RPMSPEC_VERSION @perl -ne 'print if /^[0-9]+.[0-9]+.[0-9]+ \([0-9]{4}-[0-9]{2}-[0-9]{2}\)$$/' HISTORY.rst \ | head -n 1 | perl -lne 'print $$1 if /^([0-9]+.[0-9]+.[0-9]+) \(.*\)/' > VERSION @perl -ne 'print $$2 if /^Version:(\s+)([0-9]+.[0-9]+.[0-9]+)$$/' python-k2hr3-osnl.spec > RPMSPEC_VERSION -SOURCE_VERSION = $(shell python3 -c 'import k2hr3_osnl; print(k2hr3_osnl.version())') +SOURCE_VERSION = $(shell pipenv run python3 -c 'import k2hr3_osnl; print(k2hr3_osnl.version())') HISTORY_VERSION = $(shell cat VERSION) RPMSPEC_VERSION = $(shell cat RPMSPEC_VERSION) -test-with-version: version ## builds source and wheel package +# Check version strings consistency +# Make sure the following version strings are same. +# 1. HISTORY.rst +# 2. python-k2hr3-osnl.spec +# 3. __init__.py +test: version ## builds source and wheel package @echo 'source ' ${SOURCE_VERSION} @echo 'history ' ${HISTORY_VERSION} @echo 'rpmspec ' ${RPMSPEC_VERSION} @if test "${SOURCE_VERSION}" = "${HISTORY_VERSION}" -a "${HISTORY_VERSION}" = "${RPMSPEC_VERSION}" ; then \ - python3 -m unittest ; \ + pipenv run python3 -m unittest ; \ fi -test-all: lint test-version +test-all: lint test coverage: ## check code coverage quickly with the default Python - coverage run --source k2hr3_osnl -m unittest - coverage report -m - coverage xml - coverage html + pipenv run coverage run --source k2hr3_osnl -m unittest + pipenv run coverage report -m + pipenv run coverage xml + pipenv run coverage html # $(BROWSER) htmlcov/index.html docs: ## generate Sphinx HTML documentation, including API docs rm -f docs/k2hr3_osnl.rst rm -f docs/modules.rst - sphinx-apidoc -o docs/ k2hr3_osnl + pipenv run sphinx-apidoc -o docs/ k2hr3_osnl $(MAKE) -C docs clean $(MAKE) -C docs html # $(BROWSER) docs/_build/html/index.html servedocs: docs ## compile the docs watching for changes - watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . + pipenv run watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . release: dist ## package and upload a release - twine check dist/* - twine upload dist/* + pipenv run twine check dist/* + pipenv run twine upload dist/* test-release: - twine check dist/* - twine upload --repository-url https://test.pypi.org/legacy/ dist/* + pipenv run twine check dist/* + pipenv run twine upload --repository-url https://test.pypi.org/legacy/ dist/* dist: clean version ## builds source and wheel package @echo 'source ' ${SOURCE_VERSION} @echo 'history ' ${HISTORY_VERSION} @if test "${SOURCE_VERSION}" = "${HISTORY_VERSION}" -a "${HISTORY_VERSION}" = "${RPMSPEC_VERSION}" ; then \ - python3 setup.py sdist ; \ - python3 setup.py bdist_wheel ; \ + pipenv run python3 setup.py sdist ; \ + pipenv run python3 setup.py bdist_wheel ; \ ls -l dist ; \ fi install: clean ## install the package to the active Python's site-packages - python3 setup.py install + pipenv run python3 setup.py install # # VIM modelines diff --git a/Pipfile b/Pipfile index b670236..8b88cd0 100644 --- a/Pipfile +++ b/Pipfile @@ -18,6 +18,9 @@ astroid = {version = ">=2.4.2,<2.4.3"} typed-ast = {version = ">=1.4.1,<1.4.2"} mypy = {version = ">=0.790,<0.791"} importlib-metadata = {version = ">=2.1.0,<2.2.0"} +"collective.checkdocs" = "*" +argh = {version = ">=0.26.2,<0.26.3"} +watchdog = {version = ">=0.10.4,<0.10.5"} [packages] oslo-config = "*" diff --git a/docs/Makefile b/docs/Makefile index 92b2256..306f58b 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -22,7 +22,7 @@ # You can set these variables from the command line. SPHINXOPTS = -SPHINXBUILD = python3 -msphinx +SPHINXBUILD = pipenv run python3 -msphinx SPHINXPROJ = k2hr3_osnl SOURCEDIR = . BUILDDIR = _build diff --git a/k2hr3_osnl/__init__.py b/k2hr3_osnl/__init__.py index 23d51d3..b4903d6 100644 --- a/k2hr3_osnl/__init__.py +++ b/k2hr3_osnl/__init__.py @@ -32,7 +32,7 @@ 'version', ] __author__ = 'Hirotaka Wakabayashi ' -__version__ = '0.9.3' +__version__ = '0.9.5' import argparse import logging diff --git a/python-k2hr3-osnl.spec b/python-k2hr3-osnl.spec index 3f49304..a83e8e0 100644 --- a/python-k2hr3-osnl.spec +++ b/python-k2hr3-osnl.spec @@ -1,7 +1,7 @@ %global srcname k2hr3_osnl %global pypi_name k2hr3-osnl Name: python-k2hr3-osnl -Version: 0.9.3 +Version: 0.9.4 Release: 1%{?dist} Summary: An OpenStack notification listener for K2HR3 @@ -83,6 +83,12 @@ rm -rf %{buildroot}/usr/etc/k2hr3/k2hr3-osnl.conf %{_mandir}/man1/k2hr3-osnl.1* %changelog +* Tue Dec 01 2020 Hirotaka Wakabayashi 0.9.5-1 +- Update for Release Version 0.9.5 + +* Tue Dec 01 2020 Hirotaka Wakabayashi 0.9.4-1 +- Update for Release Version 0.9.4 + * Mon Nov 30 2020 Hirotaka Wakabayashi 0.9.3-1 - Update for Release Version 0.9.3