stages: - build - test - deploy buiild job: stage: build image: python:3-buster script: - export PYTHONPATH=. - export FLASK_APP=period - apt-get update -qy - apt-get install -y python3-dev python3-pip - pip3 install --upgrade pip - pip3 install --upgrade setuptools - pip3 install Flask gunicorn pytest pytest-cov - pip3 install pendulum test job: stage: test image: python:3-buster script: - export PYTHONPATH=. - export FLASK_APP=period - apt-get update -qy - apt-get install -y python3-dev python3-pip - pip3 install --upgrade pip - pip3 install --upgrade setuptools - pip3 install Flask gunicorn pytest pytest-cov - pip3 install pendulum - pytest tests --cov --cov-report term --cov-report html --junitxml=report.xml artifacts: when: always reports: junit: report.xml deploy-period: stage: deploy environment: production image: debian:buster before_script: - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh script: - ssh ahosking@192.168.1.19 "cd /home/ahosking/period && git pull origin master && exit" only: - master