/
.gitlab-ci.yml
63 lines (51 loc) · 1.64 KB
/
.gitlab-ci.yml
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
# This script is an edited version of the example found at
# https://git.ligo.org/lscsoft/example-ci-project/blob/python/.gitlab-ci.yml
# Each 0th-indentation level is a job that will be run within GitLab CI
# The only exception are a short list of reserved keywords
#
# https://docs.gitlab.com/ee/ci/yaml/#gitlab-ci-yml
# stages is a reserved keyword that defines job dependencies and
# parallelization. each stage runs in parallel but must complete
# before the next stage begins
stages:
- test
- release
# test on python 3.9
python-3.9:
stage: test
image: containers.ligo.org/cwinpy/cwinpy-containers/cwinpyci-python39
script:
# install in "editable" mode, so pytest runs with Cython code - see https://stackoverflow.com/a/48331262/1862861
- python -m pip install -e .
# run tests
- pytest
# Make the documentation
- cd docs
- make clean
- make html
# test on python 3.10
python-3.10:
stage: test
image: containers.ligo.org/cwinpy/cwinpy-containers/cwinpyci-python310
script:
- python -m pip install -e .
- pytest
# test pre-commit has picked up black/flake8 requirements
pre-commit-python-3.9:
stage: test
image: containers.ligo.org/cwinpy/cwinpy-containers/cwinpyci-python39
script:
- python -m pip install .[dev]
# run pre-commit checks
- pre-commit run --all-files --verbose --show-diff-on-failure
# for new tags create a release and upload to PyPI
generate_release:
stage: release
image: python
before_script:
- python -m pip install build setuptools_scm[toml] twine
script:
- python -m build --sdist --outdir dist/ .
- python -m twine upload dist/*
only:
- tags