diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a8ae131 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,38 @@ +name: Tests + +# push と pull request イベント毎にGtihubのWorkflowを起動する +on: + - push + - pull_request + +jobs: + # ジョブの名称 + test_with_tox: + runs-on: ubuntu-latest + + # 並列して実行する各ジョブのPythonバージョン + strategy: + matrix: + python-version: ['3.6', '3.9'] + django-version: ['2.2'] + + steps: + # ソースコードをチェックアウト + - uses: actions/checkout@v2 + + # ジョブのPython環境を設定 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + # Github Actionsからtoxを実行するために必要なパッケージをインストール + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + + # Github Actionsからtoxを実行 + - name: Test with tox + run: | + tox diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 26207c8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: python -sudo: false - -install: - - pip install tox-travis -python: - - "2.7" - - "3.6" -env: - - DJANGO="1.11" - - DJANGO="2.2" -script: tox diff --git a/README.md b/README.md deleted file mode 100644 index ce2eab8..0000000 --- a/README.md +++ /dev/null @@ -1,7 +0,0 @@ -[![Build Status](https://travis-ci.org/beproud/bpnotify.svg?branch=master)](https://travis-ci.org/beproud/bpnotify) - -# Requirements - -* Python (2.7, 3.6) -* Celery (4.1) -* Django (1.11, 2.2) diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..ade2704 --- /dev/null +++ b/README.rst @@ -0,0 +1,10 @@ +.. image:: https://github.com/beproud/bpmailer/actions/workflows/tests.yml/badge.svg + :target: https://github.com/beproud/bpmailer/actions + :alt: GitHub Actions + +Requirements +============ + +* Python (3.6, 3.9) +* Celery (4.1) +* Django (2.2) diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..80ba736 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,5 @@ +# toxを使用せず、直接 python tests.py で単体テスト実行する際に pip installするパッケージ一覧です。 +celery==4.1.0 +Django==2.2.27 +mock==4.0.3 +six==1.15.0 diff --git a/setup.py b/setup.py index 4cebce5..b4526ec 100644 --- a/setup.py +++ b/setup.py @@ -48,19 +48,24 @@ def read_file(filename): author='BeProud Inc.', author_email='project@beproud.jp', url='https://github.com/beproud/bpmailer/', + python_requires='>=3.6', classifiers=[ 'Development Status :: 3 - Alpha', - 'Environment :: Plugins', - 'Framework :: Django', - 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.9', + 'Framework:: Django', + 'Framework:: Django :: 2.2', + 'Intended Audience :: Developers', + 'Environment :: Plugins', 'Topic :: Software Development :: Libraries :: Python Modules', ], include_package_data=True, packages=find_packages(), namespace_packages=['beproud', 'beproud.django'], - install_requires=['Django>=1.11', 'six'], + install_requires=['Django>=2.2', 'six', 'Celery'], test_suite='tests.main', zip_safe=False, keywords=['django', 'mail'] diff --git a/tests.py b/tests.py index 3835e20..cd61835 100644 --- a/tests.py +++ b/tests.py @@ -56,11 +56,15 @@ def main(): django.setup() from django.test.utils import get_runner - test_runner = get_runner(global_settings) - test_runner = test_runner() - tests = ['beproud.django.mailer'] - failures = test_runner.run_tests(tests) + # Djangoのtest runnerクラスを取得 + TestRunner = get_runner(global_settings) + + # test runnerオブジェクトを生成 + test_runner = TestRunner() + + # test runnerにbpmailerの単体テストのPathを渡して、bpmailerの単体テストを実行する + failures = test_runner.run_tests(['beproud.django.mailer.tests']) sys.exit(failures) diff --git a/tox.ini b/tox.ini index c9ebd13..1681bb0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,29 +1,21 @@ # Requires tox > 1.8 [tox] -envlist = py27-django111, py36-django{111,22} +envlist = py{36,39}-django22 [testenv] basepython = - py27: python2.7 py36: python3.6 + py39: python3.9 deps = six - django111: Django>=1.11,<2.0 - django111: celery>=4.0,<4.2 django22: Django>=2.2,<3.0 django22: celery>=4.0,<4.2 mock>=0.7.2 commands=python setup.py test -[travis] -os = - linux: py27-django111, py36-django{111,22} +# tox-gh-actionsパッケージの設定 +[gh-actions] python = - 2.7: py27 - 3.6: py36 - -[travis:env] -DJANGO = - 1.11: django111 - 2.2: django22 + 3.6: py36 + 3.9: py39