chore(sdk): use a singleton factory pattern to instantiate the client, improve docs on using it #315
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
name: CI | |
on: | |
- pull_request | |
jobs: | |
code-quality: | |
name: Code quality checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dev dependencies | |
run: | | |
python -m pip install -e .[dev] | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Check formatting with black | |
run: | | |
black --check . | |
- name: Lint with flake8 | |
run: | | |
flake8 posthog --ignore E501 | |
- name: Check import order with isort | |
run: | | |
isort --check-only . | |
tests: | |
name: Python tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
- name: Install requirements.txt dependencies with pip | |
run: | | |
python -m pip install -e .[test] | |
- name: Run posthog tests | |
run: | | |
pytest --verbose --timeout=30 |