Added a staging deployment CI job.

This commit is contained in:
s3lph 2018-07-11 17:17:00 +02:00
parent 68a228e95f
commit 69e08a70be

View file

@ -3,8 +3,8 @@ image: s3lph/matemat-ci:20180711-01
stages: stages:
- test - test
- codestyle - build
- deploy - staging
test: test:
stage: test stage: test
@ -14,15 +14,24 @@ test:
- sudo -u matemat python3-coverage report -m --include 'matemat/*' --omit '*/test_*.py' - sudo -u matemat python3-coverage report -m --include 'matemat/*' --omit '*/test_*.py'
codestyle: codestyle:
stage: codestyle stage: test
script: script:
- pip3 install -r requirements.txt - pip3 install -r requirements.txt
- sudo -u matemat pycodestyle matemat - sudo -u matemat pycodestyle matemat
# - sudo -u matemat mypy --ignore-missing-imports --strict -p matemat # - sudo -u matemat mypy --ignore-missing-imports --strict -p matemat
docker_build_push: build:
stage: deploy stage: build
script: script:
- docker build -t "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" . - docker build -t "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_TOKEN registry.gitlab.com - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_TOKEN registry.gitlab.com
- docker push "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" - docker push "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)"
staging:
stage: staging
script:
- ssh add - <<<"$STAGING_SSH_PRIVATE_KEY"
- echo "$(git rev-parse HEAD)" | ssh -p 20022 matemat@kernelpanic.lol
environment:
- name: staging
- url: https://matemat.kernelpanic.lol/