Skip to content

Commit f3e4775

Browse files
committed
CI: Refactor CI
1 parent 22a780d commit f3e4775

File tree

1 file changed

+53
-37
lines changed

1 file changed

+53
-37
lines changed

.github/workflows/ci.yml

+53-37
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,68 @@ on:
55
schedule: [ cron: '2 2 * * 6' ] # Every Saturday, 02:02
66

77
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 1
11+
steps:
12+
- uses: actions/checkout@v4
13+
- run: pip install flake8 mypy
14+
- run: flake8 backtesting setup.py
15+
- run: mypy --no-warn-unused-ignores backtesting
16+
17+
coverage:
18+
needs: lint
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 4
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.10'
26+
- run: pip install -U --pre bokeh pandas numpy coverage && pip install -U .[test]
27+
- env: { BOKEH_BROWSER: none }
28+
run: time coverage run -m backtesting.test
29+
- run: coverage combine && coverage report
30+
831
build:
9-
name: Build
32+
needs: lint
1033
runs-on: ubuntu-latest
34+
timeout-minutes: 3
1135
strategy:
1236
matrix:
13-
python-version: ['3.10', 3.13]
14-
include:
15-
- python-version: 3.12
16-
test-type: lint
17-
- python-version: 3.11
18-
test-type: docs
19-
37+
python-version: [3.11, 3.12, 3.13]
2038
steps:
2139
- uses: actions/setup-python@v5
2240
with:
2341
python-version: ${{ matrix.python-version }}
24-
- uses: actions/cache@v4
25-
with:
26-
path: ~/.cache/pip
27-
key: ${{ runner.os }}-py${{ matrix.python-version }}
2842
- uses: actions/checkout@v4
29-
with:
30-
fetch-depth: 3
31-
- name: Fetch tags
32-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
33-
34-
- run: pip install -U pip setuptools wheel
35-
- if: matrix.test-type == 'lint'
36-
run: pip install -U --pre bokeh pandas numpy && pip install -U .[dev]
37-
- if: matrix.test-type == 'docs'
38-
run: pip install -e .[doc] # -e provides _version.py for pdoc
3943
- run: pip install -U .[test]
40-
41-
- if: matrix.test-type == 'lint'
42-
run: flake8 backtesting setup.py
43-
- if: matrix.test-type == 'lint'
44-
run: mypy backtesting
45-
- if: matrix.test-type == 'lint'
46-
env: { BOKEH_BROWSER: none }
47-
run: time coverage run -m backtesting.test
48-
- if: matrix.test-type == 'lint'
49-
run: coverage combine && coverage report
50-
51-
- if: '! matrix.test-type'
52-
env: { BOKEH_BROWSER: none }
44+
- env: { BOKEH_BROWSER: none }
5345
run: time python -m backtesting.test
5446

55-
- if: matrix.test-type == 'docs'
56-
run: time doc/build.sh
47+
docs:
48+
needs: lint
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 3
51+
steps:
52+
- uses: actions/checkout@v4
53+
with:
54+
fetch-depth: 3
55+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
56+
- run: pip install -e .[doc,test] # -e provides ./backtesting/_version.py for pdoc
57+
- run: time doc/build.sh
58+
59+
win64:
60+
needs:
61+
- build
62+
- docs
63+
runs-on: windows-latest
64+
timeout-minutes: 4
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-python@v5
68+
with:
69+
python-version: 3.13
70+
- run: pip install .[test]
71+
- env: { BOKEH_BROWSER: none }
72+
run: python -m backtesting.test

0 commit comments

Comments
 (0)