diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..91d39213 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,71 @@ +name: Django CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.7.5] + + services: + mysql: + image: mysql:5.7 + env: + DB_DATABASE: python_blogs + DB_USER: root + DB_PASSWORD: + ports: ['3306:3306'] + + steps: + - uses: actions/checkout@v3 + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Copy settings + run: | + cp settings_local.py.template settings_local.py + + - name: Set up MySql + run: | + sudo service mysql start + sudo mysql -uroot -proot -e 'CREATE DATABASE python_blogs;' + - name: Run Migrations + run: | + python manage.py migrate + python manage.py loaddata data.json + env: + DBENGINE: django.db.backends.mysql + DBNAME: python_blogs + DBUSER: root + DBPASSWORD: + DBHOST: 127.0.0.1 + DBPORT: $ + - name: Run Tests + run: | + python manage.py test + env: + DBENGINE: django.db.backends.mysql + DBNAME: python_blogs + DBUSER: root + DBPASSWORD: + DBHOST: 127.0.0.1 + DBPORT: $ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8900f715..00000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -dist: xenial -language: python -cache: pip -python: - - "3.7.3" -install: - - pip install -r requirements.txt -before_script: - - cp settings_local.py.template settings_local.py -script: - - python manage.py test diff --git a/aldryn_newsblog/tests/test_admin.py b/aldryn_newsblog/tests/test_admin.py deleted file mode 100644 index 858a64bb..00000000 --- a/aldryn_newsblog/tests/test_admin.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import unicode_literals - -from django.test import TransactionTestCase - -from aldryn_people.models import Person - -from aldryn_newsblog.cms_appconfig import NewsBlogConfig -from aldryn_newsblog.models import Article - -from . import NewsBlogTestsMixin - - -class AdminTest(NewsBlogTestsMixin, TransactionTestCase): - - def test_admin_owner_default(self): - from django.contrib import admin - admin.autodiscover() - # since we now have data migration to create the default - # NewsBlogConfig (if migrations were not faked, django >1.7) - # we need to delete one of configs to be sure that it is pre selected - # in the admin view. - if NewsBlogConfig.objects.count() > 1: - # delete the app config that was created during test set up. - NewsBlogConfig.objects.filter(namespace='NBNS').delete() - user = self.create_user() - user.is_superuser = True - user.save() - - Person.objects.create(user=user, name=u' '.join( - (user.first_name, user.last_name))) - - admin_inst = admin.site._registry[Article] - self.request = self.get_request('en') - self.request.user = user - self.request.META['HTTP_HOST'] = 'example.com' - response = admin_inst.add_view(self.request) - option = r'