mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-03-16 21:30:23 +00:00
Use GitHub actions & remove Travis (#173)
This commit is contained in:
parent
76cb929cf5
commit
6108d8e5b6
5 changed files with 99 additions and 63 deletions
83
.github/workflows/ci.yml
vendored
Normal file
83
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -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 }}
|
||||
51
.travis.yml
51
.travis.yml
|
|
@ -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
|
||||
|
|
@ -1,7 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import os
|
||||
import sys
|
||||
import django
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
|
|
|
|||
18
tox.ini
18
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue