Fakultas Ilmu Komputer UI

Commit f8f49316 authored by Annisa Devi Nurmalasari's avatar Annisa Devi Nurmalasari
Browse files

Initial Commit

parent 0b1a98cc
Pipeline #95466 failed with stages
in 2 minutes and 49 seconds
image: python:3.8
stages:
- code-cleanliness
- sonar
- test
- deploy
lint:
image: python:3.7.3
stage: code-cleanliness
script:
- pip install -r requirements.txt
- pylint walkiddie_backend hello_world accounts profiles admin toko investasi mainan sales_detail ringkasan_sales laporan_operator
allow_failure: true
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
Test:
image: python:3.7.3
stage: code-cleanliness
before_script:
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
- pip install -r requirements.txt
- python manage.py makemigrations
- python manage.py migrate
- apt-get update -qq && apt-get install -y -qq unzip
- apt-get install -y google-chrome-stable
- apt-get install -y xvfb
- apt-get install -y chromium
- python manage.py collectstatic --no-input
- python manage.py runserver 8000 &
when: on_success
script:
- coverage run --include="hello_world/*","accounts/*","profiles/*","admin/*","toko/*","investasi/*","mainan/*","sales_detail/*","ringkasan_sales/*","laporan_operator/*" --omit='manage.py' manage.py test
- coverage xml -i
- coverage report -m
cache:
paths:
- .cache/pip
# Feel free to remove this in your generated project.
.disable_on_template: &disable_on_template
rules:
- if: '$CI_COMMIT_REF_NAME != "template"'
.django_before_script: &django_before_script |-
pip install -r requirements.txt
python manage.py collectstatic --no-input
.coverage_artifacts: &coverage_artifacts
artifacts:
paths:
- coverage.xml
- .coverage*
SonarScanner:
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
stage: sonar
UnitTest:
<<: *disable_on_template
<<: *coverage_artifacts
stage: test
before_script:
- *django_before_script
script:
- sonar-scanner
-Dsonar.host.url=https://pmpl.cs.ui.ac.id/sonarqube
-Dsonar.login=$SONARQUBE_TOKEN
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
-Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
only:
- master
- staging
- coverage run --parallel --include="./*" --omit="manage.py,project_name/*"
manage.py test --exclude-tag=functional
Staging:
image: alpine
FunctionalTest:
<<: *disable_on_template
<<: *coverage_artifacts
stage: test
before_script:
- apt-get update -q && apt-get install -yq chromium-driver
- *django_before_script
script:
- coverage run --parallel --include="./*" --omit="manage.py,project_name/*"
manage.py test --tag=functional
Coverage:
<<: *disable_on_template
stage: deploy
before_script:
- apk add openssh
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -p $PRIVATE_SERVER_PORT $PRIVATE_SERVER >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- touch ~/.ssh/id_rsa
- echo $SSH_PRIVATE_KEY > ~/.ssh/id_rsa
- chmod 700 ~/.ssh/id_rsa
- pip install coverage
- coverage combine
script:
- ssh -p $PRIVATE_SERVER_PORT -l $PRIVATE_SERVER_USER $PRIVATE_SERVER -tt \
"ssh walkiddie -tt
'cd ../walkiddie/backend;
ssh-agent bash -c $PULL_COMMAND'"
environment:
name: staging
only:
- staging
- /^deploy-test.*$/
- coverage report -m
- coverage html
artifacts:
paths:
- htmlcov/
Production:
image: ruby:2.4
Deployment:
rules:
- if: '$CI_COMMIT_REF_NAME == "walkiddie_be_test"'
image: ruby:2.7
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_PRODUCTION --api-key=$HEROKU_APIKEY
- export HEROKU_API_KEY=$HEROKU_APIKEY
- heroku run --app $HEROKU_APPNAME_PRODUCTION python manage.py migrate
- dpl --provider=heroku --app=$HEROKU_APP_NAME --api-key=$HEROKU_API_KEY
- heroku run --app $HEROKU_APP_NAME migrate
environment:
name: production
url: $HEROKU_APP_HOST_PRODUCTION
only:
- master
url: https://$HEROKU_APP_NAME.herokuapp.com
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment