Fakultas Ilmu Komputer UI

.gitlab-ci.yml 1.76 KB
Newer Older
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
1
2
3
4
5
6
7
8
9
10
11
12
stages:
  - test
  - deploy

UnitTest:
  stage: test
  before_script:
    - apt-get install -f
    - apt-get update -qy
    - apt-get install -y python-dev python-pip sudo postgresql postgresql-client libpq-dev libxss1 libappindicator1 libindicator7
    - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
    - echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
13
    - apt-get update -qq && apt-get install -y -qq unzip
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
14
15
    - apt-get install -y google-chrome-stable
    - export CHROME_BIN=/usr/bin/google-chrome
16
    - google-chrome --version
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
17
    - apt-get install -y xvfb
18
19
    - wget https://chromedriver.storage.googleapis.com/77.0.3865.40/chromedriver_linux64.zip
    - unzip chromedriver_linux64.zip
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
20
21
22
    - service postgresql start
    - sudo -u $DB_DEFAULT_OWNER psql -c "CREATE USER $DB_USERNAME WITH PASSWORD '$DB_PASSWORD' CREATEDB"
    - sudo -u $DB_DEFAULT_OWNER psql -c "CREATE DATABASE $DB_NAME OWNER $DB_USERNAME"
23
    - pip install --upgrade pip
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
24
    - pip install -r requirements.txt
25
    - pip install --upgrade --ignore-installed urllib3
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
    - python manage.py makemigrations
    - python manage.py migrate
    - python manage.py collectstatic --no-input
    - python manage.py runserver 8000 &
  when: on_success
  script:
    - coverage run --include='tutorial_*/*' manage.py test
    - coverage report -m

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_APIKEY=$HEROKU_APIKEY
    - heroku run --app $HEROKU_APPNAME migrate
  environment:
    name: production
    url: $HEROKU_APP_HOST