-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
144 lines (117 loc) · 3.04 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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
before_script:
- git lfs pull
stages:
- test
- deploy
test_spechomo:
stage: test
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
script:
- source /root/mambaforge/bin/activate ci_env
# run tests
- make pytest # test are called here
# create the docs
- make docs
artifacts:
expose_as: 'Test and coverage report'
paths:
- htmlcov/
- report.html
- docs/_build/html/
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: report.xml
expire_in: 30 days
when: always
test_styles:
stage: test
script:
- source /root/mambaforge/bin/activate ci_env
- make lint
artifacts:
paths:
# - tests/data/test_outputs/*.log # log files are deleted by test teardown method
- tests/linting/flake8.log
- tests/linting/pycodestyle.log
- tests/linting/pydocstyle.log
when: always
test_urls:
stage: test
script:
- source /root/mambaforge/bin/activate ci_env
- pip install -U urlchecker
- make urlcheck
when: always
test_spechomo_install:
stage: test
script:
- source /root/mambaforge/bin/activate
- mamba update -n base -c conda-forge --all
# create spechomo environment from environment_spechomo.yml
- mamba env create --name spechomo_testinstall -f tests/gitlab_CI_docker/context/environment_spechomo.yml
- conda activate spechomo_testinstall
# run installer
- pip install .
# check if all dependencies are correctly installed
- pip check
# test importability
- cd ..
- pwd
- ls
- python -c "import spechomo; print(spechomo)"
- python -c "from spechomo import SpectralHomogenizer"
pages:
stage: deploy
dependencies:
- test_spechomo
script:
# Create the public directory
- rm -rf public
- mkdir public
- mkdir -p public/doc
- mkdir -p public/coverage
- mkdir -p public/test_reports
# Copy over the docs
- cp -r docs/_build/html/* public/doc/
# Copy over the coverage reports
- cp -r htmlcov/* public/coverage/
# Copy over the test reports
- cp report.html public/test_reports/
# Check if everything is working great
- ls -al public
- ls -al public/doc
- ls -al public/coverage
- ls -al public/test_reports
artifacts:
paths:
- public
expire_in: 30 days
only:
- main
- feature/add_docs
deploy_pypi:
stage: deploy
dependencies:
- test_spechomo
script:
- source /root/mambaforge/bin/activate ci_env
- pip install -U twine build
- python -m build --sdist
- twine check dist/*
- twine upload dist/* # requires creds as environment variables
only:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
except:
- dev
create_github_release:
stage: deploy
dependencies:
- test_spechomo
script:
- bash ./.github/create_release_from_gitlab_ci.sh # uses environment variables set in the UI
only:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
except:
- dev