1- name : Test
1+ name : Test qlib from source
22
33on :
44 push :
99jobs :
1010 build :
1111 timeout-minutes : 120
12+
1213 runs-on : ${{ matrix.os }}
1314 strategy :
1415 matrix :
15- os : [windows-latest, ubuntu-18.04, ubuntu-20.04]
16+ os : [windows-latest, ubuntu-18.04, ubuntu-20.04, macos-11, macos-latest ]
1617 # not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129
1718 python-version : [3.7, 3.8]
1819
1920 steps :
20- - uses : actions/checkout@v2
21+ - name : Test qlib from source
22+ uses : actions/checkout@v2
2123
2224 - name : Set up Python ${{ matrix.python-version }}
2325 uses : actions/setup-python@v2
2426 with :
2527 python-version : ${{ matrix.python-version }}
2628
27- - name : Lint with Black
29+ - name : Update pip to the latest version
30+ run : |
31+ python -m pip install --upgrade pip
32+
33+ - name : Installing pytorch for macos
34+ if : ${{ matrix.os == 'macos-11' || matrix.os == 'macos-latest' }}
35+ run : |
36+ python -m pip install torch torchvision torchaudio
37+ brew install libomp # lightgbm dependencies
38+
39+ - name : Installing pytorch for ubuntu
40+ if : ${{ matrix.os == 'ubuntu-18.04' || matrix.os == 'ubuntu-20.04' }}
2841 run : |
29- pip install --upgrade pip
30- pip install black wheel
31- black qlib -l 120 --check --diff
42+ python -m pip install --upgrade pip
43+ python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
3244
33- - name : Install Qlib with pip
45+ - name : Installing pytorch for windows
46+ if : ${{ matrix.os == 'windows-latest' }}
47+ run : |
48+ python -m pip install --upgrade pip
49+ python -m pip install torch torchvision torchaudio
50+
51+ - name : Set up Python tools
52+ run : |
53+ python -m pip install --upgrade cython
54+ python -m pip install -e .[dev]
55+
56+ - name : Lint with Black
3457 run : |
35- pip install numpy==1.19.5 ruamel.yaml
36- pip install pyqlib --ignore-installed
58+ black . -l 120 --check --diff
3759
3860 - name : Make html with sphinx
3961 run : |
40- pip install -U sphinx
41- pip install sphinx_rtd_theme readthedocs_sphinx_ext
42- pip install --exists-action=w --no-cache-dir -r docs/requirements.txt
4362 cd docs
4463 sphinx-build -b html . build
4564 cd ..
46-
65+
4766 # Check Qlib with pylint
4867 # TODO: These problems we will solve in the future. Important among them are: W0221, W0223, W0237, E1102
4968 # C0103: invalid-name
6786 # W1309: f-string-without-interpolation
6887 # E1102: not-callable
6988 # E1136: unsubscriptable-object
70- # References for parameters: https://github.com/PyCQA/pylint/issues/4577#issuecomment-1000245962
89+ # References for parameters: https://github.com/PyCQA/pylint/issues/4577#issuecomment-1000245962
7190 - name : Check Qlib with pylint
7291 run : |
73- pip install --upgrade pip
74- pip install pylint
7592 pylint --disable=C0104,C0114,C0115,C0116,C0301,C0302,C0411,C0413,C1802,R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R1720,W0105,W0123,W0201,W0511,W0613,W1113,W1514,E0401,E1121,C0103,C0209,R0402,R1705,R1710,R1725,R1735,W0102,W0212,W0221,W0223,W0231,W0237,W0612,W0621,W0622,W0703,W1309,E1102,E1136 --const-rgx='[a-z_][a-z0-9_]{2,30}$' qlib --init-hook "import astroid; astroid.context.InferenceContext.max_inferred = 500"
7693
7794 # The following flake8 error codes were ignored:
@@ -95,47 +112,29 @@ jobs:
95112 # Description: If there is whitespace before ":", it cannot pass the black check.
96113 - name : Check Qlib with flake8
97114 run : |
98- pip install --upgrade pip
99- pip install flake8
100115 flake8 --ignore=E501,F541,E266,E402,W503,E731,E203 --per-file-ignores="__init__.py:F401,F403" qlib
101116
102117 # https://github.com/python/mypy/issues/10600
103118 - name : Check Qlib with mypy
104119 run : |
105- pip install mypy
106120 mypy qlib --install-types --non-interactive || true
107- mypy qlib
121+ mypy qlib --verbose
108122
109123 - name : Test data downloads
110124 run : |
111- python scripts/get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data_simple --interval 1d --region cn
112- python -c "import os; userpath=os.path.expanduser('~'); os.rename(userpath + '/.qlib/qlib_data/cn_data_simple', userpath + '/.qlib/qlib_data/cn_data')"
125+ python scripts/get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
113126 azcopy copy https://qlibpublic.blob.core.windows.net/data/rl /tmp/qlibpublic/data --recursive
114127 mv /tmp/qlibpublic/data tests/.data
115128
116- - name : Test workflow by config (install from pip )
129+ - name : Test workflow by config (install from source )
117130 run : |
131+ # Version 0.52.0 of numba must be installed manually in CI, otherwise it will cause incompatibility with the latest version of numpy.
132+ python -m pip install numba==0.52.0
133+ # You must update numpy manually, because when installing python tools, it will try to uninstall numpy and cause CI to fail.
134+ python -m pip install --upgrade numpy
118135 python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
119- python -m pip uninstall -y pyqlib
120-
121- # Test Qlib installed from source
122- - name : Install Qlib from source
123- run : |
124- pip install --upgrade cython jupyter jupyter_contrib_nbextensions numpy scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't
125- pip install gym tianshou torch
126- pip install -e .
127-
128- - name : Install test dependencies
129- run : |
130- pip install --upgrade pip
131- pip install black pytest
132136
133137 - name : Unit tests with Pytest
134138 run : |
135- pip install -r scripts/data_collector/pit/requirements.txt
136139 cd tests
137- python -m pytest . --durations=10
138-
139- - name : Test workflow by config (install from source)
140- run : |
141- python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
140+ python -m pytest . -m "not slow" --durations=0
0 commit comments