Skip to content

Instantly share code, notes, and snippets.

@argaghulamahmad
Last active October 31, 2018 14:16
Show Gist options
  • Save argaghulamahmad/57f76449b9249adf1218188ec72ddeaa to your computer and use it in GitHub Desktop.
Save argaghulamahmad/57f76449b9249adf1218188ec72ddeaa to your computer and use it in GitHub Desktop.
func & unit test gitlab yml config
stages:
- test
- deploy
UnitTest:
image: python:3.6
stage: test
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
- wget https://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- python manage.py collectstatic --no-input
- python manage.py runserver 8000 &
when: on_success
script:
- coverage run --include='*' 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_API_KEY=$HEROKU_APIKEY
- heroku run --app $HEROKU_APPNAME migrate
environment:
name: production
url: $HEROKU_APP_HOST
def setUp(self):
chrome_options = Options()
chrome_options.add_argument('--dns-prefetch-disable')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('disable-gpu')
service_log_path = "./chromedriver.log"
service_args = ['--verbose']
self.selenium = webdriver.Chrome('./chromedriver', chrome_options=chrome_options)
self.selenium.implicitly_wait(25)
super(Story6FunctionalTest,self).setUp()
@argaghulamahmad
Copy link
Author

mantap, terima kasih atas @laymonage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment