Skip to content

Commit ce34fca

Browse files
committed
Update test.yml
1 parent 277e875 commit ce34fca

File tree

1 file changed

+51
-10
lines changed

1 file changed

+51
-10
lines changed

.github/workflows/test.yml

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@ jobs:
1616
linting:
1717
runs-on: ubuntu-latest
1818
steps:
19+
#----------------------------------------------
20+
# check-out repo and set-up python
21+
#----------------------------------------------
1922
- uses: actions/checkout@v4
2023
- uses: actions/setup-python@v5
24+
#----------------------------------------------
25+
# load pip cache if cache exists
26+
#----------------------------------------------
2127
- uses: actions/cache@v3
2228
with:
2329
path: ~/.cache/pip
2430
key: ${{ runner.os }}-pip
2531
restore-keys: ${{ runner.os }}-pip
32+
#----------------------------------------------
33+
# install and run linters
34+
#----------------------------------------------
2635
- run: python -m pip install black flake8 isort
27-
- run: flake8 ./investing_algorithm_framework
28-
36+
- run: |
37+
flake8 ./investing_algorithm_framework
2938
test:
3039
needs: linting
3140
strategy:
@@ -35,35 +44,67 @@ jobs:
3544
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
3645
runs-on: ${{ matrix.os }}
3746
steps:
38-
- uses: actions/checkout@v4
39-
- uses: actions/setup-python@v5
47+
#----------------------------------------------
48+
# check-out repo and set-up python
49+
#----------------------------------------------
50+
- name: Check out repository
51+
uses: actions/checkout@v4
52+
- name: Set up python ${{ matrix.python-version }}
53+
id: setup-python
54+
uses: actions/setup-python@v5
4055
with:
4156
python-version: ${{ matrix.python-version }}
57+
#----------------------------------------------
58+
# ----- install distutils if needed -----
59+
#----------------------------------------------
4260
- name: Install distutils on Ubuntu
4361
if: matrix.os == 'ubuntu-latest'
4462
run: |
4563
sudo add-apt-repository ppa:deadsnakes/ppa
4664
sudo apt-get update
4765
sudo apt install python${{ matrix.python-version }}-distutils
66+
#----------------------------------------------
67+
# ----- install & configure poetry -----
68+
#----------------------------------------------
4869
- name: Install Poetry
4970
uses: snok/install-poetry@v1
5071
with:
5172
virtualenvs-create: true
5273
virtualenvs-in-project: true
74+
#----------------------------------------------
75+
# load cached venv if cache exists
76+
#----------------------------------------------
5377
- name: Load cached venv
5478
id: cached-poetry-dependencies
5579
uses: actions/cache@v3
5680
with:
5781
path: .venv
5882
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
59-
- name: Install all dependencies, including indicators
83+
#----------------------------------------------
84+
# install dependencies if cache does not exist
85+
#----------------------------------------------
86+
- name: Install dependencies
6087
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
6188
run: |
62-
poetry install --no-interaction --all-extras
63-
- name: Confirm indicators dependencies installed
89+
poetry install --no-interaction --no-root
90+
#----------------------------------------------
91+
# install your root project, if required
92+
#----------------------------------------------
93+
- name: Install library
6494
run: |
65-
source .venv/bin/activate
66-
poetry show | grep -E 'numpy|scipy|tulipy'
95+
poetry install --no-interaction --extras indicators
96+
#----------------------------------------------
97+
# add matrix specifics and run test suite
98+
#----------------------------------------------
6799
- name: Run tests
68100
run: |
69-
poetry run coverage run -m unittest discover -s tests
101+
source .venv/bin/activate
102+
coverage run -m unittest discover -s tests
103+
# #----------------------------------------------
104+
# # upload coverage stats
105+
# #----------------------------------------------
106+
# - name: Upload coverage
107+
# uses: codecov/codecov-action@v3
108+
# with:
109+
# file: ./coverage.xml
110+
# fail_ci_if_error: true

0 commit comments

Comments
 (0)