Skip to content
67 changes: 49 additions & 18 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,73 @@
name: Python application

on:
workflow_dispatch:
push:
branches: [ "master" ]
branches: [ main, master ]
pull_request:
branches: [ "master" ]
branches: [ main, master ]

permissions:
contents: read

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install Ruff
run: pip install ruff
- name: Lint code with Ruff
run: ruff check --output-format=github --target-version=py39 .
continue-on-error: true # TODO: delete once ruff errors are fixed
- name: Check code formatting with Ruff
run: ruff format --check .
continue-on-error: true # TODO: delete once ruff errors are fixed

build:
needs: lint
runs-on: ubuntu-latest
env:
PROXY: "http://51.83.140.52:16301"
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checking env
run: env
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
- name: Checking env
run: |
echo "PROXY: $PROXY"
env
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pyright
pip install pytest pytest-cov pyright tox
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Type check with pyright
run: pyright
- name: Test with pytest
run: |
pytest
- name: Test with tox
run: tox -e py
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: run-${{ join(matrix.*, '-') }}
parallel: true
finish:
needs: build
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
3 changes: 1 addition & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ pytest
pytest-asyncio
pytest-cov
pytest-flake8
python-coveralls
requests-mock
tox
setuptools
aioresponses
aioresponses
12 changes: 3 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
[tox]
envlist = py36, py37, py38, py39
envlist = py36, py37, py38, py39, py310, py311, py312

[testenv]
deps =
-rtest-requirements.txt
-rrequirements.txt
commands = py.test -v tests/ --doctest-modules --cov binance --cov-report term-missing
commands = pytest -v tests/ --doctest-modules --cov binance --cov-report term-missing
passenv =
TRAVIS
TRAVIS_BRANCH
TRAVIS_JOB_ID
PROXY

[testenv:flake8]
commands = flake8 binance/ setup.py examples/
deps = flake8

[travis]
python =
3.8: py38, flake8

[flake8]
exclude =
.git,
Expand Down
Loading