-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
173 lines (148 loc) · 5.94 KB
/
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
name: Tests
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
linters:
uses: ./.github/workflows/linters.yml
docs:
name: build documentation
timeout-minutes: 10
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
#
# Don't run this job unless the linters have succeeded.
# It's wasteful to test code that failed to lint, because it'll get
# re-tested once the lint errors are fixed.
#
needs: [linters]
steps:
- uses: actions/checkout@v3
- name: Setup up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
#
# We use Py3.8 here for historical reasons.
#
python-version: "3.8"
- name: Update pip
run: python -m pip install -U pip
- name: Install apt packages for LaTeX rendering
run: |
sudo apt-get -yq update
sudo apt-get -yq remove texlive-binaries --purge
sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install dvipng texlive-latex-base texlive-latex-extra texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended latexmk
sudo apt-get -yq install build-essential python3.8-dev
- name: Install gensim and its dependencies
run: pip install -e .[docs]
- name: Build documentation
run: |
python setup.py build_ext --inplace
make -C docs/src clean html
tests:
name: test ${{ matrix.os }} python ${{ matrix.python }}
timeout-minutes: 20
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- {python: '3.8', os: ubuntu-20.04}
- {python: '3.9', os: ubuntu-20.04}
- {python: '3.10', os: ubuntu-20.04}
- {python: '3.11', os: ubuntu-20.04}
- {python: '3.8', os: windows-2019}
- {python: '3.9', os: windows-2019}
- {python: '3.10', os: windows-2019}
- {python: '3.11', os: windows-2019}
#
# Don't run this job unless the linters have succeeded.
# It's wasteful to test code that failed to lint, because it'll get
# re-tested once the lint errors are fixed.
#
needs: [linters]
steps:
- uses: actions/checkout@v3
- name: Setup up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Update pip
run: python -m pip install -U pip
#
# Work-around mysterious build problem
# https://github.com/RaRe-Technologies/gensim/pull/3078/checks?check_run_id=2117914443
# https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html
#
- name: Update sbt
if: matrix.os == 'ubuntu-20.04'
run: |
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update -y
sudo apt-get install -y sbt
- name: Install GDB & enable core dumps
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update -y
sudo apt-get install -y gdb
ulimit -c unlimited -S # enable core dumps
- name: Install gensim and its dependencies
if: matrix.os != 'windows'
run: pip install -e .[test]
- name: Install gensim and its dependencies (Windows)
if: matrix.os == 'windows'
run: pip install -e .[test-win]
- run: pip freeze
- name: Show numpy configuration
run: python -c 'import numpy;numpy.show_config()'
- name: Show libraries packaged by numpy
run: |
python -c 'import numpy;import os;print(os.listdir(os.path.join(os.path.dirname(numpy.__file__),"..","numpy.libs")))' || echo
python -c 'import numpy;import os;print(os.listdir(os.path.join(os.path.dirname(numpy.__file__),"/.libs")))' || echo
python -c 'import numpy;import os;print(os.listdir(os.path.join(os.path.dirname(numpy.__file__),"/.dylibs")))' || echo
#
# Nb. pip 23.2.1 and newer will quietly run build_ext using the Cython
# version specified in pyproject.toml, so we don't need to run build_ext
# ourselves.
#
# It's helpful to know what cython version was actually used to build the
# extensions: it'll be in the file headers.
#
#
- name: Examine build output
run: |
ls gensim/models/*.so gensim/models/*.dylib gensim/models/*.dll || true
head gensim/models/*.c gensim/models/*.cpp || true
- name: Output FAST_VERSION
run: python -c 'from gensim import models;print(models.FAST_VERSION)'
#
# Some of our tests are hanging, and I strongly suspect it's because of the coverage plugin.
#
- name: Run tests (without coverage)
if: matrix.coverage != true
run: pytest -v gensim/test --durations 0
- name: Run tests (with coverage)
if: matrix.coverage == true
run: pytest -v gensim/test --cov=gensim/ --cov-report=xml --durations 0
- name: Upload coverage to Codecov
if: matrix.coverage == true
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: ./coverage.xml
verbose: true
- name: Collect corefile
if: ${{ failure() }} && matrix.os == 'ubuntu-20.04'
run: |
pwd
COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1)
if [[ -f "$COREFILE" ]]; then EXECFILE=$(gdb -c "$COREFILE" -batch | grep "Core was generated" | tr -d "\`" | cut -d' ' -f5); file "$COREFILE"; gdb -c "$COREFILE" "$EXECFILE" -x continuous_integration/debug.gdb -batch; fi