]> kaliko git repositories - python-musicpd.git/blob - .gitlab-ci.yml
ci: Add caching
[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   only:
29     - pushes
30
31 test-py3.11:
32   extends:
33     - .cache_python
34     - .test
35   image: "python:3.11"
36
37 test-py3.10:
38   extends:
39     - .cache_python
40     - .test
41   image: "python:3.10"
42   coverage: '/musicpd.py\s+\d+\s+\d+\s+(\d+)%/'
43
44 test-py3.9:
45   extends:
46     - .cache_python
47     - .test
48   image: "python:3.9"
49
50 test-py3.8:
51   extends:
52     - .cache_python
53     - .test
54   image: "python:3.8"
55
56 test-py3.7:
57   extends:
58     - .cache_python
59     - .test
60   image: "python:3.7"
61
62 test-py3.6:
63   extends:
64     - .cache_python
65     - .test
66   image: "python:3.6"
67
68
69 build:
70   stage: build
71   script:
72     # packaging test
73     - python setup.py bdist_wheel sdist
74     - pip install dist/*.whl
75     - pip install twine
76     - twine check dist/*
77   artifacts:
78     expire_in: 1 week
79     paths:
80       - dist/*.whl
81       - dist/*.tar.gz
82       - dist/*.zip
83   only:
84     - pushes
85
86 tag_release:
87   stage: build
88   script:
89     - python setup.py bdist_wheel sdist
90   artifacts:
91     paths:
92       - dist/*.whl
93       - dist/*.tar.gz
94       - dist/*.zip
95     name: "$CI_PROJECT_NAME-$CI_COMMIT_TAG"
96   only:
97     - tags
98
99 pages:
100   stage: build
101   script:
102     - pip install sphinx sphinx_rtd_theme
103     - sphinx-build -d ./build/doctrees doc/source -b html ./public -D html_theme=sphinx_rtd_theme
104   artifacts:
105     paths:
106       - public
107   only:
108     - master