From c593485d930113646d9d36045320533b60594713 Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Thu, 24 Oct 2024 17:09:21 +0300 Subject: [PATCH 01/12] first commit --- .github/workflows/test.yml | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..0a665d3b9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,48 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python binance + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + env: + PROXY: "http://51.83.140.52:16301" + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Checking env + run: env + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest pyright + 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 ruff + run: | + ruff check . + # 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 From 929dfa6d4d0175df0d77a6f18b01309a6a5975c4 Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Fri, 25 Oct 2024 01:43:19 +0300 Subject: [PATCH 02/12] add test action --- .github/workflows/test.yml | 13 +++++-------- tox.ini | 8 ++------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a665d3b9..94b47cdd1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python binance +name: lint and test on: workflow_dispatch: @@ -34,15 +34,12 @@ jobs: pip install flake8 pytest pyright 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 ruff + - name: Lint run: | - ruff check . # 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: Run tox + # Run tox using the version of Python in `PATH` + run: tox -e py diff --git a/tox.ini b/tox.ini index f56d0b11c..632b16508 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,11 @@ [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 @@ -15,10 +15,6 @@ passenv = commands = flake8 binance/ setup.py examples/ deps = flake8 -[travis] -python = - 3.8: py38, flake8 - [flake8] exclude = .git, From feb5673b7038d67561817cec338d595350f99c8e Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Fri, 25 Oct 2024 01:45:34 +0300 Subject: [PATCH 03/12] fix action --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94b47cdd1..1317249b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,14 +11,12 @@ permissions: jobs: build: - runs-on: ubuntu-latest env: PROXY: "http://51.83.140.52:16301" strategy: matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - steps: - uses: actions/checkout@v4 - name: Checking env From 8d9ba66728fb5d2e94948378bdf79e808b3d737f Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Fri, 25 Oct 2024 01:49:23 +0300 Subject: [PATCH 04/12] fix action --- .github/workflows/test.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1317249b2..ca49e7732 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,20 +11,21 @@ permissions: jobs: build: + runs-on: ubuntu-latest env: PROXY: "http://51.83.140.52:16301" strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Checking env run: env - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python }} cache: 'pip' - name: Install dependencies run: | @@ -38,6 +39,6 @@ jobs: 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: Run tox - # Run tox using the version of Python in `PATH` - run: tox -e py + - name: Run tox + # Run tox using the version of Python in `PATH` + run: tox -e py From 3010962dc920cbd04d2577e3d46a99fe69146e1f Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Fri, 25 Oct 2024 01:54:30 +0300 Subject: [PATCH 05/12] add pyright --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ca49e7732..7ca6fae58 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,8 @@ jobs: 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: Run tox # Run tox using the version of Python in `PATH` run: tox -e py From bb7849af58bd3bbc8066e2682543bf5302aaeaaf Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Sun, 27 Oct 2024 12:22:18 +0300 Subject: [PATCH 06/12] small changes --- .github/workflows/test.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ca6fae58..0da86adec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,13 +5,16 @@ name: lint and test on: workflow_dispatch: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] permissions: contents: read jobs: build: - runs-on: ubuntu-latest env: PROXY: "http://51.83.140.52:16301" @@ -30,10 +33,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest pyright + pip install flake8 pytest 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 + - 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 @@ -41,6 +44,5 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Type check with pyright run: pyright - - name: Run tox - # Run tox using the version of Python in `PATH` + - name: Test with tox run: tox -e py From c3abc0640e05a0513ff7c6db1d49a3313011e969 Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Sun, 27 Oct 2024 12:57:53 +0300 Subject: [PATCH 07/12] print proxy --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0da86adec..7977477f2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,9 @@ jobs: steps: - uses: actions/checkout@v4 - name: Checking env - run: env + run: | + echo "PROXY: $PROXY" + env - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 with: From a4b74b9959ff946ef224d5e3bf986b94ce556a68 Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Sun, 27 Oct 2024 13:03:14 +0300 Subject: [PATCH 08/12] update tox conf to get proxy --- tox.ini | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 632b16508..52038b8d3 100644 --- a/tox.ini +++ b/tox.ini @@ -7,9 +7,7 @@ deps = -rrequirements.txt 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/ From 57fd79b72f497d239f668dd37561d85748a6ac02 Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Sun, 27 Oct 2024 13:49:22 +0300 Subject: [PATCH 09/12] update action to seperate lint --- .github/workflows/test.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7977477f2..154030a28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,24 @@ permissions: contents: read jobs: + 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 . + - 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" @@ -35,15 +52,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest pyright tox + 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 tox From d66b684be9b5bfa93e115118fd94db0a171da2ac Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Sun, 27 Oct 2024 14:08:24 +0300 Subject: [PATCH 10/12] continue on error and add coveralls --- .github/workflows/test.yml | 8 ++++++++ test-requirements.txt | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 154030a28..03f31cde2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,7 @@ jobs: 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 @@ -59,3 +60,10 @@ jobs: run: pyright - name: Test with tox run: tox -e py + finish: + needs: build + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 diff --git a/test-requirements.txt b/test-requirements.txt index 02eb728df..9078d8f9b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,8 +4,7 @@ pytest pytest-asyncio pytest-cov pytest-flake8 -python-coveralls requests-mock tox setuptools -aioresponses \ No newline at end of file +aioresponses From 3d94fb1eab84173480408eb4d42b101dfcf5a9f3 Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Sun, 27 Oct 2024 14:16:39 +0300 Subject: [PATCH 11/12] test coveralls parallel --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03f31cde2..a8eb40a23 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,6 +60,11 @@ jobs: run: pyright - 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() }} @@ -67,3 +72,5 @@ jobs: steps: - name: Coveralls Finished uses: coverallsapp/github-action@v2 + with: + parallel-finished: true From 49b1e2f507b296446af586e5173ba4cc15bd4551 Mon Sep 17 00:00:00 2001 From: pcriadoperez Date: Sun, 27 Oct 2024 14:23:34 +0300 Subject: [PATCH 12/12] move changes to python-app.yml --- .github/workflows/python-app.yml | 67 ++++++++++++++++++++-------- .github/workflows/test.yml | 76 -------------------------------- 2 files changed, 49 insertions(+), 94 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 383a70911..38588b08e 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index a8eb40a23..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,76 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: lint and test - -on: - workflow_dispatch: - push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] - -permissions: - contents: read - -jobs: - 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: - - uses: actions/checkout@v4 - - name: Checking env - run: | - echo "PROXY: $PROXY" - env - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - cache: 'pip' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - 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: Type check with pyright - run: pyright - - 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