aboutsummaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: c6eaac3d400195c1e718d0df68af9c4f3858bb20 (plain) (blame)
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
59
60
61
62
63
64
65
stages:
    - build
    - lint
    - test
    - deploy

cache:
    paths:
        - .cache/

variables:
    PIPENV_CACHE_DIR: "$CI_PROJECT_DIR/.cache"

build base image:
    image: docker:stable-git
    stage: build
    script:
        - sh scripts/deploy-ci.sh
    tags:
        - docker
    only:
        - master
        - django

lint:
    image: registry.gitlab.com/python-discord/projects/site/django-base:latest
    stage: lint
    script:
        - pipenv install --dev --system
        - flake8

test:
    image: registry.gitlab.com/python-discord/projects/site/django-base:latest
    stage: test
    services:
        - postgres:10-alpine
    before_script:
        - python manage.py migrate
        - pip install coverage
    script:
        - coverage run --source=api,home,pysite,wiki --branch manage.py test
    after_script:
        - coverage report
    artifacts:
        paths:
            - .coverage
    variables:
        DATABASE_URL: postgres://django:supersecret@postgres/pysite
        POSTGRES_DB: pysite
        POSTGRES_PASSWORD: supersecret
        POSTGRES_USER: django

pages:
    stage: deploy
    image: 
    dependencies:
        - test
    before_script:
        - pip install coverage
    script:
        - coverage html --directory=public
    artifacts:
        paths:
            - public
        expire_in: 30 days