Skip to content

Instantly share code, notes, and snippets.

@edsoncelio
Created November 22, 2019 12:56
Show Gist options
  • Save edsoncelio/de9cc0d41060f620310d04de70367905 to your computer and use it in GitHub Desktop.
Save edsoncelio/de9cc0d41060f620310d04de70367905 to your computer and use it in GitHub Desktop.
Gitlab-CI to python project
stages:
- test
- deploy
test:
stage: test
script:
# this configures Django application to use attached postgres database that is run on `postgres` host
- export DATABASE_URL=postgres://postgres:@postgres:5432/python-test-app
- apt-get update -qy
- apt-get install -y python-dev python-pip
- pip install -r requirements.txt
- python manage.py test
staging:
stage: deploy
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=gitlab-ci-python-test-staging --api-key=$HEROKU_STAGING_API_KEY
only:
- master
production:
stage: deploy
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=gitlab-ci-python-test-prod --api-key=$HEROKU_PRODUCTION_API_KEY
only:
- tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment