-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (145 loc) · 4.87 KB
/
ci_tests.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: CI - Tests
on:
pull_request:
push:
branches:
- 'master'
- 'push-action/**' # Allow pushing to protected branches (using CasperWA/push-protected)
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
#while IFS="" read -r line || [ -n "${line}" ]; do
# if [[ "${line}" =~ ^pre-commit.*$ ]]; then
# pre_commit="${line}"
# fi
#done < requirements_dev.txt
#while IFS="" read -r line || [ -n "${line}" ]; do
# if [[ "${line}" =~ ^invoke.*$ ]]; then
# invoke="${line}"
# fi
#done < requirements_docs.txt
pip install -e .[dev]
# pip install ${pre_commit} ${invoke}
- name: Test with pre-commit
run: SKIP=pylint,pylint-tests pre-commit run --all-files
pylint-safety:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -e .[dev]
pip install safety
- name: Run pylint
run: pylint --rcfile=pyproject.toml --ignore-paths=tests/ --extension-pkg-whitelist='pydantic' --generated-members=dlite.* *.py dlite_cuds
# - name: Run pylint - tests
# run: pylint --rcfile=pyproject.toml --extension-pkg-whitelist='pydantic' --generated-members=dlite.* --disable=import-outside-toplevel,redefined-outer-name,import-error tests --recursive=yes
# Ignore ID 44715 for now.
# See this NumPy issue for more information: https://github.com/numpy/numpy/issues/19038
# Ignore ID 51668 for now.
# This is a subdependency.
# Ignore ID 48547, because of RDFLIB.
- name: Run safety
run: pip freeze | safety check --stdin --ignore 44715 --ignore 51668 --ignore 48547
pytest:
name: pytest (${{ matrix.os[1] }}-py${{ matrix.python-version }})
runs-on: ${{ matrix.os[0] }}
strategy:
fail-fast: false
matrix:
os:
- ["ubuntu-latest", "linux"]
- ["windows-latest", "windows"]
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install linux system dependencies
if: matrix.os[1] == 'linux'
run: echo "No dependencies defined."
- name: Install windows system dependencies
if: matrix.os[1] == 'windows'
run: echo "No dependencies defined."
shell: bash
- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -e .[dev]
- name: Test with pytest
run: pytest -vvv --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.9' && github.repository == 'team4.0/dlite-cuds'
uses: codecov/codecov-action@v3
with:
files: coverage.xml
flags: ${{ matrix.os[1] }}
build-package:
name: Build distribution package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel build
- name: Check building distribution
run: python -m build
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -e .[doc]
- name: Build
run: |
invoke create-api-reference-docs --pre-clean
invoke create-docs-index
if [ -n "$(git status --porcelain docs/api_reference docs/index.md)" ]; then
echo -e "\u274c Discrepancies found !"
echo -e "The following files in the documentation must be committed:"
git status --porcelain docs/api_reference docs/index.md
echo -e "\nRun:\n"
echo " invoke create-api-reference-docs --pre-clean"
echo -e " invoke create-docs-index\n"
echo "And commit the changed files."
exit 1
fi
mkdocs build --strict