Skip to content

v2.23 - Merge pull request #245 from pranjal-joshi/new-features #144

v2.23 - Merge pull request #245 from pranjal-joshi/new-features

v2.23 - Merge pull request #245 from pranjal-joshi/new-features #144

# Project : Screenipy
# Author : Pranjal Joshi
# Created : 30/04/2021
# Description : Workflow for building screenipy on pushing a tag
name: Screenipy Build - New Release
on:
push:
#branches: [ pre-main ]
tags:
- '*'
jobs:
# Job for builing packages
Build-Executables:
name: Build Packages
runs-on: ubuntu-latest
needs: Docker-Build
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# include:
# - os: windows-latest
# TARGET: Windows
# CMD_BUILD: |
# pyinstaller --onefile --icon=src\icon.ico src\screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress --hidden-import chromadb
# DEP_BUILD: |
# python -m pip install --upgrade pip
# echo Installing TA-lib...
# cd .github/dependencies/
# echo %cd%
# pip install TA_Lib-0.4.19-cp39-cp39-win_amd64.whl
# cd ..
# cd ..
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# TEST_BUILD: |
# ./dist/screenipy.exe --testbuild
# exit $?
# OUT_PATH: .\dist\screenipy.exe
# FILE_NAME: screenipy.exe
# - os: ubuntu-20.04
# TARGET: Linux
# CMD_BUILD: |
# pyinstaller --onefile --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress --hidden-import chromadb
# mv /home/runner/work/Screeni-py/Screeni-py/dist/screenipy /home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin
# chmod +x /home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin
# DEP_BUILD: |
# cd .github/dependencies/
# pwd
# tar -xzf ta-lib-0.4.0-src.tar.gz
# cd ta-lib/
# ./configure --prefix=/usr
# make
# sudo make install
# cd /home/runner/work/Screeni-py/Screeni-py/
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# pip install ta-lib==0.4.24
# TEST_BUILD: |
# /home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin --testbuild
# exit $?
# OUT_PATH: /home/runner/work/Screeni-py/Screeni-py/dist/screenipy.bin
# FILE_NAME: screenipy.bin
# - os: macos-latest
# TARGET: MacOS
# CMD_BUILD: |
# pyinstaller --onefile --windowed --icon=src/icon.ico src/screenipy.py --hidden-import cmath --hidden-import talib.stream --hidden-import numpy --hidden-import pandas --hidden-import alive-progress --hidden-import alive_progress --hidden-import chromadb
# mv /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy.run
# DEP_BUILD: |
# brew install ta-lib
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# pip install ta-lib==0.4.24
# TEST_BUILD: |
# /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy.run --testbuild
# exit $?
# OUT_PATH: /Users/runner/work/Screeni-py/Screeni-py/dist/screenipy.run
# FILE_NAME: screenipy.run
steps:
- uses: actions/checkout@v4
- name: Get the GitHub Tag version
id: get_version
shell: bash
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
# - name: Set up Python 3.9.4
# uses: actions/setup-python@v2
# with:
# python-version: 3.9.4
# - name: Load Cache for Linux Dependencies
# uses: actions/cache@v2
# if: startsWith(runner.os, 'Linux')
# with:
# path: |
# /usr/include/ta-lib
# /usr/bin/ta-lib-config
# key: ${{ runner.os }}-talib
# restore-keys: |
# ${{ runner.os }}-talib
# - name: Install dependencies for ${{ matrix.TARGET }}
# run: ${{ matrix.DEP_BUILD }}
# - name: Build for ${{ matrix.TARGET }}
# run: ${{ matrix.CMD_BUILD }}
# - name: Test Built Binary for ${{ matrix.TARGET }}
# shell: bash
# run: ${{ matrix.TEST_BUILD }}
# continue-on-error: false
# - name: Save Binaries as Artifacts
# uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.FILE_NAME }}
# path: ${{ matrix.OUT_PATH }}
- name: Read release.md
id: read_release
shell: bash
run: |
r=$(cat src/release.md)
r="${r//'%'/'%25'}"
r="${r//$'\n'/'%0A'}"
r="${r//$'\r'/'%0D'}"
echo "::set-output name=RELEASE_BODY::$r"
- name: Upload Binaries to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: README.md
asset_name: README.md
tag: ${{ github.ref }}
release_name: Screenipy - v${{ steps.get_version.outputs.VERSION }}
body: |
${{ steps.read_release.outputs.RELEASE_BODY }}
overwrite: true
Docker-Build:
name: Build and Release Docker Multi-Arch images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup hardware emulator using QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Setup Docker Buildx for multi-arch images
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get tag version version
id: version
run: |
VER=$(grep 'VERSION = ' src/classes/Changelog.py | awk -F'"' '{print $2}')
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Streamlit Build and Push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64
push: true
tags: joshipranjal/screeni-py:latest, joshipranjal/screeni-py:${{ env.VERSION }}