Skip to content

Commit

Permalink
secondary commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hiwakaba committed Mar 4, 2022
1 parent f0d64a2 commit bea3940
Show file tree
Hide file tree
Showing 41 changed files with 4,457 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Additional Information
(The following information is very important in order to help us to help you. Omission of the following details may delay your support request or receive no attention at all.)

- Version of python (python --version)
```
```

- Version of K2HR3 OpenStack Notification Listener (k2hr3-osnl -v)
```
```

- System information (uname -a)
```
```

- Distro (cat /etc/issue)
```
```

## Details about issue
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Relevant Issue (if applicable)
(If there are Issues related to this PullRequest, please list it.)

## Details
(Please describe the details of PullRequest.)
64 changes: 64 additions & 0 deletions .github/scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh
#
# -*- coding: utf-8 -*-
#
# K2hdkc Python Driver under MIT License
#
# Copyright (c) 2022 Yahoo Japan Corporation
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Hirotaka Wakabayashi
# CREATE: Tue Feb 08 2022
# REVISION:
#

echo $(basename $0)

if test -f "/etc/os-release"; then
. /etc/os-release
OS_NAME=$ID
OS_VERSION=$VERSION_ID
elif test -f "/etc/centos-release"; then
echo "[OK] /etc/centos-release falling back to CentOS-7"
OS_NAME=centos
OS_VERSION=7
else
echo "Unknown OS, neither /etc/os-release nor /etc/centos-release"
exit 1
fi

echo "[OK] HOSTNAME=${HOSTNAME} OS_NAME=${OS_NAME} OS_VERSION=${OS_VERSION}"

case "${OS_NAME}-${OS_VERSION}" in
ubuntu*|debian*)
DEBIAN_FRONTEND="noninteractive" sudo apt-get update -y
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y curl pylint
curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh | sudo bash
;;
centos-7)
sudo yum install -y epel-release-7
sudo yum install -y --enablerepo=epel pylint python3 git curl which
curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh | sudo bash
;;
centos-8|fedora*)
sudo dnf install -y epel-release-8
sudo dnf install -y python3-pylint git curl
curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh | sudo bash
;;
esac

cd cluster
sh start_server.sh

exit $?

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: expandtab sw=4 ts=4 fdm=marker
# vim<600: expandtab sw=4 ts=4
#
46 changes: 46 additions & 0 deletions .github/scripts/lint_with_pylint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh
#
# -*- coding: utf-8 -*-
#
# K2hdkc Python Driver under MIT License
#
# Copyright (c) 2022 Yahoo Japan Corporation
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Hirotaka Wakabayashi
# CREATE: Tue Feb 08 2022
# REVISION:
#

echo $(basename $0)

if test -f "/etc/os-release"; then
. /etc/os-release
OS_NAME=$ID
OS_VERSION=$VERSION_ID
elif test -f "/etc/centos-release"; then
echo "[OK] /etc/centos-release falling back to CentOS-7"
OS_NAME=centos
OS_VERSION=7
else
echo "Unknown OS, neither /etc/os-release nor /etc/centos-release"
exit 1
fi

echo "[OK] HOSTNAME=${HOSTNAME} OS_NAME=${OS_NAME} OS_VERSION=${OS_VERSION}"
cd src

pylint k2hdkc --py3k -r n

exit $?

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: expandtab sw=4 ts=4 fdm=marker
# vim<600: expandtab sw=4 ts=4
#
64 changes: 64 additions & 0 deletions .github/scripts/test_with_unittest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh
#
# -*- coding: utf-8 -*-
#
# K2hdkc Python Driver under MIT License
#
# Copyright (c) 2022 Yahoo Japan Corporation
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Hirotaka Wakabayashi
# CREATE: Tue Feb 08 2022
# REVISION:
#

echo $(basename $0)

if test -f "/etc/os-release"; then
. /etc/os-release
OS_NAME=$ID
OS_VERSION=$VERSION_ID
elif test -f "/etc/centos-release"; then
echo "[OK] /etc/centos-release falling back to CentOS-7"
OS_NAME=centos
OS_VERSION=7
else
echo "[NO] Unknown OS, neither /etc/os-release nor /etc/centos-release"
exit 1
fi

echo "[OK] HOSTNAME=${HOSTNAME} OS_NAME=${OS_NAME} OS_VERSION=${OS_VERSION}"
PYTHON=""
case "${OS_NAME}-${OS_VERSION}" in
ubuntu*|debian*)
PYTHON=$(which python)
;;
centos*|fedora*)
PYTHON=$(which python3)
;;
esac

cd src

TEST_FILES="test_k2hdkc.py test_k2hdkc_package.py"
for TEST_FILE in ${TEST_FILES}
do
${PYTHON} -m unittest k2hdkc/tests/${TEST_FILE}
if test $? -ne 0; then
echo "[NO] ${PYTHON} -m unittest k2hdkc/tests/${TEST_FILE}"
exit 1
fi
done

exit 0

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: expandtab sw=4 ts=4 fdm=marker
# vim<600: expandtab sw=4 ts=4
#
76 changes: 76 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
#
# K2hdkc Python Driver under MIT License
#
# Copyright (c) 2022 Yahoo Japan Corporation
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Hirotaka Wakabayashi
# CREATE: Tue Feb 08 2022
# REVISION:
#
#
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [published]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.x", "3.10", "3.9", "3.8", "3.7"]

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: |
./.github/scripts/install_dependencies.sh
shell: sh
- name: Lint with pylint
run: |
./.github/scripts/lint_with_pylint.sh
shell: sh
- name: Test with unittest
run: |
./.github/scripts/test_with_unittest.sh
shell: sh
- name: Install dependencies for upload pypi package
if: startsWith(github.ref, 'refs/tags')
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
if: startsWith(github.ref, 'refs/tags')
run: python -m build
- name: Publish distribution to PyPI
if: ${{ matrix.python-version == '3.x' && startsWith(github.ref, 'refs/tags') }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: expandtab sw=4 ts=4 fdm=marker
# vim<600: expandtab sw=4 ts=4
#
Loading

0 comments on commit bea3940

Please sign in to comment.