~sumner/sublime-music

ref: faaa6503e8b11b67ab968b96b4ed8118306ab0ea sublime-music/.gitlab-ci.yml -rw-r--r-- 2.7 KiB
faaa6503Sumner Evans ci: use sourcehut for PyPi deploy 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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

build_flatpak:
  image: registry.gitlab.com/sublime-music/sublime-music/flatpak-build:latest
  stage: build
  script:
    - cd flatpak
    - ./flatpak_build.sh
  artifacts:
    paths:
      - flatpak/sublime-music.flatpak

# 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 Flatpak builds.
flatpak_docker:
  image: docker:1.13
  stage: build-containers
  only:
    variables:
      - $REBUILD_FLATPAK_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/flatpak-build:latest ./cicd/flatpak-build
    - docker push $CI_REGISTRY_IMAGE/flatpak-build

# 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