Updated workflow and dependencies #5
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 upload a Python Package using Twine when a release is created | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Python Package CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install TA-Lib C library dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libta-lib-dev # Install the TA-Lib C library | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest # Assuming pytest is used for running tests | |
pip install TA-Lib # Ensure TA-Lib Python wrapper is installed | |
- name: Run tests | |
run: pytest tests/ # Run tests located in the tests/ directory | |
deploy: | |
if: github.event_name == 'release' && github.event.action == 'published' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install TA-Lib C library dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libta-lib-dev # Install the TA-Lib C library for deployment as well | |
- name: Install build tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
pip install TA-Lib # Ensure TA-Lib Python wrapper is installed for building the package | |
- name: Build package | |
run: python -m build | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |