.gitlab-ci.yml 1.26 KB
Newer Older
Chris Lamb's avatar
Chris Lamb committed
1 2 3 4
# https://docs.gitlab.com/ee/ci/yaml/

image: debian:stable-backports

5 6 7 8 9 10 11 12
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"

cache:
  paths:
    - "$CI_PROJECT_DIR/pip-cache"
  key: "$CI_PROJECT_ID"

Chris Lamb's avatar
Chris Lamb committed
13 14 15 16
test:
  stage: test
  before_script:
    - apt update -qy
17
    - env DEBIAN_FRONTEND=noninteractive apt install -y python3-dev python3-pip
Chris Lamb's avatar
Chris Lamb committed
18 19 20 21 22
    - pip3 install -r requirements.txt
  script:
    - coverage run --source=trydiffoscope trydiffoscope/manage.py test --verbosity=2
  after_script:
    - flake8 trydiffoscope --exit-zero
23
    - coverage report --omit=trydiffoscope/settings/\*,trydiffoscope/wsgi.py,\*/migrations/\*.py --fail-under=0 --show-missing
Chris Lamb's avatar
Chris Lamb committed
24 25
    - trydiffoscope/manage.py collectstatic --noinput --clear --verbosity=2
  coverage: '/^TOTAL\s+\d+\s+\d+\s+(\d+)%/'
26

27
.deploy: &deploy
28 29 30 31 32 33 34
  stage: deploy
  only:
    - master
  when: manual
  before_script:
    # Dependencies
    - apt update -qy
35
    - apt install -y python3-dev python3-pip openssh-client rsync virtualenv
36
    - pip3 install -r requirements.txt
Chris Lamb's avatar
Chris Lamb committed
37
    - pip3 install ansible==2.8.0
38
  script:
39
    - ansible/deploy
40 41 42

deploy:
  <<: *deploy
43
  variables:
Chris Lamb's avatar
Chris Lamb committed
44
    ANSIBLE_HOST_CONFIG: ansible_ssh_host=nyancat.chris-lamb.co.uk ansible_ssh_port=443
45 46 47
  environment:
    name: try.diffoscope.org
    url: https://try.diffoscope.org