From aa8db03a0ea1823d6683aa685fc2f3c7a941580c Mon Sep 17 00:00:00 2001 From: Tyler Kennedy Date: Sun, 13 Feb 2022 00:40:55 -0500 Subject: [PATCH] Working on release workflow. --- .github/workflows/release.yml | 42 ++++++++++++++++++++--------------- .github/workflows/tests.yml | 2 +- requirements_test.txt | 1 - tests/test_polars.py | 6 ++++- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a26ac8ece..dfd828eef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,20 +1,31 @@ on: workflow_dispatch: push: - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + + # tags: + # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 name: Creating release env: - CIBW_TEST_EXTRAS: test + CIBW_BEFORE_TEST: "pip install -r requirements_test.txt" CIBW_TEST_COMMAND: "pytest {project}/tests" CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64" - CIBW_ARCHS_MACOS: "x86_64 universal2" - CIBW_BEFORE_BUILD_LINUX: "yum install -y gcc && curl -sL http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && tar -zxvf ta-lib-0.4.0-src.tar.gz && rm ta-lib-0.4.0-src.tar.gz && cd ta-lib && ./configure && make && make install" + CIBW_ARCHS_MACOS: "x86_64 arm64" + CIBW_BEFORE_BUILD: "pip install -r requirements_dev.txt" + # Polars is needed for the test suite, and Polars currently is only building binary packages for py3.6. + # So, we have to install rust before every build. + CIBW_BEFORE_BUILD_LINUX: | + curl -L -s https://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz -o ta.tar.gz && \ + tar -zxvf ta.tar.gz && \ + rm ta.tar.gz && \ + cd ta-lib && \ + ./configure && \ + make && \ + make install CIBW_BEFORE_BUILD_MACOS: "brew install ta-lib" - CIBW_BEFORE_BUILD_WINDOWS: "curl -sL http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-msvc.zip -o $HOME/ta-lib.zip --create-dirs && 7z x $HOME/ta-lib.zip -o/c/ta-lib && mv /c/ta-lib/ta-lib/* /c/ta-lib/ && rm -rf /c/ta-lib/ta-lib && cd /c/ta-lib/c/make/cdr/win32/msvc && nmake" - + CIBW_BEFORE_BUILD_WINDOWS: | + curl -L -s https://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-msvc.zip -o ta.zip && 7z x ta.zip -o/c/ta-lib && mv /c/ta-lib/ta-lib/* /c/ta-lib/ && rm -rf /c/ta-lib/ta-lib && cd /c/ta-lib/c/make/cdr/win32/msvc && nmake jobs: # Build & test simple source release before wasting hours building and @@ -32,18 +43,15 @@ jobs: - name: Installing python build dependencies run: | - python -m pip install --upgrade pip - python -m pip install --upgrade setuptools + python -m pip install --upgrade pip wheel + python -m pip install -r requirements.txt + python -m pip install -r requirements_test.txt + pip install flake8 pytest - name: Building source distribution run: | - pip install -e ".[release]" python setup.py sdist - - name: Ensuring documentation builds - run: | - cd docs && make clean && make html - - uses: actions/upload-artifact@v2 with: path: dist/*.tar.gz @@ -53,12 +61,10 @@ jobs: name: "[${{ strategy.job-index }}/${{ strategy.job-total }}] py${{ matrix.py }} on ${{ matrix.os }}" runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: os: [ubuntu-20.04, windows-2019, macos-10.15] - # cp - CPython - # pp - PyPy - py: [cp37", "cp38", "cp39", "cp310", "pp37"] + py: ["cp37", "cp38", "cp39", "cp310"] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c067c716c..1b0b35cbf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: python -m pip install --upgrade pip wheel python -m pip install -r requirements.txt python -m pip install -r requirements_test.txt - pip install flake8 pytest + pip install flake8 pytest polars env: DEPS_PATH: ${{ github.workspace }}/dependencies TA_INCLUDE_PATH: ${{ github.workspace }}/dependencies/include diff --git a/requirements_test.txt b/requirements_test.txt index 144e7c76c..dee812302 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,4 +1,3 @@ -r requirements.txt pandas pytest -polars diff --git a/tests/test_polars.py b/tests/test_polars.py index 5bb7f7d24..0b47355c6 100644 --- a/tests/test_polars.py +++ b/tests/test_polars.py @@ -1,10 +1,14 @@ import numpy as np +import pytest from numpy.testing import assert_array_equal -import polars as pl import talib from talib import abstract + +pl = pytest.importorskip('polars') + + def test_MOM(): values = pl.Series([90.0,88.0,89.0]) result = talib.MOM(values, timeperiod=1)