|
9 | 9 | - cron: '0 0 * * sun,wed' |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - # |
13 | | - # The linters job duplicates tests.yml, can't think of a way to avoid this right now. |
14 | | - # |
15 | | - linters: |
16 | | - runs-on: ubuntu-latest |
17 | | - steps: |
18 | | - - uses: actions/checkout@v3 |
19 | | - |
20 | | - - name: Setup up Python ${{ matrix.python }} |
21 | | - uses: actions/setup-python@v4 |
22 | | - with: |
23 | | - python-version: ${{ matrix.python }} |
24 | | - |
25 | | - - name: Update pip |
26 | | - run: python -m pip install -U pip |
27 | | - |
28 | | - - name: Install dependencies |
29 | | - run: python -m pip install flake8 flake8-rst |
30 | | - |
31 | | - - name: Run flake8 linter (source) |
32 | | - run: flake8 --ignore E12,W503 --max-line-length 120 --show-source gensim |
33 | 12 |
|
34 | | - # - name: Run flake8 linter (documentation) |
35 | | - # run: flake8 --ignore E202,E402,E302,E305,F821 --max-line-length 120 --filename '*.py,*.rst' docs |
36 | | - |
37 | | - - name: Check Sphinx Gallery cache |
38 | | - run: python docs/src/check_gallery.py |
| 13 | + linters: |
| 14 | + uses: ./.github/workflows/linters.yml |
39 | 15 |
|
40 | | - multibuild: |
41 | | - timeout-minutes: 35 |
| 16 | + build_wheels: |
| 17 | + needs: linters |
| 18 | + name: Build wheels on ${{ matrix.os }} |
42 | 19 | runs-on: ${{ matrix.os }} |
43 | 20 | defaults: |
44 | 21 | run: |
45 | 22 | shell: bash |
46 | | - |
47 | | - needs: [linters] |
48 | | - |
49 | | - strategy: |
50 | | - fail-fast: false |
51 | | - matrix: |
52 | | - include: |
53 | | - # |
54 | | - # We want the _oldest_ possible manylinux version to ensure our |
55 | | - # wheels work on the widest possible range of distros. Version 1 |
56 | | - # seems to break for certain Python versions under Linux and Windows, |
57 | | - # so we use 2010, which is the next oldest. |
58 | | - # |
59 | | - # When selecting the numpy version to build against, we need to satisfy |
60 | | - # two conditions. First, we want the wheel to be available for the |
61 | | - # version of Python we're building against, because building numpy |
62 | | - # wheels on our own is too much work. |
63 | | - # |
64 | | - # Second, in order to guarantee compatibility with the greatest range |
65 | | - # of numpy versions, we want to build against the oldest possible numpy |
66 | | - # version, as long as it's 1.17.0 or newer. Building versions earlier |
67 | | - # than 1.17.0 yields wheels that are incompatible with some newer |
68 | | - # versions of numpy. See https://github.com/RaRe-Technologies/gensim/issues/3226 |
69 | | - # for details. |
70 | | - # |
71 | | - # The logic for numpy version selection is based on |
72 | | - # https://github.com/scipy/oldest-supported-numpy/blob/master/setup.cfg |
73 | | - # with the exception that we enforce the minimum version to be 1.17.0. |
74 | | - # |
75 | | - - os: ubuntu-latest |
76 | | - manylinux-version: 2010 |
77 | | - python-version: "3.8" |
78 | | - build-depends: numpy==1.17.3 |
79 | | - |
80 | | - - os: ubuntu-latest |
81 | | - manylinux-version: 2010 |
82 | | - python-version: "3.9" |
83 | | - build-depends: numpy==1.19.3 |
84 | | - |
85 | | - - os: ubuntu-latest |
86 | | - manylinux-version: 2014 |
87 | | - python-version: "3.10" |
88 | | - build-depends: numpy==1.22.2 scipy==1.8.0 |
89 | | - |
90 | | - - os: ubuntu-latest |
91 | | - manylinux-version: 2014 |
92 | | - python-version: "3.11" |
93 | | - build-depends: numpy==1.23.2 scipy==1.9.2 |
94 | | - |
95 | | - - os: macos-latest |
96 | | - travis-os-name: osx |
97 | | - manylinux-version: 1 |
98 | | - python-version: "3.8" |
99 | | - build-depends: numpy==1.17.3 |
100 | | - |
101 | | - - os: macos-latest |
102 | | - travis-os-name: osx |
103 | | - manylinux-version: 1 |
104 | | - python-version: "3.9" |
105 | | - build-depends: numpy==1.19.3 |
106 | | - |
107 | | - - os: macos-latest |
108 | | - travis-os-name: osx |
109 | | - manylinux-version: 1 |
110 | | - python-version: "3.10" |
111 | | - build-depends: numpy==1.22.2 scipy==1.8.0 |
112 | | - |
113 | | - - os: macos-latest |
114 | | - travis-os-name: osx |
115 | | - manylinux-version: 1 |
116 | | - python-version: "3.11" |
117 | | - build-depends: numpy==1.23.2 scipy==1.9.2 |
118 | | - |
119 | | - env: |
120 | | - SKIP_NETWORK_TESTS: 1 |
121 | | - TEST_DEPENDS: pytest mock testfixtures |
122 | | - BUILD_DEPENDS: ${{ matrix.build-depends }} |
123 | | - |
124 | | - # |
125 | | - # For multibuild |
126 | | - # |
127 | | - BUILD_COMMIT: HEAD |
128 | | - DOCKER_TEST_IMAGE: multibuild/xenial_x86_64 |
129 | | - MB_ML_VER: ${{ matrix.manylinux-version }} |
130 | | - MB_PYTHON_VERSION: ${{ matrix.python-version }} # MB_PYTHON_VERSION is needed by Multibuild |
131 | | - PKG_NAME: gensim |
132 | | - PLAT: x86_64 |
133 | | - REPO_DIR: gensim |
134 | | - TRAVIS_OS_NAME: ${{ matrix.travis-os-name }} |
135 | | - UNICODE_WIDTH: 32 |
136 | | - |
137 | | - steps: |
138 | | - - uses: actions/checkout@v3 |
139 | | - with: |
140 | | - submodules: recursive |
141 | | - fetch-depth: 0 |
142 | | - - name: Print environment variables |
143 | | - run: | |
144 | | - echo "PLAT: ${PLAT}" |
145 | | - echo "MB_ML_VER: ${MB_ML_VER}" |
146 | | - echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}" |
147 | | - echo "TEST_DEPENDS: ${TEST_DEPENDS}" |
148 | | - echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}" |
149 | | - echo "SKIP_NETWORK_TESTS: ${SKIP_NETWORK_TESTS}" |
150 | | - - name: Set up Python ${{ matrix.python-version }} |
151 | | - uses: actions/setup-python@v4 |
152 | | - with: |
153 | | - python-version: ${{ matrix.python-version }} |
154 | | - - name: Install dependencies |
155 | | - run: | |
156 | | - python -m pip install --upgrade pip |
157 | | - pip install virtualenv |
158 | | - - name: Build Wheel |
159 | | - run: | |
160 | | - echo ::group::Set up Multibuild |
161 | | - source multibuild/common_utils.sh |
162 | | - source multibuild/travis_steps.sh |
163 | | - source config.sh |
164 | | - echo ::endgroup:: |
165 | | - echo ::group::Before install |
166 | | - before_install |
167 | | - echo ::endgroup:: |
168 | | - echo ::group::Build wheel |
169 | | - find . -type f -name "*.egg" -exec rm -v {} \; |
170 | | - build_wheel $REPO_DIR ${{ matrix.PLAT }} |
171 | | - echo ::endgroup:: |
172 | | -
|
173 | | - - name: Prepare for testing |
174 | | - run: | |
175 | | - # |
176 | | - # FIXME: Why are these eggs here? |
177 | | - # |
178 | | - # These eggs prevent the wheel from building and running on Py3.10 |
179 | | - # |
180 | | - find . -type f -name "*.egg" -exec rm -v {} \; |
181 | | - python -m venv test_environment |
182 | | -
|
183 | | - # |
184 | | - # Multibuild has a test step but it essentially just installs the wheel |
185 | | - # and runs the test, and requires a lot of magic to get it working. |
186 | | - # It also does not work under Windows. |
187 | | - # So, we create our own simple test step here. |
188 | | - # |
189 | | - - name: Install and Test Wheel |
190 | | - run: | |
191 | | - . test_environment/bin/activate |
192 | | - python -m pip install --upgrade pip |
193 | | - pip install pytest testfixtures mock |
194 | | - pip install wheelhouse/*.whl |
195 | | - cd test_environment |
196 | | - python -c 'import gensim;print(gensim.__version__)' |
197 | | - # |
198 | | - # This part relies on the wheel containing tests and required data. |
199 | | - # If we remove that from the wheel, we'll need to rewrite this step. |
200 | | - # |
201 | | - pytest -rfxEXs --durations=20 --disable-warnings --showlocals --pyargs gensim |
202 | | -
|
203 | | - - name: Upload wheels to s3://gensim-wheels |
204 | | - # |
205 | | - # Only do this if the credentials are set. |
206 | | - # This means that PRs will still build wheels, but not upload them. |
207 | | - # (PRs do not have access to secrets). |
208 | | - # |
209 | | - # The always() ensures this step runs even if a previous step fails. |
210 | | - # We want to upload wheels whenever possible (even if e.g. tests failed) |
211 | | - # because we don't want an innocuous test failure from blocking a release. |
212 | | - # |
213 | | - if: ${{ always() && env.WHEELHOUSE_UPLOADER_USERNAME && env.WHEELHOUSE_UPLOADER_SECRET }} |
214 | | - run: | |
215 | | - python -m pip install wheelhouse-uploader |
216 | | - ls wheelhouse/*.whl |
217 | | - python -m wheelhouse_uploader upload --local-folder wheelhouse/ --no-ssl-check gensim-wheels --provider S3 --no-enable-cdn |
218 | | - env: |
219 | | - WHEELHOUSE_UPLOADER_USERNAME: ${{ secrets.AWS_ACCESS_KEY_ID }} |
220 | | - WHEELHOUSE_UPLOADER_SECRET: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
221 | | - |
222 | | - |
223 | | - # |
224 | | - # The build process for windows is different to that of Linux and MacOS. |
225 | | - # First, we cannot use multibuild (it does not support Windows). |
226 | | - # This means we have to write our own building and testing steps, but in a |
227 | | - # way it's simpler, because we don't need to care about configuring |
228 | | - # multibuild ourselves. |
229 | | - # Second, the syntax to enable virtual environments, etc. is different. |
230 | | - # |
231 | | - build_windows: |
232 | | - timeout-minutes: 35 |
233 | | - runs-on: windows-latest |
234 | | - defaults: |
235 | | - run: |
236 | | - shell: bash |
237 | | - |
238 | | - needs: [linters] |
239 | | - |
240 | 23 | strategy: |
241 | 24 | fail-fast: false |
242 | 25 | matrix: |
243 | | - include: |
244 | | - - python-version: "3.8" |
245 | | - build-depends: numpy==1.17.3 |
246 | | - |
247 | | - - python-version: "3.9" |
248 | | - build-depends: numpy==1.19.3 |
249 | | - |
250 | | - - python-version: "3.10" |
251 | | - build-depends: numpy==1.22.2 scipy==1.8.0 |
252 | | - |
253 | | - - python-version: "3.11" |
254 | | - build-depends: numpy==1.23.2 scipy==1.9.2 |
255 | | - |
256 | | - env: |
257 | | - SKIP_NETWORK_TESTS: 1 |
258 | | - TEST_DEPENDS: pytest mock testfixtures |
259 | | - BUILD_DEPENDS: ${{ matrix.build-depends }} |
260 | | - |
| 26 | + os: [ubuntu-20.04, windows-2019, macos-11] |
261 | 27 | steps: |
262 | | - - uses: actions/checkout@v3 |
263 | | - with: |
264 | | - submodules: recursive |
265 | | - fetch-depth: 0 |
266 | | - - name: Set up Python ${{ matrix.python-version }} |
267 | | - uses: actions/setup-python@v4 |
268 | | - with: |
269 | | - python-version: ${{ matrix.python-version }} |
270 | | - - name: Install dependencies |
271 | | - run: | |
272 | | - python -m pip install --upgrade pip |
273 | | - pip install virtualenv |
274 | 28 |
|
275 | | - - name: Build Wheel |
276 | | - run: | |
277 | | - echo ::group::Set up dependencies |
278 | | - python --version |
279 | | - python -c "import struct; print(struct.calcsize('P') * 8)" |
280 | | - python -m pip install -U pip setuptools wheel wheelhouse_uploader ${{ env.BUILD_DEPENDS }} |
281 | | - echo ::endgroup:: |
282 | | - echo ::group::Build wheel |
283 | | - python setup.py bdist_wheel |
284 | | - echo ::endgroup |
285 | | - echo ::group::Install run |
286 | | - ls dist |
287 | | - python continuous_integration/install_wheel.py |
288 | | - echo ::endgroup:: |
289 | | - # |
290 | | - # For consistency with the multibuild step. The wheel uploader expects |
291 | | - # the wheels to be under wheelhouse. |
292 | | - # |
293 | | - mv dist wheelhouse |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v3 |
294 | 31 |
|
295 | | - - name: Prepare for testing |
296 | | - run: | |
| 32 | + - name: Set up QEMU |
| 33 | + if: runner.os == 'Linux' |
| 34 | + uses: docker/setup-qemu-action@v2 |
| 35 | + with: |
| 36 | + platforms: all |
| 37 | + |
| 38 | + - name: Build wheels |
| 39 | + uses: pypa/cibuildwheel@v2.12.0 |
| 40 | + env: |
| 41 | + CIBW_ARCHS_LINUX: x86_64 aarch64 |
| 42 | + CIBW_ARCHS_MACOS: x86_64 arm64 |
| 43 | + CIBW_ARCHS_WINDOWS: AMD64 x86 ARM64 |
| 44 | + CIBW_BEFORE_BUILD: pip install numpy scipy |
| 45 | + CIBW_SKIP: pp* cp36-* cp37-* *-win32 *_i686 *-musllinux_* |
| 46 | + CIBW_TEST_COMMAND: pytest -rfxEXs --durations=20 --disable-warnings --showlocals --pyargs gensim |
| 47 | + CIBW_TEST_REQUIRES: pytest testfixtures mock |
| 48 | + CIBW_TEST_SKIP: cp38* cp39* cp310* *_aarch64 *_arm64 *_universal2 |
| 49 | + |
| 50 | + - name: Upload wheels to s3://gensim-wheels |
297 | 51 | # |
298 | | - # FIXME: Why are these eggs here? |
| 52 | + # Only do this if the credentials are set. |
| 53 | + # This means that PRs will still build wheels, but not upload them. |
| 54 | + # (PRs do not have access to secrets). |
299 | 55 | # |
300 | | - # These eggs prevent the wheel from building and running on Py3.10 |
| 56 | + # The always() ensures this step runs even if a previous step fails. |
| 57 | + # We want to upload wheels whenever possible (even if e.g. tests failed) |
| 58 | + # because we don't want an innocuous test failure from blocking a release. |
301 | 59 | # |
302 | | - find . -type f -name "*.egg" -exec rm -v {} \; |
303 | | - python -m venv test_environment |
304 | | -
|
305 | | - # |
306 | | - # We need a separate testing step for windows because the command for |
307 | | - # activating the virtual environment is slightly different |
308 | | - # |
309 | | - - name: Install and Test Wheel (Windows) |
310 | | - run: | |
311 | | - test_environment/Scripts/activate.bat |
312 | | - python -m pip install --upgrade pip |
313 | | - pip install pytest testfixtures mock |
314 | | - pip install wheelhouse/*.whl |
315 | | - cd test_environment |
316 | | - python -c 'import gensim;print(gensim.__version__)' |
317 | | - pytest -rfxEXs --durations=20 --disable-warnings --showlocals --pyargs gensim |
318 | | -
|
319 | | - - name: Upload wheels to s3://gensim-wheels |
320 | | - # |
321 | | - # Only do this if the credentials are set. |
322 | | - # This means that PRs will still build wheels, but not upload them. |
323 | | - # (PRs do not have access to secrets). |
324 | | - # |
325 | | - # The always() ensures this step runs even if a previous step fails. |
326 | | - # We want to upload wheels whenever possible (even if e.g. tests failed) |
327 | | - # because we don't want an innocuous test failure from blocking a release. |
328 | | - # |
329 | | - if: ${{ always() && env.WHEELHOUSE_UPLOADER_USERNAME && env.WHEELHOUSE_UPLOADER_SECRET }} |
330 | | - run: | |
331 | | - python -m pip install wheelhouse-uploader |
332 | | - ls wheelhouse/*.whl |
333 | | - python -m wheelhouse_uploader upload --local-folder wheelhouse/ --no-ssl-check gensim-wheels --provider S3 --no-enable-cdn |
334 | | - env: |
335 | | - WHEELHOUSE_UPLOADER_USERNAME: ${{ secrets.AWS_ACCESS_KEY_ID }} |
336 | | - WHEELHOUSE_UPLOADER_SECRET: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 60 | + if: ${{ always() && env.WHEELHOUSE_UPLOADER_USERNAME && env.WHEELHOUSE_UPLOADER_SECRET }} |
| 61 | + run: | |
| 62 | + python -m pip install wheelhouse-uploader |
| 63 | + ls wheelhouse/*.whl |
| 64 | + python -m wheelhouse_uploader upload --local-folder wheelhouse/ --no-ssl-check gensim-wheels --provider S3 --no-enable-cdn |
| 65 | + env: |
| 66 | + WHEELHOUSE_UPLOADER_USERNAME: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 67 | + WHEELHOUSE_UPLOADER_SECRET: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
0 commit comments