Update README.md #152
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflows will run tests on Ubuntu | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
name: Ubuntu | |
on: push | |
# release: | |
# types: [created] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Update git buffer | |
run: | | |
# Somehow the brew install fails when running action. Let's try and increment buffer size. | |
git config --global http.postBuffer 524288000 | |
- name: Install setuptools | |
run: | | |
sudo pip3 install setuptools wheel twine | |
sudo apt-get update && sudo apt-get -y install curl unzip build-essential file git libc-dev | |
- name: Install brew | |
run: | | |
which brew || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv) | |
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) | |
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile | |
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile | |
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/runner/.bash_profile | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
brew install python3 | |
- name: Install ta-lib extension | |
run: | | |
/home/linuxbrew/.linuxbrew/bin/brew install ta-lib && \ | |
/home/linuxbrew/.linuxbrew/bin/brew info ta-lib | |
- name: Install ta-lib python lib | |
run: | | |
export TA_LIBRARY_PATH=/home/linuxbrew/.linuxbrew/Cellar/ta-lib/0.4.0/lib | |
export TA_INCLUDE_PATH=/home/linuxbrew/.linuxbrew/Cellar/ta-lib/0.4.0/include | |
python3 -m pip install ta-lib>=0.4.19 | |
python3 -c 'import numpy, talib; close = numpy.random.random(100); output = talib.SMA(close); print(output)' | |
- name: Install project dependencies | |
run: | | |
pwd | |
pip3 install -r requirements.txt | |
python3 -m pip install ta-lib>=0.4.19 | |
pip3 install --upgrade pip | |
pip3 install convertdate>=2.3.0 | |
pip3 install sanic==19.12.2 | |
pip3 install multidict==4.6 | |
python3 setup.py clean build install sdist bdist_wheel | |
# pip3 install numpy==1.20.0 | |
python3 -c "from nseta.scanner.volumeScanner import volumeScanner; from nseta.scanner.baseStockScanner import ScannerType; s=volumeScanner(ScannerType.Volume,['HDFC']); s.scan();" | |
- name: Declare env variables for codeclimate | |
id: vars | |
shell: bash | |
run: | | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
echo "::set-output name=committed_at::$(git log -1 --pretty=format:%ct)" | |
- name: Code climate before-build | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
GIT_COMMITTED_AT: ${{ steps.vars.outputs.committed_at }} | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter before-build | |
- name: Generate test coverage report | |
run: | | |
pip3 install timeout-decorator | |
pip3 install coverage | |
pip3 install codecov | |
coverage run -m unittest discover -s tests -p 'test_*.py' | |
coverage report -m | |
coverage html | |
coverage xml | |
bash <(curl -s https://codecov.io/bash) | |
- name: Upload test coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# files: ./coverage1.xml,./coverage2.xml | |
# directory: ./coverage/reports/ | |
flags: unittests | |
env_vars: THIS_VERSION,GITHUB_REF | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
# path_to_write_report: ./coverage/codecov_report.txt | |
verbose: true | |
- name: Upload test coverage to Codacy | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
run: | | |
coverage xml | |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r coverage.xml | |
- name: Upload test coverage to code climate | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
GIT_COMMITTED_AT: "${{ steps.vars.outputs.committed_at }}" | |
run: | | |
./cc-test-reporter after-build -t coverage.py --exit-code 0 | |
- name: clean up | |
run: | | |
sudo rm -rf build | |
sudo rm -rf dist |