Skip to content

Commit 5e8156f

Browse files
committed
CI: Refactor CI
1 parent 6528522 commit 5e8156f

File tree

1 file changed

+48
-36
lines changed

1 file changed

+48
-36
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,65 @@ on:
44
pull_request: { branches: [master] }
55
schedule: [ cron: '2 2 * * 6' ] # Every Saturday, 02:02
66

7+
defaults:
8+
timeout-minutes: 3
9+
710
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- run: pip install flake8 mypy
16+
- run: flake8 backtesting setup.py
17+
- run: mypy --no-warn-unused-ignores backtesting
18+
19+
coverage:
20+
needs: lint
21+
timeout-minutes: 4
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.10'
28+
- run: pip install -U --pre bokeh pandas numpy coverage && pip install -U .[test]
29+
- env: { BOKEH_BROWSER: none }
30+
run: time coverage run -m backtesting.test
31+
- run: coverage combine && coverage report
32+
833
build:
9-
name: Build
34+
needs: lint
1035
runs-on: ubuntu-latest
1136
strategy:
1237
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-
38+
python-version: [3.11, 3.12, 3.13]
2039
steps:
2140
- uses: actions/setup-python@v5
2241
with:
2342
python-version: ${{ matrix.python-version }}
24-
- uses: actions/cache@v4
25-
with:
26-
path: ~/.cache/pip
27-
key: ${{ runner.os }}-py${{ matrix.python-version }}
2843
- 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
3944
- run: pip install -U .[test]
45+
- env: { BOKEH_BROWSER: none }
46+
run: time python -m backtesting.test
4047

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
48+
docs:
49+
needs: lint
50+
runs-on: ubuntu-latest
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
5058

51-
- if: '! matrix.test-type'
52-
env: { BOKEH_BROWSER: none }
59+
win64:
60+
needs:
61+
- build
62+
- docs
63+
runs-on: windows-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
- run: pip install .[test]
67+
- env: { BOKEH_BROWSER: none }
5368
run: time python -m backtesting.test
54-
55-
- if: matrix.test-type == 'docs'
56-
run: time doc/build.sh

0 commit comments

Comments
 (0)