Files
OpenBB/.github/workflows/test.yml
DidierRLopes 61ccd504af Improve customisable report generation (#854)
* A more customizable jupyter notebook report implementation

* refine dark pool and due diligence reports

* remove stocks reports

* Add crypto_market notebook report

* remove crypto reports folder

* remove crypto reports folder

* economy data report template

* remove economy reports menu

* Update test.yml

* remove notebooks folder, no longer needed

* Update README.md

* update due_diligence notebook to reflect refactoring of fa

* update gitignore based on Theo suggestion
2021-10-25 22:35:28 +01:00

251 lines
7.7 KiB
YAML
Vendored

name: Tests
env:
PIP_DEFAULT_TIMEOUT: 100
GTFF_USE_PROMPT_TOOLKIT: false
GTFF_USE_ION: false
GTFF_ENABLE_QUICK_EXIT: true
on: [pull_request, push]
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"
architecture: x64
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-linting
restore-keys: ${{ runner.os }}-linting
- run: pip install bandit black codespell flake8 mypy pyupgrade safety pylint==2.10.2
- run: pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil
- run: bandit -r . || true
- run: black --check .
- run: codespell --ignore-words-list=pres,coo,navagation,ser,buil,operatio,mape,ba,hist,yeld,ether,hsi --quiet-level=2 --skip=".git" --skip="*.yaml" --skip="*.ipynb" --skip="*.json" --skip="*.js" --skip="*.css" --skip="*.scss" --skip="*.html" --skip="*.ini" --skip="*.md" --skip="*.lock"
- run: flake8 . --count --ignore=E203,W503 --max-line-length=122 --show-source --statistics
- run: mypy --ignore-missing-imports --exclude '/setup\.py$' .
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py
- run: safety check
- run: |
pylint terminal.py gamestonk_terminal tests
test:
name: ubuntu-latest - Python 3.9
needs: linting
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"
architecture: x64
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.11
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install Package
run: poetry install --no-interaction
- name: Run tests
env:
MPLBACKEND: Agg
run: |
source $VENV
pytest tests/
- name: Start Terminal and exit
run: |
source $VENV
python terminal.py
tests-python:
name: Python (${{ matrix.python-version }}, ${{ matrix.os }})
needs: test
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: true
matrix:
python-version: ['3.6', '3.8', '3.9']
os: [ubuntu-latest, macos-latest]
exclude:
- os: ubuntu-latest
python-version: '3.9'
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.11
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install Package
run: poetry install --no-interaction
- name: List installed packages
shell: bash -l {0}
run: |
source $VENV
pip list
- name: Run tests
env:
MPLBACKEND: Agg
run: |
source $VENV
pytest tests/
- name: Start Terminal and exit
run: |
source $VENV
python terminal.py
tests-conda:
name: Conda (${{ matrix.python-version }}, ${{ matrix.os }})
needs: test
runs-on: ${{ matrix.os }}-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
os: ['ubuntu', 'windows']
python-version: ['3.8']
dependencies: ['']
include:
- os: ubuntu
python: 3.8
- os: windows
python: 3.8
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
PYTHONNOUSERSITE: 1
steps:
- name: Set git to use LF
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout
uses: actions/checkout@v2
with:
# Need to fetch more than the last commit so that setuptools-scm can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version still be wrong.
# Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false
- name: Setup caching for conda packages
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: conda-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('build/conda/conda-3-8-env.yaml') }}
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python }}
miniconda-version: "latest"
auto-update-conda: true
channels: conda-forge,defaults
show-channel-urls: true
channel-priority: flexible
environment-file: build/conda/conda-3-8-env.yaml
activate-environment: testing
# Needed for caching
use-only-tar-bz2: true
- name: Update Temp permissions on windows
if: runner.os == 'Windows'
shell: cmd /C CALL {0}
run: >-
c:\windows\system32\icacls C:\Users\runneradmin\AppData\Local\Temp /grant "everyone":F /t
- name: Get pip cache dir
shell: bash -l {0}
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-3-8-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies (Bash)
shell: bash -l {0}
run: |
pip install --requirement requirements.txt
- name: List installed packages (Bash)
shell: bash -l {0}
run: |
conda list
pip list
- name: Run linter (Bash)
shell: bash -l {0}
run: |
pip install pylint==2.9.6
pylint terminal.py gamestonk_terminal tests
- name: Run tests (Bash)
shell: bash -l {0}
run: pytest tests/
- name: Start Terminal and exit
shell: bash -l {0}
run: python terminal.py