@@ -27,13 +27,11 @@ jobs:
2727 fail-fast : false
2828 matrix :
2929 os : [ubuntu-latest, windows-latest, macos-latest]
30- python-version : ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
31- exclude :
32- # Python 3.13 might not be available on all OS yet
33- - os : windows-latest
34- python-version : ' 3.13'
35- - os : macos-latest
36- python-version : ' 3.13'
30+ python-version : ['3.8', '3.9', '3.10', '3.11', '3.12']
31+ include :
32+ # Add Python 3.13 only for Ubuntu where it's more stable
33+ - os : ubuntu-latest
34+ python-version : ' 3.13-dev'
3735 # Set timeout for the entire job
3836 timeout-minutes : 30
3937
@@ -50,12 +48,12 @@ jobs:
5048 run : python -c "import sys; print(sys.version)"
5149
5250 - name : Cache pip packages
53- uses : actions/cache@v3
51+ uses : actions/cache@v4
5452 with :
5553 path : |
5654 ~/.cache/pip
5755 ~/Library/Caches/pip
58- ~\ AppData\ Local\ pip\ Cache
56+ ~/ AppData/ Local/ pip/ Cache
5957 key : ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }}
6058 restore-keys : |
6159 ${{ runner.os }}-pip-${{ matrix.python-version }}-
@@ -69,13 +67,54 @@ jobs:
6967 - name : Install dependencies
7068 run : |
7169 pip install pytest pytest-cov pytest-xdist pytest-timeout
72- # Install empyrical from GitHub (primary) or Gitee (fallback)
70+ pip install ipython>=7.0.0
71+
72+ - name : Install empyrical (Unix)
73+ if : runner.os != 'Windows'
74+ run : |
75+ # Try installing empyrical with retries
76+ for i in 1 2 3; do
77+ echo "Attempt $i to install empyrical..."
78+ if pip install git+https://github.com/cloudQuant/empyrical.git; then
79+ echo "Successfully installed empyrical from GitHub"
80+ break
81+ elif [ $i -eq 3 ]; then
82+ echo "GitHub failed, trying Gitee..."
83+ pip install git+https://gitee.com/yunjinqi/empyrical.git || exit 1
84+ else
85+ echo "Attempt $i failed, retrying..."
86+ sleep 5
87+ fi
88+ done
89+
90+ - name : Install empyrical (Windows)
91+ if : runner.os == 'Windows'
92+ shell : cmd
93+ run : |
7394 pip install git+https://github.com/cloudQuant/empyrical.git || pip install git+https://gitee.com/yunjinqi/empyrical.git
95+
96+ - name : Install pyfolio
97+ run : |
7498 pip install -e .
7599
76100 - name : Run tests with pytest
77101 run : |
78- pytest tests/ -v --cov=pyfolio --cov-report=xml --cov-report=term -n auto
102+ pytest tests/ -v --cov=pyfolio --cov-report=xml --cov-report=term -n auto --tb=short
103+ continue-on-error : true
104+ id : pytest
105+
106+ - name : Upload test results
107+ if : always()
108+ uses : actions/upload-artifact@v4
109+ with :
110+ name : test-results-${{ matrix.os }}-${{ matrix.python-version }}
111+ path : |
112+ coverage.xml
113+ .coverage
114+
115+ - name : Check test results
116+ if : steps.pytest.outcome == 'failure'
117+ run : exit 1
79118
80119 - name : Upload coverage to Codecov
81120 if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
@@ -101,8 +140,10 @@ jobs:
101140 run : |
102141 python -m pip install --upgrade pip
103142 pip install flake8 black isort mypy
143+ pip install ipython>=7.0.0
104144 # Install empyrical for linting
105145 pip install git+https://github.com/cloudQuant/empyrical.git || pip install git+https://gitee.com/yunjinqi/empyrical.git
146+ pip install -e .
106147
107148 - name : Lint with flake8
108149 run : |
@@ -172,8 +213,11 @@ jobs:
172213
173214 - name : Install from wheel
174215 run : |
175- # Install empyrical first
216+ # Install dependencies first
217+ pip install ipython>=7.0.0
218+ # Install empyrical
176219 pip install git+https://github.com/cloudQuant/empyrical.git || pip install git+https://gitee.com/yunjinqi/empyrical.git
220+ # Install pyfolio wheel
177221 pip install dist/*.whl
178222 python -c "import pyfolio; print(f'Successfully imported pyfolio {pyfolio.__version__}')"
179223
0 commit comments