-
Notifications
You must be signed in to change notification settings - Fork 134
347 lines (343 loc) · 11.8 KB
/
main.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2023.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
name: Finance Unit Tests
on:
push:
branches:
- main
- 'stable/**'
pull_request:
branches:
- main
- 'stable/**'
schedule:
# run every day at 1AM
- cron: '0 1 * * *'
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
Checks:
if: github.repository_owner == 'qiskit-community'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7]
steps:
- name: Print Concurrency Group
env:
CONCURRENCY_GROUP: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
run: |
echo -e "\033[31;1;4mConcurrency Group\033[0m"
echo -e "$CONCURRENCY_GROUP\n"
shell: bash
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- uses: ./.github/actions/install-main-dependencies
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
terra-main: "false"
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-finance
with:
os: ${{ matrix.os }}
- name: Install Dependencies
run: |
pip install jupyter qiskit-terra[visualization]
sudo apt-get -y install pandoc graphviz
sudo apt-get -y install python3-enchant
sudo apt-get -y install hunspell-en-us
pip install pyenchant
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
shell: bash
- run: pip check
if: ${{ !cancelled() }}
shell: bash
- name: Copyright Check
run: |
python tools/check_copyright.py -check
if: ${{ !cancelled() }}
shell: bash
- run: make spell
if: ${{ !cancelled() }}
shell: bash
- name: Style Check
run: |
make clean_sphinx
make style
if: ${{ !cancelled() }}
shell: bash
- name: Run make html
run: |
make clean_sphinx
make html
cd docs/_build/html
mkdir artifacts
tar -zcvf artifacts/documentation.tar.gz --exclude=./artifacts .
if: ${{ !cancelled() }}
shell: bash
- name: Run upload documentation
uses: actions/upload-artifact@v3
with:
name: documentation
path: docs/_build/html/artifacts/documentation.tar.gz
if: ${{ !cancelled() }}
- run: make doctest
if: ${{ !cancelled() }}
shell: bash
Finance:
if: github.repository_owner == 'qiskit-community'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9, '3.10.6']
include:
- os: macos-latest
python-version: 3.8
- os: macos-latest
python-version: '3.10.6'
- os: windows-2019
python-version: 3.8
- os: windows-2019
python-version: '3.10'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- name: install Windows dependencies
run: |
source "$CONDA/etc/profile.d/conda.sh"
conda create -n scsenv python=${{ matrix.python-version }}
conda activate scsenv
conda install -y scs lapack cvxpy -c conda-forge
if: ${{ matrix.os == 'windows-2019' }}
shell: bash
- uses: ./.github/actions/install-main-dependencies
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-finance
with:
os: ${{ matrix.os }}
- name: Run lint
run: |
if [ "${{ matrix.os }}" == "windows-2019" ]; then
source "$CONDA/etc/profile.d/conda.sh"
conda activate scsenv
fi
make lint
shell: bash
- name: Run mypy
run: |
if [ "${{ matrix.os }}" == "windows-2019" ]; then
source "$CONDA/etc/profile.d/conda.sh"
conda activate scsenv
fi
make mypy
if: ${{ !cancelled() }}
shell: bash
- name: Run lint latest version
run: |
if [ "${{ matrix.os }}" == "windows-2019" ]; then
source "$CONDA/etc/profile.d/conda.sh"
conda activate scsenv
fi
pip install -U -r requirements-dev.txt
make lint
shell: bash
- name: Finance Unit Tests under Python ${{ matrix.python-version }}
uses: ./.github/actions/run-tests
with:
os: ${{ matrix.os }}
event-name: ${{ github.event_name }}
run-slow: ${{ contains(github.event.pull_request.labels.*.name, 'run_slow') }}
python-version: ${{ matrix.python-version }}
if: ${{ !cancelled() }}
- name: Deprecation Messages
run: |
if [ "${{ matrix.os }}" == "windows-2019" ]; then
source "$CONDA/etc/profile.d/conda.sh"
conda activate scsenv
fi
mkdir ./ci-artifact-data
python tools/extract_deprecation.py -file out.txt -output ./ci-artifact-data/fin.dep
shell: bash
- name: Coverage combine
run: |
if [ "${{ matrix.os }}" == "windows-2019" ]; then
source "$CONDA/etc/profile.d/conda.sh"
conda activate scsenv
fi
coverage3 combine
mv .coverage ./ci-artifact-data/fin.dat
if: ${{ matrix.python-version == 3.7 }}
shell: bash
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}
path: ./ci-artifact-data/*
Tutorials:
if: github.repository_owner == 'qiskit-community'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.8, '3.10']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- uses: ./.github/actions/install-main-dependencies
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-finance
with:
os: ${{ matrix.os }}
- name: Install Dependencies
run: |
pip install jupyter qiskit-terra[visualization]
sudo apt-get install -y pandoc graphviz
shell: bash
- name: Run Finance Tutorials
env:
QISKIT_PARALLEL: False
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: |
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
make html
cd docs/_build/html
mkdir artifacts
tar -zcvf artifacts/tutorials.tar.gz --exclude=./artifacts .
shell: bash
- name: Run upload tutorials
uses: actions/upload-artifact@v3
with:
name: tutorials${{ matrix.python-version }}
path: docs/_build/html/artifacts/tutorials.tar.gz
- name: Run stable tutorials
env:
QISKIT_PARALLEL: False
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: |
# clean last sphinx output
make clean_sphinx
# get current version
version=$(pip show qiskit-finance | awk -F. '/^Version:/ { print substr($1,10), $2-1 }' OFS=.)
# download stable version
wget https://codeload.github.com/qiskit-community/qiskit-finance/zip/stable/$version -O /tmp/repo.zip
unzip /tmp/repo.zip -d /tmp/
# copy stable tutorials to main tutorials
rm -rf docs/tutorials/*
cp -R /tmp/qiskit-finance-stable-$version/docs/tutorials/* docs/tutorials
# run tutorials and zip results
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
# ignore unreleased/untagged notes
tools/ignore_untagged_notes.sh
make html
cd docs/_build/html
mkdir artifacts
tar -zcvf artifacts/tutorials.tar.gz --exclude=./artifacts .
if: ${{ matrix.python-version == 3.8 && !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
shell: bash
- name: Run upload stable tutorials
uses: actions/upload-artifact@v3
with:
name: tutorials-stable${{ matrix.python-version }}
path: docs/_build/html/artifacts/tutorials.tar.gz
if: ${{ matrix.python-version == 3.8 && !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
Deprecation_Messages_and_Coverage:
if: github.repository_owner == 'qiskit-community'
needs: [Checks, Finance, Tutorials]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest-3.7
path: /tmp/f37
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest-3.8
path: /tmp/f38
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest-3.9
path: /tmp/f39
- uses: actions/download-artifact@v3
with:
name: ubuntu-latest-3.10.6
path: /tmp/f310
- uses: actions/download-artifact@v3
with:
name: macos-latest-3.8
path: /tmp/m38
- uses: actions/download-artifact@v3
with:
name: macos-latest-3.10.6
path: /tmp/m310
- uses: actions/download-artifact@v3
with:
name: windows-2019-3.8
path: /tmp/w38
- uses: actions/download-artifact@v3
with:
name: windows-2019-3.10
path: /tmp/w310
- name: Install Dependencies
run: pip install -U coverage coveralls diff-cover
shell: bash
- name: Combined Deprecation Messages
run: |
sort -f -u /tmp/f37/fin.dep /tmp/f38/fin.dep /tmp/f39/fin.dep /tmp/f310/fin.dep /tmp/m38/fin.dep /tmp/m310/fin.dep /tmp/w38/fin.dep /tmp/w310/fin.dep || true
shell: bash
- name: Coverage combine
run: coverage3 combine /tmp/f37/fin.dat
shell: bash
- name: Upload to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github
shell: bash