Skip to content

MNT: Migrate Travis CI to GitHub Actions #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/deploy-gh-pages.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sitemap() {

head=$(git rev-parse HEAD)

git clone -b gh-pages "https://kernc:$GH_PASSWORD@github.com/$TRAVIS_REPO_SLUG.git" gh-pages
git clone -b gh-pages "https://kernc:$GH_PASSWORD@github.com/$GITHUB_REPOSITORY.git" gh-pages
mkdir -p gh-pages/doc
cp -R doc/build/* gh-pages/doc/
cd gh-pages
Expand All @@ -30,5 +30,11 @@ if git diff --staged --quiet; then
echo "$0: No changes to commit."
exit 0
fi
git commit -a -m "CI: Update docs for $TRAVIS_TAG ($head)"

if ! git config user.name; then
git config user.name 'github-actions'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
fi

git commit -a -m "CI: Update docs for ${GITHUB_REF#refs/tags/} ($head)"
git push
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI
on:
push: { branches: [master] }
pull_request: { branches: [master] }
schedule: [ cron: '2 2 * * 6' ] # Every Saturday, 02:02

jobs:
build:
name: Build
runs-on: ubuntu-18.04

strategy:
matrix:
python-version: [3.6, 3.7]
include:
- python-version: 3.8
test-type: lint
- python-version: 3.8
test-type: docs

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v2
name: Set up caches
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py${{ matrix.python-version }}

- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 3
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -U --pre .[test]

- name: Install lint dependencies
if: matrix.test-type == 'lint'
run: pip install -U .[dev]

- name: Install docs dependencies
if: matrix.test-type == 'docs'
run: pip install -e .[doc,test] # -e provides _version.py for pdoc

- name: Test w/ Coverage, Lint
if: matrix.test-type == 'lint'
env: { BOKEH_BROWSER: none }
run: |
flake8
mypy backtesting
time catchsegv coverage run -m backtesting.test
bash <(curl -s https://codecov.io/bash)

- name: Test
if: '! matrix.test-type'
env: { BOKEH_BROWSER: none }
run: time catchsegv python -m backtesting.test

- name: Test docs
if: matrix.test-type == 'docs'
run: time catchsegv doc/build.sh
41 changes: 41 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy docs
on:
push:
tags: ['[0-9]+.[0-9]+.*']

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest

steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- uses: actions/cache@v2
name: Set up caches
with:
path: ~/.cache/pip
key: ${{ runner.os }}

- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 3
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -U .[doc,test]

- name: Build docs
run: time catchsegv doc/build.sh

- name: Deploy docs
env:
GH_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: .github/deploy-gh-pages.sh
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Backtesting.py
==============
[![Build Status](https://img.shields.io/travis/kernc/backtesting.py.svg?style=for-the-badge)](https://travis-ci.org/kernc/backtesting.py)
[![Build Status](https://img.shields.io/github/workflow/status/kernc/backtesting.py/ci/master?style=for-the-badge)](https://github.com/kernc/backtesting.py/actions)
[![Code Coverage](https://img.shields.io/codecov/c/gh/kernc/backtesting.py.svg?style=for-the-badge)](https://codecov.io/gh/kernc/backtesting.py)
[![Backtesting on PyPI](https://img.shields.io/pypi/v/backtesting.svg?color=blue&style=for-the-badge)](https://pypi.org/project/backtesting)

Expand Down
2 changes: 1 addition & 1 deletion backtesting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
try:
from ._version import version as __version__ # noqa: F401
except ImportError:
pass # Package not installed
__version__ = '?.?.?' # Package not installed

from .backtesting import Backtest, Strategy # noqa: F401
from . import lib # noqa: F401
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/Quick Start User Guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"\n",
"This tutorial shows some of the features of *backtesting.py*, a Python framework for [backtesting](https://www.investopedia.com/terms/b/backtesting.asp) trading strategies.\n",
"\n",
"_Backtesting.py_ is a small and lightweight, blazing fast backtesting framework that uses state-of-the-art Python structures and procedures (Python 3.5+, Pandas, NumPy, Bokeh). It has a very small and simple API that is easy to remember and quickly shape towards meaningful results. The library _doesn't_ really support stock picking or trading strategies that rely on arbitrage or multi-asset portfolio rebalancing; instead, it works with an individual tradeable asset at a time and is best suited for optimizing position entrance and exit signal strategies, decisions upon values of technical indicators, and it's also a versatile interactive trade visualization and statistics tool.\n",
"_Backtesting.py_ is a small and lightweight, blazing fast backtesting framework that uses state-of-the-art Python structures and procedures (Python 3.6+, Pandas, NumPy, Bokeh). It has a very small and simple API that is easy to remember and quickly shape towards meaningful results. The library _doesn't_ really support stock picking or trading strategies that rely on arbitrage or multi-asset portfolio rebalancing; instead, it works with an individual tradeable asset at a time and is best suited for optimizing position entrance and exit signal strategies, decisions upon values of technical indicators, and it's also a versatile interactive trade visualization and statistics tool.\n",
"\n",
"\n",
"## Data\n",
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/Quick Start User Guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
# This tutorial shows some of the features of *backtesting.py*, a Python framework for [backtesting](https://www.investopedia.com/terms/b/backtesting.asp) trading strategies.
#
# _Backtesting.py_ is a small and lightweight, blazing fast backtesting framework that uses state-of-the-art Python structures and procedures (Python 3.5+, Pandas, NumPy, Bokeh). It has a very small and simple API that is easy to remember and quickly shape towards meaningful results. The library _doesn't_ really support stock picking or trading strategies that rely on arbitrage or multi-asset portfolio rebalancing; instead, it works with an individual tradeable asset at a time and is best suited for optimizing position entrance and exit signal strategies, decisions upon values of technical indicators, and it's also a versatile interactive trade visualization and statistics tool.
# _Backtesting.py_ is a small and lightweight, blazing fast backtesting framework that uses state-of-the-art Python structures and procedures (Python 3.6+, Pandas, NumPy, Bokeh). It has a very small and simple API that is easy to remember and quickly shape towards meaningful results. The library _doesn't_ really support stock picking or trading strategies that rely on arbitrage or multi-asset portfolio rebalancing; instead, it works with an individual tradeable asset at a time and is best suited for optimizing position entrance and exit signal strategies, decisions upon values of technical indicators, and it's also a versatile interactive trade visualization and statistics tool.
#
#
# ## Data
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import sys

if sys.version_info < (3, 4):
sys.exit('ERROR: Backtesting.py requires Python 3.4+')
if sys.version_info < (3, 6):
sys.exit('ERROR: Backtesting.py requires Python 3.6+')


if __name__ == '__main__':
Expand Down Expand Up @@ -31,7 +31,6 @@
'write_to': os.path.join('backtesting', '_version.py'),
},
install_requires=[
'typing ; python_version < "3.5"',
'numpy',
'pandas >= 0.25.0, != 0.25.0',
'bokeh >= 1.4.0',
Expand All @@ -51,10 +50,12 @@
],
'dev': [
'flake8',
'coverage',
'mypy',
],
},
test_suite="backtesting.test",
python_requires='>=3.4',
python_requires='>=3.6',
author='Zach Lûster',
classifiers=[
'Intended Audience :: Financial and Insurance Industry',
Expand Down