2021-09-24 19:38:54 +00:00
|
|
|
stages:
|
|
|
|
- test-lint-format
|
2021-09-25 21:28:04 +00:00
|
|
|
- deploy
|
2021-09-24 19:38:54 +00:00
|
|
|
|
|
|
|
.job_setup:
|
|
|
|
image: python:3.9
|
|
|
|
before_script:
|
|
|
|
- pip install -r requirements.txt
|
|
|
|
|
|
|
|
pylint:
|
|
|
|
extends:
|
|
|
|
- .job_setup
|
|
|
|
stage: test-lint-format
|
|
|
|
script:
|
|
|
|
- pylint src/ test/
|
|
|
|
|
|
|
|
autopep8:
|
|
|
|
extends:
|
|
|
|
- .job_setup
|
|
|
|
stage: test-lint-format
|
|
|
|
script:
|
|
|
|
- autopep8 --recursive --diff src/ test/
|
|
|
|
|
|
|
|
pytest:
|
|
|
|
extends:
|
|
|
|
- .job_setup
|
|
|
|
stage: test-lint-format
|
|
|
|
script:
|
|
|
|
- pytest --cov=src/
|
|
|
|
- coverage xml
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
cobertura: coverage.xml
|
2021-09-25 21:28:04 +00:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
stage: deploy
|
|
|
|
only:
|
|
|
|
- develop
|
|
|
|
before_script:
|
|
|
|
# https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor
|
|
|
|
- "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
- echo "${VPS_DEPLOYMENT_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- chmod 700 ~/.ssh
|
|
|
|
script:
|
|
|
|
- echo "Deploying ${CI_COMMIT_BRANCH}:${CI_COMMIT_SHA} ..."
|
|
|
|
- ssh musicube@${VPS_HOST} -o StrictHostKeyChecking=no -p ${VPS_SSH_PORT} "cd musicube; ./deploy.sh $CI_COMMIT_BRANCH"
|