Fakultas Ilmu Komputer UI

.gitlab-ci.yml 931 Bytes
Newer Older
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
1
2
image: alpine:latest

3
stages:
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
4
  - test
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
5
  - deploy
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
6
7
8

services:
  - postgres:latest
9

Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
10
11
12
13
14
15
16
17
variables:
  POSTGRES_DB: database
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: "password"

Testing:
  stage: test
  image: joyzoursky/python-chromedriver:3.7
18
  before_script:
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
19
20
21
22
    - pip install -r requirements.txt
    - export DB_HOST=postgres
    - python manage.py collectstatic
    - python manage.py migrate
23
  script:
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
24
25
    - coverage run --source=accounts,lists manage.py test
    - coverage report -m
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
26
27
28
29
30
31
32
33
34
35

Deployment:
  image: ruby:2.4
  stage: deploy
  before_script:
    - gem install dpl
    - wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh
  script:
    - dpl --provider=heroku --app=$HEROKU_APPNAME --api-key=$HEROKU_APIKEY
    - export HEROKU_API_KEY=$HEROKU_APIKEY
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
36
    - heroku run --app $HEROKU_APPNAME /app/manage.py migrate
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
37
38
39
  environment:
    name: production
    url: $HEROKU_APP_HOST
Rayza Arasj Mahardhika's avatar
Rayza Arasj Mahardhika committed
40
41
42
43
  only: 
    refs:
      - master