-
Notifications
You must be signed in to change notification settings - Fork 196
90 lines (75 loc) · 2.64 KB
/
main.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
name: CI
on: [push, pull_request]
jobs:
build:
name: Build and test
runs-on: ubuntu-24.04 # required for latest QuantLib
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- name: install dependencies
run: |
sudo add-apt-repository ppa:edd/misc -y
sudo apt-get update
sudo apt-get install libquantlib0-dev
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy
pip install -r requirements.txt
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{matrix.python-version}}
- name: Build
run: |
export PATH="/usr/lib/ccache:$PATH"
python setup.py build_ext --inplace -j 2
- name: Run tests
run: |
python -m unittest discover -v
# Publish built docs to gh-pages branch.
- name: Checkout documentation branch
if: matrix.python-version == '3.11'
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
persist-credentials: false
- name: Build docs
if: matrix.python-version == '3.11'
run: |
pip install sphinx nbsphinx scikit-learn ipython
sudo apt-get install pandoc texlive texlive-latex-extra dvipng
make docs
- uses: actions/upload-artifact@v2
if: (matrix.python-version == '3.11') && (github.event_name == 'pull_request')
with:
name: "doc_${{ github.event.pull_request.number }}"
path: docs/build/html
- name: Move docs over
if: (matrix.python-version == '3.11') && (github.event_name == 'push')
run: |
ls
cp -r docs/build/html/* gh-pages/
cd gh-pages
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "New documentation" -a || true
# The above command will fail if no changes were present, so we ignore
# that.
- name: Push changes
if: (matrix.python-version == '3.11') && (github.event_name== 'push')
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}