-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
58 lines (54 loc) · 1.52 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
variables:
POSTGRES_DB: dusken
CELERY_BROKER_URL: "redis://redis:6379/0"
default:
image: nikolaik/python-nodejs:python3.8-nodejs20
cache:
paths:
- .cache/pip
- .venv
- frontend/node_modules
build_frontend:
stage: test
script:
- bin/build-frontend
tests:
variables:
POSTGRES_DB: dusken
CELERY_BROKER_URL: "redis://redis:6379/0"
services:
- redis:latest
stage: test
before_script:
- apt-get update && apt-get install libsasl2-dev libldap2-dev -y
- poetry config virtualenvs.in-project true
- poetry run pip install -U pip pre-commit
- poetry install
script:
- poetry run python manage.py migrate
- poetry run python manage.py check
- poetry run pytest -v --cov dusken --cov-report term --cov-report xml:coverage.xml
- poetry run bin/pre-commit
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
deploy:
stage: deploy
before_script:
# Install ssh if not already
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
# Make SSH key available
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
# Add known host keys
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ssh [email protected] "$(< bin/deploy)"
only:
- main