-
Notifications
You must be signed in to change notification settings - Fork 258
141 lines (104 loc) · 4.19 KB
/
test.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
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
# we're not yet using 3.12 because there are some issues
# with pylint there (November 2023)
python-version: '3.11'
- name: Pylint
run: |
python -m pip install pylint
python -m pip install . # to install dependencies
pylint cvxportfolio
packaging:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Package
run: |
python -m pip install build
python -m build
- name: Install wheel
run: |
python -m pip install dist/*.whl
- name: Delete the repo
run: |
rm -rf *
- name: Run tests shipped with the package
run: |
python -m cvxportfolio.tests
- name: Check that data folder wasn't accidentally created
run: |
if [ -d ~/cvxportfolio_data ]; then exit 1; fi
test:
runs-on: ${{ matrix.os }}
# continue-on-error: ${{ matrix.python-version == '3.13' }}
strategy:
matrix: # https://github.com/actions/runner-images
os: [ubuntu-latest, windows-latest, macos-latest, macos-13] # last 2 are aarch64 and amd64
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
exclude:
- os: macos-latest # aarch64
python-version: '3.8'
- os: macos-latest # aarch64
python-version: '3.9'
- os: windows-latest # SCS missing windows wheels for 3.13, https://github.com/bodono/scs-python/pull/117
python-version: '3.13'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# rationale: we test against an environment with current packages as of:
# ~ Q4 2023 for python 3.11
# ~ Q4 2022 for python 3.10
# ~ Q4 2021 for python 3.9
# for Python 3.8 it is more problematic with more incompatibilities, it
# is nearing its EOL so we simply test against an old Pandas
# we only install the base packages here,
# then pip below figures out the others
- name: If running on python 3.8 install some old dependencies
if: ${{ matrix.python-version == '3.8'}}
run: python -m pip install pandas==1.4.0
- name: If running on python 3.9 install some old dependencies
if: ${{ matrix.python-version == '3.9'}}
run: python -m pip install numpy==1.21.5 scipy==1.7.3 matplotlib==3.5.0 cvxpy==1.1.17 pandas==1.4.0 osqp==0.6.2.post0 ecos==2.0.11 scs==3.0.0
- name: If running on python 3.10 install some old dependencies
if: ${{ matrix.python-version == '3.10'}}
run: python -m pip install numpy==1.23.4 scipy==1.9.3 matplotlib==3.6.0 cvxpy==1.2.3 pandas==1.5.0 osqp==0.6.2.post9 ecos==2.0.12
- name: If running on python 3.11 install some old dependencies
if: ${{ matrix.python-version == '3.11'}}
run: python -m pip install numpy==1.26.1 scipy==1.11.3 matplotlib==3.7.2 cvxpy==1.4.1 pandas==2.1.2 osqp==0.6.3 ecos==2.0.12 scs==3.2.3
- name: If running on python 3.12 install some old dependencies
if: ${{ matrix.python-version == '3.12'}}
run: python -m pip install numpy==2.1.2 scipy==1.14.1 matplotlib==3.9.2 cvxpy==1.5.3 pandas==2.2.3 osqp==0.6.7.post3 ecos==2.0.14 scs==3.2.7
- name: Install package
run: |
python -m pip install .[test]
- name: Run tests with coverage
run: |
coverage run -m cvxportfolio.tests
coverage lcov
- name: Send coverage to Coveralls
if: ${{ github.event_name == 'push'}}
continue-on-error: true
uses: coverallsapp/github-action@v2
with:
path-to-lcov: coverage.lcov