Fakultas Ilmu Komputer UI

.gitlab-ci.yml 1.95 KB
Newer Older
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
1
stages:
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
2
  - unit-test
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
3
  - deploy
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
4
  - functional-test
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
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
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
  - apt-get update -qq && apt-get install -y -qq unzip
  - apt-get install -y google-chrome-stable
  - export CHROME_BIN=/usr/bin/google-chrome
  - google-chrome --version
  - apt-get install -y xvfb
  - wget https://chromedriver.storage.googleapis.com/77.0.3865.40/chromedriver_linux64.zip
  - unzip chromedriver_linux64.zip
  - 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"
  - pip install --upgrade pip
  - pip install -r requirements.txt
  - pip install --upgrade --ignore-installed urllib3
  - python manage.py makemigrations
  - python manage.py migrate
  - python manage.py collectstatic --no-input
  - python manage.py runserver 8000 &

Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
30
UnitTest:
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
31
  stage: unit-test
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
32
33
  when: on_success
  script:
34
35
36
37
    - coverage run --include='tutorial_*/*' manage.py test -p "unit_test*.py"
    - coverage report -m

DeployToHeroku:
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
38
39
40
41
42
43
44
45
46
47
48
49
  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
Izzan Fakhril Islam's avatar
Izzan Fakhril Islam committed
50
51
52
53
54
55
56

FunctionalTest:
  stage: functional-test
  when: on_success
  script:
    - coverage run --include='tutorial_*/*' manage.py test -p "functional_test*.py"
    - coverage report -m