Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace travis with github actions #368

Merged
merged 2 commits into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Running unittests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
django: ["2.2", "3.0", "3.1"]

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: |
python -m pip install --upgrade pip
pip install -r requirements-tests.txt
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Linting
run: flake8
- name: Run unittests
env:
TOX_ENV: py${{ matrix.python-version}}-django${{ matrix.django }}
run: |
tox -e $TOX_ENV
76 changes: 0 additions & 76 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion dbbackup/management/commands/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ...storage import StorageError

if six.PY2:
input = raw_input
input = raw_input # noqa
else:
long = int

Expand Down
2 changes: 1 addition & 1 deletion dbbackup/management/commands/mediabackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def backup_mediafiles(self):
filename = utils.filename_generate(extension,
servername=self.servername,
content_type=self.content_type)

tarball = self._create_tar(filename)
# Apply trans
if self.encrypt:
Expand Down
3 changes: 1 addition & 2 deletions dbbackup/management/commands/mediarestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
"""
import tarfile

from django.core.management.base import CommandError
from django.core.files.storage import get_storage_class

from ._base import BaseDbBackupCommand, make_option
from ...storage import get_storage, StorageError
from ...storage import get_storage
from ... import utils


Expand Down
6 changes: 2 additions & 4 deletions dbbackup/settings.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# DO NOT IMPORT THIS BEFORE django.configure() has been run!

import logging.config
import tempfile
import socket
from django.conf import settings
import dbbackup.log

DATABASES = getattr(settings, 'DBBACKUP_DATABASES', list(settings.DATABASES.keys()))

Expand All @@ -24,8 +22,8 @@
MEDIA_PATH = getattr(settings, 'DBBACKUP_MEDIA_PATH', settings.MEDIA_ROOT)

DATE_FORMAT = getattr(settings, 'DBBACKUP_DATE_FORMAT', '%Y-%m-%d-%H%M%S')
FILENAME_TEMPLATE = getattr(settings, 'DBBACKUP_FILENAME_TEMPLATE', '{databasename}-{servername}-{datetime}.{extension}')
MEDIA_FILENAME_TEMPLATE = getattr(settings, 'DBBACKUP_MEDIA_FILENAME_TEMPLATE', '{servername}-{datetime}.{extension}')
FILENAME_TEMPLATE = getattr(settings, 'DBBACKUP_FILENAME_TEMPLATE', '{databasename}-{servername}-{datetime}.{extension}') # noqa
MEDIA_FILENAME_TEMPLATE = getattr(settings, 'DBBACKUP_MEDIA_FILENAME_TEMPLATE', '{servername}-{datetime}.{extension}') # noqa

GPG_ALWAYS_TRUST = getattr(settings, 'DBBACKUP_GPG_ALWAYS_TRUST', False)
GPG_RECIPIENT = GPG_ALWAYS_TRUST = getattr(settings, 'DBBACKUP_GPG_RECIPIENT', None)
Expand Down
4 changes: 3 additions & 1 deletion dbbackup/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ def filename_to_date(filename, datefmt=None):
return datetime.strptime(datestring, datefmt)


def filename_generate(extension, database_name='', servername=None, content_type='db', wildcard=None):
def filename_generate(
extension, database_name='', servername=None, content_type='db', wildcard=None
):
"""
Create a new backup filename.

Expand Down
14 changes: 8 additions & 6 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
pep8
coverage
django-storages
flake8
mock
pep8
psycopg2
pylint
coverage
python-dotenv
python-gnupg
django-storages
pytz
testfixtures
mock
python-dotenv
psycopg2
tox-gh-actions
tox
1 change: 1 addition & 0 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ def main(argv=None):
return result
execute_from_command_line(argv)


if __name__ == '__main__':
sys.exit(bool(main(sys.argv)))
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[flake8]
max-line-length = 99
exclude = tests,settings
max-line-length = 100
include = dbbackup
exclude = tests,settings,venv,docs
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def get_requirements():
def get_test_requirements():
return open('requirements-tests.txt').read().splitlines()


keywords = [
'django', 'database', 'media', 'backup',
'amazon', 's3' 'dropbox',
Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ deps =
-rrequirements-tests.txt
django2.2: Django>=2.2,<2.3
django3.0: Django>=3.0,<3.1
django3.1: Django>=3.1,<3.2
djangomaster: https://github.com/django/django/archive/master.zip
commands = {posargs:coverage run runtests.py}

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38

[testenv:lint]
basepython = python
deps =
Expand Down