Add gitlab ci settings
This commit is contained in:
parent
a798b9858c
commit
88cf5f9bd4
14 changed files with 61 additions and 34 deletions
25
.gitlab-ci.yml
Normal file
25
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
services:
|
||||
- postgres:9.6
|
||||
|
||||
variables:
|
||||
POSTGRES_DB: newsreader
|
||||
POSTGRES_USER: newsreader
|
||||
|
||||
python tests:
|
||||
image: python:3.7.4-slim-stretch
|
||||
stage: test
|
||||
variables:
|
||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
paths:
|
||||
- .cache/pip
|
||||
- env/
|
||||
before_script:
|
||||
- python3 -m venv env
|
||||
- source env/bin/activate
|
||||
- pip install -r requirements/gitlab.txt
|
||||
script:
|
||||
- python src/manage.py test newsreader --settings=newsreader.conf.gitlab
|
||||
- isort -rc src/ --check-only
|
||||
- black -l 100 --check src/
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[settings]
|
||||
include_trailing_comma = true
|
||||
line_length = 80
|
||||
line_length = 100
|
||||
multi_line_output = 3
|
||||
skip = env/, venv/
|
||||
default_section = THIRDPARTY
|
||||
|
|
|
|||
6
requirements/gitlab.txt
Normal file
6
requirements/gitlab.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
-r base.txt
|
||||
|
||||
factory-boy==2.12.0
|
||||
freezegun==0.3.12
|
||||
black==19.3b0
|
||||
isort==4.3.20
|
||||
4
requirements/testing.txt
Normal file
4
requirements/testing.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-r base.txt
|
||||
|
||||
factory-boy==2.12.0
|
||||
freezegun==0.3.12
|
||||
|
|
@ -10,6 +10,6 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
|||
INSTALLED_APPS += ["debug_toolbar", "django_extensions"]
|
||||
|
||||
try:
|
||||
pass
|
||||
from .local import * # noqa
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
15
src/newsreader/conf/gitlab.py
Normal file
15
src/newsreader/conf/gitlab.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from .base import * # noqa
|
||||
|
||||
|
||||
DEBUG = True
|
||||
|
||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
||||
"NAME": "newsreader",
|
||||
"USER": "newsreader",
|
||||
"HOST": "postgres",
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
# Generated by Django 2.2 on 2019-07-05 20:59
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
from typing import ContextManager
|
||||
|
||||
from requests.exceptions import ConnectionError as RequestConnectionError
|
||||
from requests.exceptions import (
|
||||
HTTPError,
|
||||
RequestException,
|
||||
SSLError,
|
||||
TooManyRedirects,
|
||||
)
|
||||
|
||||
from newsreader.news.collection.exceptions import (
|
||||
StreamConnectionError,
|
||||
|
|
|
|||
|
|
@ -23,12 +23,7 @@ from newsreader.news.collection.utils import build_publication_date
|
|||
from newsreader.news.core.models import Post
|
||||
from newsreader.news.core.tests.factories import PostFactory
|
||||
|
||||
from .mocks import (
|
||||
duplicate_mock,
|
||||
empty_mock,
|
||||
multiple_mock,
|
||||
multiple_update_mock,
|
||||
)
|
||||
from .mocks import duplicate_mock, empty_mock, multiple_mock, multiple_update_mock
|
||||
|
||||
|
||||
class FeedCollectorTestCase(TestCase):
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@ from unittest.mock import MagicMock, patch
|
|||
from django.test import TestCase
|
||||
|
||||
from requests.exceptions import ConnectionError as RequestConnectionError
|
||||
from requests.exceptions import (
|
||||
HTTPError,
|
||||
RequestException,
|
||||
SSLError,
|
||||
TooManyRedirects,
|
||||
)
|
||||
from requests.exceptions import HTTPError, RequestException, SSLError, TooManyRedirects
|
||||
|
||||
from newsreader.news.collection.exceptions import (
|
||||
StreamConnectionError,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
from django.urls import path
|
||||
|
||||
from newsreader.news.collection.views import (
|
||||
CollectionRuleAPIListView,
|
||||
CollectionRuleDetailView,
|
||||
)
|
||||
from newsreader.news.collection.views import CollectionRuleAPIListView, CollectionRuleDetailView
|
||||
|
||||
|
||||
endpoints = [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
from rest_framework.generics import (
|
||||
ListCreateAPIView,
|
||||
RetrieveUpdateDestroyAPIView,
|
||||
)
|
||||
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView
|
||||
|
||||
from newsreader.core.pagination import ResultSetPagination
|
||||
from newsreader.news.collection.models import CollectionRule
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
# Generated by Django 2.2 on 2019-07-05 20:59
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ from rest_framework.generics import (
|
|||
from rest_framework.permissions import IsAuthenticated
|
||||
|
||||
from newsreader.auth.permissions import IsPostOwner
|
||||
from newsreader.core.pagination import (
|
||||
LargeResultSetPagination,
|
||||
ResultSetPagination,
|
||||
)
|
||||
from newsreader.core.pagination import LargeResultSetPagination, ResultSetPagination
|
||||
from newsreader.news.core.models import Category, Post
|
||||
from newsreader.news.core.serializers import CategorySerializer, PostSerializer
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue