Update tests.yml #653
Workflow file for this run
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 workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
- 'feature/**' | |
jobs: | |
style_check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8==5.0.4 pytest | |
- name: Style check | |
run: flake8 . | |
unit_tests: | |
runs-on: ubuntu-latest | |
needs: style_check | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[blpapi]" --extra-index-url https://blpapi.bloomberg.com/repository/releases/python/simple | |
pip install flake8==5.0.4 pytest | |
pip install coverage | |
- name: Unit tests | |
env: | |
QUANTFIN_SECRET: ${{ secrets.QUANTFIN_SECRET }} | |
run: | | |
coverage run -m pytest qf_lib/tests/unit_tests | |
coverage xml -o unit_tests.xml | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unit_tests | |
path: unit_tests.xml | |
backtesting_tests: | |
runs-on: ubuntu-latest | |
needs: style_check | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[blpapi]" --extra-index-url https://blpapi.bloomberg.com/repository/releases/python/simple | |
pip install flake8==5.0.4 pytest | |
pip install coverage | |
- name: Integration tests | |
env: | |
QUANTFIN_SECRET: ${{ secrets.QUANTFIN_SECRET }} | |
run: | | |
coverage run -a -m pytest qf_lib/tests/integration_tests/backtesting | |
coverage xml -o backtesting_tests.xml | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: backtesting_tests | |
path: backtesting_tests.xml | |
data_providers_tests: | |
runs-on: ubuntu-latest | |
needs: style_check | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[blpapi]" --extra-index-url https://blpapi.bloomberg.com/repository/releases/python/simple | |
pip install flake8==5.0.4 pytest | |
pip install coverage | |
- name: Integration tests | |
env: | |
QUANTFIN_SECRET: ${{ secrets.QUANTFIN_SECRET }} | |
run: | | |
coverage run -a -m pytest qf_lib/tests/integration_tests/data_providers | |
coverage xml -o data_providers_tests.xml | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: data_providers_tests | |
path: data_providers_tests.xml | |
codecov_upload: | |
runs-on: ubuntu-latest | |
needs: [unit_tests, data_providers_tests, backtesting_tests] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download unit_tests artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: unit_tests | |
- name: Download artifacts data_providers_tests | |
uses: actions/download-artifact@v4 | |
with: | |
name: data_providers_tests | |
- name: Download backtesting_tests artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: backtesting_tests | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8==5.0.4 pytest | |
pip install coverage | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: ./unit_tests.xml, ./data_providers_tests.xml, ./backtesting_tests.xml | |
fail_ci_if_error: true | |
name: qf-lib-codecov | |
verbose: true |