Files
sublime-music/.gitlab-ci.yml
2021-05-30 22:47:29 -06:00

98 lines
2.0 KiB
YAML

stages:
- build-containers
- test
- build
- deploy
- verify
- release
variables:
GIT_SUBMODULE_STRATEGY: recursive
LC_ALL: "C.UTF-8"
LANG: "C.UTF-8"
cache:
paths:
- .venv/
image: registry.gitlab.com/sublime-music/sublime-music/python-build:latest
lint:
stage: test
before_script:
- ./cicd/install-project-deps.sh
script:
- poetry check
- poetry run black --check .
- poetry run flake8
- poetry run mypy sublime_music tests/**/*.py
- poetry run cicd/custom_style_check.py
test:
stage: test
before_script:
- ./cicd/install-project-deps.sh
- ./cicd/start-dbus.sh
- apt install xvfb
- Xvfb :119 -screen 0 1024x768x16 &
- export DISPLAY=:119
script:
- poetry run ./cicd/pytest.sh
artifacts:
paths:
- htmlcov
build:
stage: build
before_script:
- ./cicd/install-project-deps.sh
script:
- poetry build
artifacts:
paths:
- dist/*
expire_in: 7 days
# Deploy documenation and code coverage to GitLab Pages
pages:
only:
- master
stage: deploy
before_script:
- ./cicd/install-project-deps.sh
- ./cicd/start-dbus.sh
script:
- ./cicd/pages-build.sh
artifacts:
paths:
- public
publish_release:
stage: release
only:
variables:
# Only verify the deploy if it's a version tag.
- $CI_COMMIT_TAG =~ /^v.*/
before_script:
- ./cicd/install-project-deps.sh
script:
- poetry run ./cicd/publish-gitlab-release.sh
# Scheduled Jobs
# =============================================================================
# Create the Docker image for Python testing/builds.
python_docker:
image: docker:1.13
stage: build-containers
only:
variables:
- $REBUILD_PYTHON_DOCKER == "True"
services:
- docker:dind
script:
- docker version
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/python-build:latest ./cicd/python-build
- docker push $CI_REGISTRY_IMAGE/python-build:latest