diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1957129 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,83 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.5', '3.6', '3.7', '3.8', '3.9'] + django-version: ['2.0', '2.1', '2.2', '3.0', '3.1'] + exclude: + - python-version: '3.5' + django-version: '3.0' + - python-version: '3.5' + django-version: '3.1' + - python-version: '3.8' + django-version: '2.0' + - python-version: '3.8' + django-version: '2.1' + - python-version: '3.9' + django-version: '2.0' + - python-version: '3.9' + django-version: '2.1' + + services: + redis: + image: redis:6.0 + ports: + - 6379:6379 + postgres: + image: postgres + ports: + - 5432:5432 + env: + POSTGRES_USER: cachalot + POSTGRES_PASSWORD: password + POSTGRES_DB: cachalot + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + mysql: + image: mysql + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: cachalot + ports: + - 3306:3306 + memcached: + image: memcached + ports: + - 11211:11211 + + 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: | + sudo apt-get install -y libmemcached-dev zlib1g-dev + python -m pip install --upgrade pip + pip install tox tox-gh-actions coveralls + - name: Tox Test + run: tox + env: + TOX_TESTENV_PASSENV: POSTGRES_PASSWORD + POSTGRES_PASSWORD: password + PYTHON_VER: ${{ matrix.python-version }} + DJANGO: ${{ matrix.django-version }} + - name: Coverage (Coveralls) + if: ${{ success() }} + run: coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c535369..0000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -os: linux -dist: xenial - -language: python -cache: pip -python: - - "3.5" - - "3.6" - - "3.7" - - "3.8" - - "3.9" - -services: - - memcached - - redis - - mysql - - postgresql - -env: - - DJANGO="2.0" - - DJANGO="2.1" - - DJANGO="2.2" - - DJANGO="3.0" - - DJANGO="3.1" - -matrix: - exclude: - - python: 3.5 - env: DJANGO=3.0 - - python: 3.5 - env: DJANGO=3.1 - - - python: 3.8 - env: DJANGO=2.0 - - python: 3.8 - env: DJANGO=2.1 - - python: 3.9 - env: DJANGO=2.0 - - python: 3.9 - env: DJANGO=2.1 - -install: pip install tox tox-travis coveralls - -before_script: - - psql -c 'CREATE USER cachalot SUPERUSER;' -U postgres - - psql -c 'CREATE DATABASE cachalot OWNER cachalot;' -U postgres - - mysql -u root -e 'CREATE DATABASE cachalot;' - -script: tox - -after_success: coveralls diff --git a/runtests.py b/runtests.py index 05fd51b..14496e3 100755 --- a/runtests.py +++ b/runtests.py @@ -1,7 +1,4 @@ #!/usr/bin/env python -# coding: utf-8 - -from __future__ import unicode_literals import os import sys import django diff --git a/settings.py b/settings.py index 82bc5a9..13d4c6a 100644 --- a/settings.py +++ b/settings.py @@ -1,6 +1,3 @@ -# coding: utf-8 - -from __future__ import unicode_literals import os @@ -13,15 +10,19 @@ DATABASES = { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'cachalot', 'USER': 'cachalot', + 'HOST': '127.0.0.1', }, 'mysql': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'cachalot', 'USER': 'root', + 'HOST': '127.0.0.1', }, } if 'MYSQL_PASSWORD' in os.environ: DATABASES['mysql']['PASSWORD'] = os.environ['MYSQL_PASSWORD'] +if 'POSTGRES_PASSWORD' in os.environ: + DATABASES['postgresql']['PASSWORD'] = os.environ['POSTGRES_PASSWORD'] for alias in DATABASES: if 'TEST' not in DATABASES[alias]: test_db_name = 'test_' + DATABASES[alias]['NAME'] diff --git a/tox.ini b/tox.ini index 7d45c3f..11a5611 100644 --- a/tox.ini +++ b/tox.ini @@ -41,10 +41,16 @@ setenv = commands = coverage run -a --source=cachalot ./runtests.py -[travis:env] +[gh-actions:env] +PYTHON_VER = + 3.5: py35 + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 DJANGO = - 2.0: django2.0 - 2.1: django2.1 - 2.2: django2.2 - 3.0: django3.0 - 3.1: django3.1 + 2.0: django2.0 + 2.1: django2.1 + 2.2: django2.2 + 3.0: django3.0 + 3.1: django3.1