Update project / gitlab ci settings
This commit is contained in:
parent
e495d7c188
commit
7d86cea6ec
12 changed files with 162 additions and 99 deletions
16
.coveragerc
Normal file
16
.coveragerc
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
[run]
|
||||||
|
source = ./src/newsreader/
|
||||||
|
omit =
|
||||||
|
**/tests/**
|
||||||
|
**/migrations/**
|
||||||
|
**/conf/**
|
||||||
|
**/apps.py
|
||||||
|
**/admin.py
|
||||||
|
**/tests.py
|
||||||
|
**/urls.py
|
||||||
|
**/wsgi.py
|
||||||
|
**/celery.py
|
||||||
|
**/__init__.py
|
||||||
|
|
||||||
|
[html]
|
||||||
|
directory = coverage
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -60,6 +60,7 @@ pip-delete-this-directory.txt
|
||||||
|
|
||||||
# Unit test / coverage reports
|
# Unit test / coverage reports
|
||||||
htmlcov/
|
htmlcov/
|
||||||
|
coverage/
|
||||||
.tox/
|
.tox/
|
||||||
.nox/
|
.nox/
|
||||||
.coverage
|
.coverage
|
||||||
|
|
|
||||||
116
.gitlab-ci.yml
116
.gitlab-ci.yml
|
|
@ -4,101 +4,25 @@ stages:
|
||||||
- lint
|
- lint
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
javascript build:
|
variables:
|
||||||
image: node:12
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||||
stage: build
|
DJANGO_SETTINGS_MODULE: "newsreader.conf.gitlab"
|
||||||
cache:
|
POSTGRES_HOST: "$POSTGRES_HOST"
|
||||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
POSTGRES_DB: "$POSTGRES_NAME"
|
||||||
paths:
|
POSTGRES_NAME: "$POSTGRES_NAME"
|
||||||
- node_modules/
|
POSTGRES_USER: "$POSTGRES_USER"
|
||||||
before_script:
|
POSTGRES_PASSWORD: "$POSTGRES_PASSWORD"
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- npm run build
|
|
||||||
|
|
||||||
python tests:
|
cache:
|
||||||
services:
|
key: "$CI_COMMIT_REF_SLUG"
|
||||||
- postgres:11
|
paths:
|
||||||
- memcached:1.5.22
|
- .venv/
|
||||||
image: python:3.7.4-slim-stretch
|
- .cache/pip
|
||||||
stage: test
|
- .cache/poetry
|
||||||
variables:
|
- node_modules/
|
||||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
|
||||||
DJANGO_SETTINGS_MODULE: "newsreader.conf.gitlab"
|
|
||||||
POSTGRES_HOST: "$POSTGRES_HOST"
|
|
||||||
POSTGRES_DB: "$POSTGRES_NAME"
|
|
||||||
POSTGRES_NAME: "$POSTGRES_NAME"
|
|
||||||
POSTGRES_USER: "$POSTGRES_USER"
|
|
||||||
POSTGRES_PASSWORD: "$POSTGRES_PASSWORD"
|
|
||||||
cache:
|
|
||||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
|
||||||
paths:
|
|
||||||
- .cache/pip
|
|
||||||
- .venv/
|
|
||||||
before_script:
|
|
||||||
- pip install poetry
|
|
||||||
- poetry config virtualenvs.in-project true
|
|
||||||
- poetry install --no-interaction
|
|
||||||
script:
|
|
||||||
- poetry run src/manage.py test newsreader
|
|
||||||
|
|
||||||
javascript tests:
|
include:
|
||||||
image: node:12
|
- local: '/gitlab-ci/build.yml'
|
||||||
stage: test
|
- local: '/gitlab-ci/test.yml'
|
||||||
cache:
|
- local: '/gitlab-ci/lint.yml'
|
||||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
- local: '/gitlab-ci/deploy.yml'
|
||||||
paths:
|
|
||||||
- node_modules/
|
|
||||||
before_script:
|
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- npm test
|
|
||||||
|
|
||||||
javascript linting:
|
|
||||||
image: node:12
|
|
||||||
stage: lint
|
|
||||||
cache:
|
|
||||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
|
||||||
paths:
|
|
||||||
- node_modules/
|
|
||||||
before_script:
|
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- npm run lint
|
|
||||||
|
|
||||||
python linting:
|
|
||||||
image: python:3.7.4-slim-stretch
|
|
||||||
stage: lint
|
|
||||||
variables:
|
|
||||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
|
||||||
DJANGO_SETTINGS_MODULE: "newsreader.conf.gitlab"
|
|
||||||
cache:
|
|
||||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
|
||||||
paths:
|
|
||||||
- .cache/pip
|
|
||||||
- .venv/
|
|
||||||
before_script:
|
|
||||||
- pip install poetry
|
|
||||||
- poetry config virtualenvs.in-project true
|
|
||||||
- poetry install --no-interaction
|
|
||||||
script:
|
|
||||||
- poetry run isort src/ --check-only --recursive
|
|
||||||
- poetry run black src/ --line-length 88 --check
|
|
||||||
- poetry run autoflake src/ --check --recursive --remove-all-unused-imports --ignore-init-module-imports
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
stage: deploy
|
|
||||||
image: debian:buster
|
|
||||||
environment:
|
|
||||||
name: production
|
|
||||||
url: rss.fudiggity.nl
|
|
||||||
before_script:
|
|
||||||
- apt-get update && apt-get install -y ansible git
|
|
||||||
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@git.fudiggity.nl/sonny/ansible-playbooks.git deployment
|
|
||||||
- mkdir /root/.ssh
|
|
||||||
- echo "192.168.178.63 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILbtcdgJBhVCKsO88cV19EYefDTopdYejEQCp1pYr1Ga" > /root/.ssh/known_hosts
|
|
||||||
- echo "$DEPLOY_KEY" > deployment/deploy_key && chmod 0600 deployment/deploy_key
|
|
||||||
script:
|
|
||||||
- ansible-playbook deployment/playbook.yml --inventory deployment/apps.yml --limit newsreader --user ansible --private-key deployment/deploy_key
|
|
||||||
only:
|
|
||||||
- development
|
|
||||||
|
|
|
||||||
7
gitlab-ci/build.yml
Normal file
7
gitlab-ci/build.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
static:
|
||||||
|
stage: build
|
||||||
|
image: node:12
|
||||||
|
before_script:
|
||||||
|
- npm install
|
||||||
|
script:
|
||||||
|
- npm run build
|
||||||
16
gitlab-ci/deploy.yml
Normal file
16
gitlab-ci/deploy.yml
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
deploy:
|
||||||
|
stage: deploy
|
||||||
|
image: debian:buster
|
||||||
|
environment:
|
||||||
|
name: production
|
||||||
|
url: rss.fudiggity.nl
|
||||||
|
before_script:
|
||||||
|
- apt-get update && apt-get install -y ansible git
|
||||||
|
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@git.fudiggity.nl/sonny/ansible-playbooks.git deployment
|
||||||
|
- mkdir /root/.ssh
|
||||||
|
- echo "192.168.178.63 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILbtcdgJBhVCKsO88cV19EYefDTopdYejEQCp1pYr1Ga" > /root/.ssh/known_hosts
|
||||||
|
- echo "$DEPLOY_KEY" > deployment/deploy_key && chmod 0600 deployment/deploy_key
|
||||||
|
script:
|
||||||
|
- ansible-playbook deployment/playbook.yml --inventory deployment/apps.yml --limit newsreader --user ansible --private-key deployment/deploy_key
|
||||||
|
only:
|
||||||
|
- master
|
||||||
22
gitlab-ci/lint.yml
Normal file
22
gitlab-ci/lint.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
python-linting:
|
||||||
|
stage: lint
|
||||||
|
allow_failure: true
|
||||||
|
image: python:3.7.4-slim-stretch
|
||||||
|
before_script:
|
||||||
|
- pip install poetry
|
||||||
|
- poetry config cache-dir ~/.cache/poetry
|
||||||
|
- poetry config virtualenvs.in-project true
|
||||||
|
- poetry install --no-interaction
|
||||||
|
script:
|
||||||
|
- poetry run isort src/ --check-only --recursive
|
||||||
|
- poetry run black src/ --line-length 88 --check
|
||||||
|
- poetry run autoflake src/ --check --recursive --remove-all-unused-imports --ignore-init-module-imports
|
||||||
|
|
||||||
|
javascript-linting:
|
||||||
|
stage: lint
|
||||||
|
allow_failure: true
|
||||||
|
image: node:12
|
||||||
|
before_script:
|
||||||
|
- npm install
|
||||||
|
script:
|
||||||
|
- npm run lint
|
||||||
23
gitlab-ci/test.yml
Normal file
23
gitlab-ci/test.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
python-tests:
|
||||||
|
stage: test
|
||||||
|
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
|
||||||
|
services:
|
||||||
|
- postgres:11
|
||||||
|
- memcached:1.5.22
|
||||||
|
image: python:3.7.4-slim-stretch
|
||||||
|
before_script:
|
||||||
|
- pip install poetry
|
||||||
|
- poetry config cache-dir .cache/poetry
|
||||||
|
- poetry config virtualenvs.in-project true
|
||||||
|
- poetry install --no-interaction
|
||||||
|
script:
|
||||||
|
- poetry run coverage run src/manage.py test newsreader
|
||||||
|
- poetry run coverage report
|
||||||
|
|
||||||
|
javascript-tests:
|
||||||
|
stage: test
|
||||||
|
image: node:12
|
||||||
|
before_script:
|
||||||
|
- npm install
|
||||||
|
script:
|
||||||
|
- npm test
|
||||||
46
poetry.lock
generated
46
poetry.lock
generated
|
|
@ -202,6 +202,17 @@ version = "0.0.4"
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
jinja2 = "*"
|
jinja2 = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
category = "dev"
|
||||||
|
description = "Code coverage measurement for Python"
|
||||||
|
name = "coverage"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
|
||||||
|
version = "5.1"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
toml = ["toml"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
category = "main"
|
category = "main"
|
||||||
description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design."
|
description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design."
|
||||||
|
|
@ -757,7 +768,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
|
||||||
testing = ["jaraco.itertools", "func-timeout"]
|
testing = ["jaraco.itertools", "func-timeout"]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
content-hash = "28046079901294125f012386748aa5433bc92b8237514e3f7e1bbceb0258ae44"
|
content-hash = "38cc29547dab994d438a7a4082fca9f557acfff59626df37ec9ee9f15ff094a0"
|
||||||
python-versions = "^3.7"
|
python-versions = "^3.7"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
|
|
@ -821,6 +832,39 @@ coreschema = [
|
||||||
{file = "coreschema-0.0.4-py2-none-any.whl", hash = "sha256:5e6ef7bf38c1525d5e55a895934ab4273548629f16aed5c0a6caa74ebf45551f"},
|
{file = "coreschema-0.0.4-py2-none-any.whl", hash = "sha256:5e6ef7bf38c1525d5e55a895934ab4273548629f16aed5c0a6caa74ebf45551f"},
|
||||||
{file = "coreschema-0.0.4.tar.gz", hash = "sha256:9503506007d482ab0867ba14724b93c18a33b22b6d19fb419ef2d239dd4a1607"},
|
{file = "coreschema-0.0.4.tar.gz", hash = "sha256:9503506007d482ab0867ba14724b93c18a33b22b6d19fb419ef2d239dd4a1607"},
|
||||||
]
|
]
|
||||||
|
coverage = [
|
||||||
|
{file = "coverage-5.1-cp27-cp27m-macosx_10_12_x86_64.whl", hash = "sha256:0cb4be7e784dcdc050fc58ef05b71aa8e89b7e6636b99967fadbdba694cf2b65"},
|
||||||
|
{file = "coverage-5.1-cp27-cp27m-macosx_10_13_intel.whl", hash = "sha256:c317eaf5ff46a34305b202e73404f55f7389ef834b8dbf4da09b9b9b37f76dd2"},
|
||||||
|
{file = "coverage-5.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:b83835506dfc185a319031cf853fa4bb1b3974b1f913f5bb1a0f3d98bdcded04"},
|
||||||
|
{file = "coverage-5.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:5f2294dbf7875b991c381e3d5af2bcc3494d836affa52b809c91697449d0eda6"},
|
||||||
|
{file = "coverage-5.1-cp27-cp27m-win32.whl", hash = "sha256:de807ae933cfb7f0c7d9d981a053772452217df2bf38e7e6267c9cbf9545a796"},
|
||||||
|
{file = "coverage-5.1-cp27-cp27m-win_amd64.whl", hash = "sha256:bf9cb9a9fd8891e7efd2d44deb24b86d647394b9705b744ff6f8261e6f29a730"},
|
||||||
|
{file = "coverage-5.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:acf3763ed01af8410fc36afea23707d4ea58ba7e86a8ee915dfb9ceff9ef69d0"},
|
||||||
|
{file = "coverage-5.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:dec5202bfe6f672d4511086e125db035a52b00f1648d6407cc8e526912c0353a"},
|
||||||
|
{file = "coverage-5.1-cp35-cp35m-macosx_10_12_x86_64.whl", hash = "sha256:7a5bdad4edec57b5fb8dae7d3ee58622d626fd3a0be0dfceda162a7035885ecf"},
|
||||||
|
{file = "coverage-5.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:1601e480b9b99697a570cea7ef749e88123c04b92d84cedaa01e117436b4a0a9"},
|
||||||
|
{file = "coverage-5.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:dbe8c6ae7534b5b024296464f387d57c13caa942f6d8e6e0346f27e509f0f768"},
|
||||||
|
{file = "coverage-5.1-cp35-cp35m-win32.whl", hash = "sha256:a027ef0492ede1e03a8054e3c37b8def89a1e3c471482e9f046906ba4f2aafd2"},
|
||||||
|
{file = "coverage-5.1-cp35-cp35m-win_amd64.whl", hash = "sha256:0e61d9803d5851849c24f78227939c701ced6704f337cad0a91e0972c51c1ee7"},
|
||||||
|
{file = "coverage-5.1-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:2d27a3f742c98e5c6b461ee6ef7287400a1956c11421eb574d843d9ec1f772f0"},
|
||||||
|
{file = "coverage-5.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:66460ab1599d3cf894bb6baee8c684788819b71a5dc1e8fa2ecc152e5d752019"},
|
||||||
|
{file = "coverage-5.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:5c542d1e62eece33c306d66fe0a5c4f7f7b3c08fecc46ead86d7916684b36d6c"},
|
||||||
|
{file = "coverage-5.1-cp36-cp36m-win32.whl", hash = "sha256:2742c7515b9eb368718cd091bad1a1b44135cc72468c731302b3d641895b83d1"},
|
||||||
|
{file = "coverage-5.1-cp36-cp36m-win_amd64.whl", hash = "sha256:dead2ddede4c7ba6cb3a721870f5141c97dc7d85a079edb4bd8d88c3ad5b20c7"},
|
||||||
|
{file = "coverage-5.1-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:01333e1bd22c59713ba8a79f088b3955946e293114479bbfc2e37d522be03355"},
|
||||||
|
{file = "coverage-5.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:e1ea316102ea1e1770724db01998d1603ed921c54a86a2efcb03428d5417e489"},
|
||||||
|
{file = "coverage-5.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:adeb4c5b608574a3d647011af36f7586811a2c1197c861aedb548dd2453b41cd"},
|
||||||
|
{file = "coverage-5.1-cp37-cp37m-win32.whl", hash = "sha256:782caea581a6e9ff75eccda79287daefd1d2631cc09d642b6ee2d6da21fc0a4e"},
|
||||||
|
{file = "coverage-5.1-cp37-cp37m-win_amd64.whl", hash = "sha256:00f1d23f4336efc3b311ed0d807feb45098fc86dee1ca13b3d6768cdab187c8a"},
|
||||||
|
{file = "coverage-5.1-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:402e1744733df483b93abbf209283898e9f0d67470707e3c7516d84f48524f55"},
|
||||||
|
{file = "coverage-5.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:a3f3654d5734a3ece152636aad89f58afc9213c6520062db3978239db122f03c"},
|
||||||
|
{file = "coverage-5.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:6402bd2fdedabbdb63a316308142597534ea8e1895f4e7d8bf7476c5e8751fef"},
|
||||||
|
{file = "coverage-5.1-cp38-cp38-win32.whl", hash = "sha256:8fa0cbc7ecad630e5b0f4f35b0f6ad419246b02bc750de7ac66db92667996d24"},
|
||||||
|
{file = "coverage-5.1-cp38-cp38-win_amd64.whl", hash = "sha256:79a3cfd6346ce6c13145731d39db47b7a7b859c0272f02cdb89a3bdcbae233a0"},
|
||||||
|
{file = "coverage-5.1-cp39-cp39-win32.whl", hash = "sha256:a82b92b04a23d3c8a581fc049228bafde988abacba397d57ce95fe95e0338ab4"},
|
||||||
|
{file = "coverage-5.1-cp39-cp39-win_amd64.whl", hash = "sha256:bb28a7245de68bf29f6fb199545d072d1036a1917dca17a1e75bbb919e14ee8e"},
|
||||||
|
{file = "coverage-5.1.tar.gz", hash = "sha256:f90bfc4ad18450c80b024036eaf91e4a246ae287701aaa88eaebebf150868052"},
|
||||||
|
]
|
||||||
django = [
|
django = [
|
||||||
{file = "Django-3.0.5-py3-none-any.whl", hash = "sha256:642d8eceab321ca743ae71e0f985ff8fdca59f07aab3a9fb362c617d23e33a76"},
|
{file = "Django-3.0.5-py3-none-any.whl", hash = "sha256:642d8eceab321ca743ae71e0f985ff8fdca59f07aab3a9fb362c617d23e33a76"},
|
||||||
{file = "Django-3.0.5.tar.gz", hash = "sha256:d4666c2edefa38c5ede0ec1655424c56dc47ceb04b6d8d62a7eac09db89545c1"},
|
{file = "Django-3.0.5.tar.gz", hash = "sha256:d4666c2edefa38c5ede0ec1655424c56dc47ceb04b6d8d62a7eac09db89545c1"},
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ black = "19.3b0"
|
||||||
isort = "4.3.21"
|
isort = "4.3.21"
|
||||||
autoflake = "1.3.1"
|
autoflake = "1.3.1"
|
||||||
tblib = "1.6.0"
|
tblib = "1.6.0"
|
||||||
|
coverage = "^5.1"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry>=0.12"]
|
requires = ["poetry>=0.12"]
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ AUTH_USER_MODEL = "accounts.User"
|
||||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||||
LANGUAGE_CODE = "en-us"
|
LANGUAGE_CODE = "en-us"
|
||||||
|
|
||||||
TIME_ZONE = "UTC"
|
TIME_ZONE = "Europe/Amsterdam"
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
USE_L10N = True
|
USE_L10N = True
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
@ -156,5 +156,5 @@ SWAGGER_SETTINGS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTRATION_OPEN = True
|
REGISTRATION_OPEN = True
|
||||||
ACCOUNT_ACTIVATION_DAYS = 7
|
|
||||||
REGISTRATION_AUTO_LOGIN = True
|
REGISTRATION_AUTO_LOGIN = True
|
||||||
|
ACCOUNT_ACTIVATION_DAYS = 7
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,10 @@ TEMPLATES = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Third party settings
|
||||||
|
AXES_FAILURE_LIMIT = 50
|
||||||
|
AXES_COOLOFF_TIME = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from .local import * # noqa
|
from .local import * # noqa
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
||||||
|
|
@ -38,3 +38,8 @@ TEMPLATES = [
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Third party settings
|
||||||
|
AXES_HANDLER = "axes.handlers.database.DatabaseHandler"
|
||||||
|
|
||||||
|
REGISTRATION_OPEN = False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue