# 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: name: Build Packages #needs: Create-Release 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 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 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 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@v2 - 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: ${{ matrix.OUT_PATH }} asset_name: ${{ matrix.FILE_NAME }} tag: ${{ github.ref }} release_name: Screenipy - v${{ steps.get_version.outputs.VERSION }} body: | ${{ steps.read_release.outputs.RELEASE_BODY }} overwrite: true