]> kaliko git repositories - python-musicpd.git/blob - .gitlab-ci.yml
ci: s/only/changes/
[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       #- venv
20
21 .test:
22   stage: test
23   script:
24     - python -m venv venv
25     - source venv/bin/activate
26     - pip install pytest-cov
27     - py.test -q --cov=musicpd test.py
28   rules:
29     - changes:
30       - musicpd.py
31       - test.py
32     - if: $MUSICPD_TEST
33
34 test-py3.11:
35   extends:
36     - .cache_python
37     - .test
38   image: "python:3.11"
39
40 test-py3.10:
41   extends:
42     - .cache_python
43     - .test
44   image: "python:3.10"
45   coverage: '/musicpd.py\s+\d+\s+\d+\s+(\d+)%/'
46
47 test-py3.9:
48   extends:
49     - .cache_python
50     - .test
51   image: "python:3.9"
52
53 test-py3.8:
54   extends:
55     - .cache_python
56     - .test
57   image: "python:3.8"
58
59 test-py3.7:
60   extends:
61     - .cache_python
62     - .test
63   image: "python:3.7"
64
65 test-py3.6:
66   extends:
67     - .cache_python
68     - .test
69   image: "python:3.6"
70
71
72 build:
73   stage: build
74   extends:
75     - .cache_python
76   script:
77     - python -m venv venv
78     - source venv/bin/activate
79     - pip install build
80     # packaging test
81     - python3 -m build -s -w
82     - pip install dist/*.whl
83     - pip install twine
84     - twine check dist/*
85   artifacts:
86     expire_in: 1 week
87     paths:
88       - dist/*.whl
89       - dist/*.tar.gz
90       - dist/*.zip
91   rules:
92     - if: $CI_PIPELINE_SOURCE == "push"
93
94 tag_release:
95   stage: build
96   extends:
97     - .cache_python
98   script:
99     - python -m venv venv
100     - source venv/bin/activate
101     - pip install build
102     - python3 -m build -s -w
103   artifacts:
104     paths:
105       - dist/*.whl
106       - dist/*.tar.gz
107       - dist/*.zip
108     name: "$CI_PROJECT_NAME-$CI_COMMIT_TAG"
109   rules:
110     - if: $CI_COMMIT_TAG
111
112 pages:
113   stage: build
114   script:
115     - pip install sphinx sphinx_rtd_theme
116     - sphinx-build -d ./build/doctrees doc/source -b html ./public -D html_theme=sphinx_rtd_theme
117   artifacts:
118     paths:
119       - public
120   rules:
121     - if: $CI_COMMIT_BRANCH == "master"