Fixes #480: Builds multi-platform image for both amd64 and arm64 #756
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python application | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
# os: [ubuntu-latest, macos-latest, windows-latest] | |
os: [ubuntu-latest] | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/pip | |
#- os: macos-latest-xlarge | |
# path: ~/Library/Caches/pip | |
#- os: windows-latest | |
# path: ~\AppData\Local\pip\Cache | |
python-version: ['3.9', '3.10', '3.11'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Set up ta-lib dir | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
mkdir -p $HOME/.local/ta-lib | |
echo "LD_LIBRARY_PATH=$HOME/.local/ta-lib/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
echo "TA_INCLUDE_PATH=$HOME/.local/ta-lib/include" >> $GITHUB_ENV | |
echo "TA_LIBRARY_PATH=$HOME/.local/ta-lib/lib" >> $GITHUB_ENV | |
- name: Set up ta-lib cache | |
if: ${{ runner.os == 'Linux' }} | |
uses: actions/cache@v2 | |
id: talib-cache | |
with: | |
path: | | |
~/.local/ta-lib/lib | |
~/.local/ta-lib/include | |
key: talib-cache-v0.4.0 | |
- name: Install ta-lib mac / windows | |
run: | | |
if ([ "$RUNNER_OS" = "macOS" ]); then | |
brew install ta-lib | |
fi | |
if ([ "$RUNNER_OS" = "Windows" ]); then | |
curl -sL http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-msvc.zip -o $GITHUB_WORKSPACE/ta-lib.zip --create-dirs && 7z x $GITHUB_WORKSPACE/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 | |
fi | |
- name: Install ta-lib Linux | |
if: steps.talib-cache.outputs.cache-hit != 'true' | |
run: | | |
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz -q && tar -xzf ta-lib-0.4.0-src.tar.gz | |
cd ta-lib/ | |
./configure --prefix=$HOME/.local/ta-lib | |
make | |
sudo make install | |
cd | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
if [ ! ${{ matrix.python-version }} = "3.10"]; then pip install numba; fi | |
pip install -e . -U | |
# - 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: Test with pytest | |
run: | | |
pip install pytest | |
pytest |