]> kaliko git repositories - python-musicpd.git/blob - .gitlab-ci.yml
Releasing 0.9.0
[python-musicpd.git] / .gitlab-ci.yml
1 ---
2 image: python:latest
3
4 before_script:
5   - python -V      # Print out python version for debugging
6
7 stages:
8   - test
9   - build
10
11 .cache_python:
12   variables:
13     FF_USE_FASTZIP: 1  # enable faster caching/artifacting
14     PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
15   cache:
16     key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
17     paths:  # cache the venv and pip cache (you may opt to use just 1 of these)
18       - $PIP_CACHE_DIR
19
20 .test:
21   stage: test
22   script:
23     - python -m venv venv
24     - source venv/bin/activate
25     - pip install pytest-cov
26     - py.test -q --cov=musicpd test.py
27   rules:
28     - changes:
29         - musicpd.py
30         - test.py
31     - if: $CI_PIPELINE_SOURCE == "schedule"
32
33 test-py3.12:
34   extends:
35     - .cache_python
36     - .test
37   image: "python:3.12"
38
39 test-py3.11:
40   extends:
41     - .cache_python
42     - .test
43   image: "python:3.11"
44
45 test-py3.10:
46   extends:
47     - .cache_python
48     - .test
49   image: "python:3.10"
50   coverage: '/musicpd.py\s+\d+\s+\d+\s+(\d+)%/'
51
52 test-py3.9:
53   extends:
54     - .cache_python
55     - .test
56   image: "python:3.9"
57
58 test-py3.8:
59   extends:
60     - .cache_python
61     - .test
62   image: "python:3.8"
63
64 test-py3.7:
65   extends:
66     - .cache_python
67     - .test
68   image: "python:3.7"
69
70 test-py3.6:
71   extends:
72     - .cache_python
73     - .test
74   image: "python:3.6"
75
76
77 build:
78   stage: build
79   extends:
80     - .cache_python
81   script:
82     - python -m venv venv
83     - source venv/bin/activate
84     - pip install build
85     # packaging test
86     - python3 -m build -s -w
87     - pip install dist/*.whl
88     - pip install twine
89     - twine check dist/*
90   artifacts:
91     expire_in: 1 week
92     paths:
93       - dist/*.*
94   rules:
95     - if: $CI_PIPELINE_SOURCE == "push"
96       changes:
97         - .gitlab-ci.yml
98         - musicpd.py
99         - test.py
100         - MANIFEST.in
101         - pyproject.toml
102     - if: $CI_PIPELINE_SOURCE == "schedule"
103
104 tag_release:
105   stage: build
106   extends:
107     - .cache_python
108   script:
109     - python -m venv venv
110     - source venv/bin/activate
111     - pip install build
112     - python3 -m build -s -w
113   artifacts:
114     paths:
115       - dist/*.*
116     name: "$CI_PROJECT_NAME-$CI_COMMIT_TAG"
117   rules:
118     - if: $CI_COMMIT_TAG
119
120 # Documentation
121 build_doc:
122   stage: build
123   script:
124     - pip install sphinx sphinx_rtd_theme
125     - sphinx-build doc/source -b html ./html -D html_theme=sphinx_rtd_theme -E -W -n --keep-going
126   rules:
127     - if: $CI_PIPELINE_SOURCE == "push"
128       changes:
129         - doc/source/*
130     - if: $CI_PIPELINE_SOURCE == "schedule"
131
132 pages:
133   stage: build
134   script:
135     - pip install sphinx sphinx_rtd_theme
136     - sphinx-build -d ./build/doctrees doc/source -b html ./public -D html_theme=sphinx_rtd_theme
137   artifacts:
138     paths:
139       - public
140   rules:
141     - if: $CI_COMMIT_BRANCH == "master"