-
-
Notifications
You must be signed in to change notification settings - Fork 14
121 lines (116 loc) · 4.92 KB
/
test-ubuntu.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# 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