1
0
Fork 0
forked from s3lph/matemat
matemat/.gitlab-ci.yml

45 lines
1.4 KiB
YAML

---
image: s3lph/matemat-ci:20180802-02
stages:
- test
- build
- staging
test:
stage: test
script:
- pip3 install -r requirements.txt
- sudo -u matemat python3 -m coverage run --branch -m unittest discover matemat
- sudo -u matemat python3 -m coverage report -m --include 'matemat/*' --omit '*/test_*.py' --omit 'matemat/webserver/test/abstract_httpd_test.py'
codestyle:
stage: test
script:
- pip3 install -r requirements.txt
- sudo -u matemat pycodestyle matemat
# - sudo -u matemat mypy --ignore-missing-imports --strict -p matemat
build:
stage: build
script:
- docker build -t "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" .
- docker tag "registry.gitlab.com/s3lph/matemat:$CI_COMMIT_SHA" "registry.gitlab.com/s3lph/matemat:latest-$([[ $CI_COMMIT_REF_NAME == "master" ]] && echo stable || echo staging)"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_TOKEN registry.gitlab.com
- docker push "registry.gitlab.com/s3lph/matemat:$CI_COMMIT_SHA"
- docker push registry.gitlab.com/s3lph/matemat:latest-$([[ $CI_COMMIT_REF_NAME == "master" ]] && echo stable || echo staging)
only:
- staging
- master
staging:
stage: staging
script:
- eval $(ssh-agent -s)
- ssh-add - <<<"$STAGING_SSH_PRIVATE_KEY"
- echo "$CI_COMMIT_SHA" | ssh -p 20022 -oStrictHostKeyChecking=no matemat@kernelpanic.lol
environment:
name: staging
url: https://matemat.kernelpanic.lol/
only:
- staging