musicube/.gitlab-ci.yml

51 lines
1.1 KiB
YAML

stages:
- test-lint-format
- deploy
.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:
coverage_report:
coverage_format: cobertura
path: coverage.xml
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"