Update project / gitlab ci settings
This commit is contained in:
parent
e495d7c188
commit
7d86cea6ec
12 changed files with 162 additions and 99 deletions
116
.gitlab-ci.yml
116
.gitlab-ci.yml
|
|
@ -4,101 +4,25 @@ stages:
|
|||
- lint
|
||||
- deploy
|
||||
|
||||
javascript build:
|
||||
image: node:12
|
||||
stage: build
|
||||
cache:
|
||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
paths:
|
||||
- node_modules/
|
||||
before_script:
|
||||
- npm install
|
||||
script:
|
||||
- npm run build
|
||||
variables:
|
||||
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"
|
||||
|
||||
python tests:
|
||||
services:
|
||||
- postgres:11
|
||||
- memcached:1.5.22
|
||||
image: python:3.7.4-slim-stretch
|
||||
stage: test
|
||||
variables:
|
||||
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
|
||||
cache:
|
||||
key: "$CI_COMMIT_REF_SLUG"
|
||||
paths:
|
||||
- .venv/
|
||||
- .cache/pip
|
||||
- .cache/poetry
|
||||
- node_modules/
|
||||
|
||||
javascript tests:
|
||||
image: node:12
|
||||
stage: test
|
||||
cache:
|
||||
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||
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
|
||||
include:
|
||||
- local: '/gitlab-ci/build.yml'
|
||||
- local: '/gitlab-ci/test.yml'
|
||||
- local: '/gitlab-ci/lint.yml'
|
||||
- local: '/gitlab-ci/deploy.yml'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue