1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-11 23:06:58 +08:00

Fix CI Bug (#575)

Co-authored-by: yuxwang <anduinnn@foxmail.com>
This commit is contained in:
Wangwuyi123
2021-08-25 08:51:39 +08:00
committed by GitHub
parent 6608a40965
commit 509bfcb02e
2 changed files with 52 additions and 62 deletions

View File

@@ -1,4 +1,4 @@
name: Test name: Test
on: on:
push: push:
@@ -13,7 +13,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [windows-latest, ubuntu-16.04, ubuntu-18.04, ubuntu-20.04] os: [windows-latest, ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
python-version: [3.6, 3.7, 3.8, 3.9] python-version: [3.6, 3.7, 3.8]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@@ -25,90 +25,88 @@ jobs:
- name: Lint with Black - name: Lint with Black
run: | run: |
cd ..
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pip install black python.exe -m pip install black
$CONDA\\python.exe -m black qlib -l 120 --check --diff python.exe -m black qlib -l 120 --check --diff
else else
sudo $CONDA/bin/python -m pip install black python -m pip install black
$CONDA/bin/python -m black qlib -l 120 --check --diff python -m black qlib -l 120 --check --diff
fi fi
shell: bash shell: bash
# Test Qlib installed with pip
- name: Install Qlib with pip - name: Install Qlib with pip
run: | run: |
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pip install numpy==1.19.5 python.exe -m pip install numpy==1.19.5
$CONDA\\python.exe -m pip install pyqlib --ignore-installed ruamel.yaml numpy --user python.exe -m pip install pyqlib --ignore-installed ruamel.yaml numpy --user
else else
sudo $CONDA/bin/python -m pip install numpy==1.19.5 python -m pip install numpy==1.19.5
sudo $CONDA/bin/python -m pip install pyqlib --ignore-installed ruamel.yaml numpy python -m pip install pyqlib --ignore-installed ruamel.yaml numpy
fi fi
shell: bash shell: bash
- name: Test data downloads - name: Test data downloads
run: | run: |
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn python.exe scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
else else
$CONDA/bin/python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
fi fi
shell: bash shell: bash
- name: Test workflow by config (install from pip) - name: Test workflow by config (install from pip)
run: | run: |
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe qlib\\workflow\\cli.py examples\\benchmarks\\LightGBM\\workflow_config_lightgbm_Alpha158.yaml python.exe qlib\\workflow\\cli.py examples\\benchmarks\\LightGBM\\workflow_config_lightgbm_Alpha158.yaml
$CONDA\\python.exe -m pip uninstall -y pyqlib python.exe -m pip uninstall -y pyqlib
else else
$CONDA/bin/python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
sudo $CONDA/bin/python -m pip uninstall -y pyqlib python -m pip uninstall -y pyqlib
fi fi
shell: bash shell: bash
# Test Qlib installed from source # Test Qlib installed from source
- name: Install Qlib from source - name: Install Qlib from source
run: | run: |
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pip install --upgrade cython python.exe -m pip install --upgrade cython
$CONDA\\python.exe -m pip install numpy jupyter jupyter_contrib_nbextensions python.exe -m pip install numpy jupyter jupyter_contrib_nbextensions
$CONDA\\python.exe -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't python.exe -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't
$CONDA\\python.exe setup.py install python.exe setup.py install
else else
sudo $CONDA/bin/python -m pip install --upgrade cython python -m pip install --upgrade cython
sudo $CONDA/bin/python -m pip install numpy jupyter jupyter_contrib_nbextensions python -m pip install numpy jupyter jupyter_contrib_nbextensions
sudo $CONDA/bin/python -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't python -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't
sudo $CONDA/bin/python setup.py install python setup.py install
fi fi
shell: bash shell: bash
- name: Install test dependencies - name: Install test dependencies
run: | run: |
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pip install --upgrade pip python.exe -m pip install --upgrade pip
$CONDA\\python.exe -m pip install black pytest python.exe -m pip install black pytest
else else
sudo $CONDA/bin/python -m pip install --upgrade pip python -m pip install --upgrade pip
sudo $CONDA/bin/python -m pip install black pytest python -m pip install black pytest
fi fi
shell: bash shell: bash
- name: Unit tests with Pytest - name: Unit tests with Pytest
run: | run: |
cd tests cd tests
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe -m pytest . --durations=0 python.exe -m pytest . --durations=0
else else
$CONDA/bin/python -m pytest . --durations=0 python -m pytest . --durations=0
fi fi
shell: bash shell: bash
- name: Test workflow by config (install from source) - name: Test workflow by config (install from source)
run: | run: |
if [ "$RUNNER_OS" == "Windows" ]; then if [ "$RUNNER_OS" == "Windows" ]; then
$CONDA\\python.exe qlib\\workflow\\cli.py examples\\benchmarks\\LightGBM\\workflow_config_lightgbm_Alpha158.yaml python.exe qlib\\workflow\\cli.py examples\\benchmarks\\LightGBM\\workflow_config_lightgbm_Alpha158.yaml
else else
$CONDA/bin/python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
fi fi
shell: bash shell: bash

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
strategy: strategy:
matrix: matrix:
python-version: [3.6, 3.7, 3.8, 3.9] python-version: [3.6, 3.7, 3.8]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@@ -26,48 +26,40 @@ jobs:
- name: Lint with Black - name: Lint with Black
run: | run: |
cd .. cd ..
sudo $CONDA/bin/python -m pip install black python -m pip install black
$CONDA/bin/python -m black qlib -l 120 --check --diff python -m black qlib -l 120 --check --diff
# Test Qlib installed with pip # Test Qlib installed with pip
- name: Install Qlib with pip - name: Install Qlib with pip
run: | run: |
sudo $CONDA/bin/python -m pip install numpy==1.19.5 python -m pip install numpy==1.19.5
sudo $CONDA/bin/python -m pip install pyqlib --ignore-installed ruamel.yaml numpy python -m pip install pyqlib --ignore-installed ruamel.yaml numpy
- name: Install Lightgbm for MacOS - name: Install Lightgbm for MacOS
run: | run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Microsoft/qlib/main/.github/brew_install.sh)"
HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm HOMEBREW_NO_AUTO_UPDATE=1 brew install lightgbm
- name: Test data downloads - name: Test data downloads
run: | run: |
$CONDA/bin/python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn
- name: Test workflow by config (install from pip) - name: Test workflow by config (install from pip)
run: | run: |
$CONDA/bin/python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
sudo $CONDA/bin/python -m pip uninstall -y pyqlib python -m pip uninstall -y pyqlib
# Test Qlib installed from source # Test Qlib installed from source
- name: Install Qlib from source - name: Install Qlib from source
run: | run: |
sudo $CONDA/bin/python -m pip install --upgrade cython python -m pip install --upgrade cython
sudo $CONDA/bin/python -m pip install numpy jupyter jupyter_contrib_nbextensions python -m pip install numpy jupyter jupyter_contrib_nbextensions
sudo $CONDA/bin/python -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't python -m pip install -U scipy scikit-learn # installing without this line will cause errors on GitHub Actions, while instsalling locally won't
sudo $CONDA/bin/python setup.py install python setup.py install
- name: Install test dependencies - name: Install test dependencies
run: | run: |
sudo $CONDA/bin/python -m pip install --upgrade pip python -m pip install --upgrade pip
sudo $CONDA/bin/python -m pip install -U pyopenssl idna python -m pip install -U pyopenssl idna
sudo $CONDA/bin/python -m pip install black pytest python -m pip install black pytest
- name: Unit tests with Pytest - name: Unit tests with Pytest
run: | run: |
cd tests cd tests
$CONDA/bin/python -m pytest . --durations=0 python -m pytest . --durations=0
- name: Test workflow by config (install from source) - name: Test workflow by config (install from source)
run: | run: |
$CONDA/bin/python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml python qlib/workflow/cli.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml