-
Notifications
You must be signed in to change notification settings - Fork 6
240 lines (203 loc) · 7.12 KB
/
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
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
name: Ubuntu & Windows CI
on:
pull_request:
push:
jobs:
gcc8-build:
name: GCC8 build
strategy:
matrix:
python-version: ["3.7.5"]
os: ["ubuntu-self-hosted","windows-self-hosted"]
runs-on: ${{ matrix.os }}
env:
CXX_COMPILER: "g++-8"
C_COMPILER: "gcc-8"
PYTHON: ${{ matrix.python-version }}
COVERAGE: "ON"
BOOST_ROOT: "C:/boost_1_75_0"
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: lukka/get-cmake@latest
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install Python dependencies
run: pip install -U --only-binary=numpy,scipy numpy scipy openfermion
- name: Install qulacs for Windows
run: ./script/build_msvc_2019.bat
if: ${{ contains(matrix.os, 'windows') }}
- name: Install qulacs for Ubuntu
run: ./script/build_gcc.sh
if: ${{ contains(matrix.os, 'ubuntu') }}
- name: Install qulacs Python module
run: python setup.py install
- name: Test in Windows
run: |
cmake --build ./visualstudio --target test --config Release
cmake --build ./visualstudio --target pythontest --config Release
if: ${{ contains(matrix.os, 'windows') }}
- name: Test in Ubuntu
run: |
cd ./build
make test -j
make pythontest -j
if: ${{ contains(matrix.os, 'ubuntu') }}
nvcc-gcc8-GPUbuild:
name: nvcc + gcc8 build
strategy:
matrix:
python-version: ["3.7.5"]
runs-on: ["ubuntu-self-hosted"]
env:
CXX_COMPILER: "g++-8"
C_COMPILER: "gcc-8"
PYTHON: ${{ matrix.python-version }}
COVERAGE: "ON"
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: lukka/get-cmake@latest
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install Python dependencies
run: pip install -U --only-binary=numpy,scipy numpy scipy openfermion
- name: Install qulacs for Ubuntu
run: ./script/build_gcc_with_gpu.sh
if: ${{ contains(matrix.os, 'ubuntu') }}
- name: Install qulacs Python module
run: python setup.py install
- name: Test in Ubuntu
run: |
cd ./build
make test -j
make pythontest -j
if: ${{ contains(matrix.os, 'ubuntu') }}
source-dist:
name: Source dist
needs: gcc8-build
strategy:
matrix:
python-version: ["3.7.5"]
runs-on: "ubuntu-self-hosted"
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_QULACS }}
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Run sdist
run: python setup.py sdist
- name: Uplead the source if the Git tag is set
run: |
python -m pip install twine
python -m twine upload dist/*
# This condition is refered for:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
if: ${{ contains(github.ref, '/tags/') }}
source-dist-gpu:
name: Source dist (Qulacs-GPU)
needs: gcc8-build
strategy:
matrix:
python-version: ["3.7.5"]
runs-on: "ubuntu-self-hosted"
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_QULACS_GPU }}
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Switch setup.py to GPU enabled version
run: cp setup_gpu.py setup.py
- name: Run sdist
run: python setup.py sdist
- name: Uplead the source if the Git tag is set
run: |
python -m pip install twine
python -m twine upload dist/*
# This condition is refered for:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
if: ${{ contains(github.ref, '/tags/') }}
wheel-build:
name: Python wheel build
needs: gcc8-build
strategy:
matrix:
python-version: ["3.7.5"]
os: ["ubuntu-self-hosted","windows-self-hosted"]
runs-on: ${{ matrix.os }}
env:
CXX_COMPILER: "g++-8"
C_COMPILER: "gcc-8"
PYTHON: ${{ matrix.python-version }}
COVERAGE: "ON"
BOOST_ROOT: "C:/boost_1_75_0"
CIBW_TEST_COMMAND: "python {project}/python/test/test_qulacs.py"
CIBW_TEST_REQUIRES: "numpy scipy openfermion"
CIBW_BEFORE_BUILD: "pip install cmake"
CIBW_BEFORE_BUILD_LINUX: "pip install cmake && yum install boost boost-devel -y" #install boost and cmake
# In GitHub Actions virtual environment macos-10.15/20201115.1,
# linking some functions from libgomp fails since the linker cannot find
# some library files from gcc-8 installed via Homebrew.
# The following command fixes this issue by (brew) re-linking files from gcc-8.
# cf. https://stackoverflow.com/a/55500164
CIBW_BEFORE_BUILD_MACOS: "brew link --overwrite gcc@8 && pip install cmake"
CIBW_BUILD: "cp3*-macosx_x86_64 cp3*-manylinux_x86_64 cp3*-win_amd64"
# See https://github.com/Qulacs-Osaka/qulacs-osaka/issues/106
CIBW_SKIP: "cp310-manylinux_x86_64"
CIBW_BUILD_VERBOSITY: "1"
CIBW_ENVIRONMENT: 'QULACS_OPT_FLAGS="-mtune=haswell -mfpmath=both"'
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-listdeps {wheel} && script/fix_wheel_osx.sh {wheel} {dest_dir} && delocate-listdeps {wheel}"
TWINE_USERNAME: "__token__"
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: lukka/get-cmake@latest
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install Python dependencies
run: python -m pip install cibuildwheel twine
- name: Run cibuildwheel
run: python -m cibuildwheel --output-dir wheels
- name: Upload wheel data if the Git tag is set
run: python -m twine upload wheels/*.whl
if: ${{ contains(github.ref, '/tags/') }}
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_QULACS }}
format:
name: Format with clang-format
strategy:
matrix:
os: ["ubuntu-self-hosted"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: lukka/get-cmake@latest
- name: Install qulacs for Ubuntu
run: ./script/build_gcc.sh
- name: Run clang-format
run: cmake --build build --target format
- name: Compare diff
run: |
diff=$(git diff)
echo $diff
test $(echo -n $diff | wc -l) -eq 0