Created
September 24, 2019 03:55
-
-
Save RiansyahTohamba/76d0f14061742a5b9c587b960b209217 to your computer and use it in GitHub Desktop.
example CI using selenium with firefox driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: python:3.7 | |
stages: | |
- test | |
- deploy | |
development: | |
stage: test | |
before_script: | |
- pip install -r requirements.txt | |
- python manage.py collectstatic --no-input | |
- python manage.py migrate | |
when: on_success | |
script: | |
- coverage run --omit='manage.py' manage.py test --parallel --reverse | |
- coverage report -m | |
deploy_staging: | |
stage: deploy | |
before_script: | |
- apt -qq update | |
- DEBIAN_FRONTEND=noninteractive apt -qq -y install xvfb firefox-esr | |
# download geckodriver as no distro offers a package | |
- apt install -qq -y jq # I don't want to parse JSON with regexes | |
- curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[].browser_download_url | select(contains("linux64"))' | xargs -n1 curl -sL | tar -xz -C /usr/local/bin | |
- chmod +x /usr/local/bin/geckodriver | |
# prepare Django installation | |
- python -m venv /opt/testing | |
# bundled pip and setuptools are outdated | |
- /opt/testing/bin/pip install --quiet --upgrade pip setuptools | |
- /opt/testing/bin/pip install --quiet -r requirements.txt | |
# deploy to heroku | |
- apt-get install -y ruby-dev | |
- gem install dpl | |
- wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh | |
when: on_success | |
allow_failure: false | |
script: | |
- dpl --provider=heroku --app=$HEROKU_NAME --api-key=$HEROKU_API_KEY_STAGING | |
- export HEROKU_API_KEY=$HEROKU_API_KEY_STAGING | |
- heroku run --app $HEROKU_NAME migrate & | |
- xvfb-run /opt/testing/bin/python manage.py test functional_test.new_visitor_test | |
environment: | |
name: heroku | |
url: $HEROKU_HOST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment