Skip to content

Update test_sdk.py #378

Update test_sdk.py

Update test_sdk.py #378

Workflow file for this run

name: ci
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
on: [push]
jobs:
compile:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Bootstrap Poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies including python-dotenv
run: |
poetry add python-dotenv
poetry install
- name: Run Mypy with ignore missing imports
run: poetry run mypy --ignore-missing-imports .
test:
name: Test
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
- name: Test
run: poetry run pytest . -v
run-examples:
name: Run examples (to look for regressions)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: test examples (not rate limiting)
#TODO: refactor to run all examples (based on file location) and run them in parallel
run: |
pip install python-dotenv
pip install .
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Running hello world"
python examples/hello-world.py
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Running smoke test"
python examples/smoke-test.py
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Running resolve example"
python examples/screening.py
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Running trade search example"
python examples/trade-search.py
publish:
needs: [compile, test, run-examples]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
- name: Update pyproject.toml
run: |
sed 's/description = ""/description = "A Python SDK for Sayari"/g' pyproject.toml > tmp_pyproject
mv tmp_pyproject pyproject.toml
- name: Publish to pypi
run: |
poetry config repositories.remote https://upload.pypi.org/legacy/
poetry --no-interaction -v publish --build --repository remote --username "__token__" --password "$SAYARI_PYPI_PASSWORD"
env:
SAYARI_PYPI_PASSWORD: ${{ secrets.SAYARI_PYPI_PASSWORD }}