diff --git a/.github/workflows/intel_macos_build.yml b/.github/workflows/intel_macos_build.yml deleted file mode 100644 index fc1def70762..00000000000 --- a/.github/workflows/intel_macos_build.yml +++ /dev/null @@ -1,200 +0,0 @@ -name: Intel MacOS Build - -env: - OPENBB_ENABLE_QUICK_EXIT: true - OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false - OPENBB_USE_PROMPT_TOOLKIT: false - OPENBB_FILE_OVERWRITE: true - PIP_DEFAULT_TIMEOUT: 100 - PYTHONNOUSERSITE: 1 - -on: workflow_dispatch - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - Build: - name: Intel MacOS Build - runs-on: [self-hosted, macos, x64] - steps: - # Checkout repository main branch. this allows for the commit hashes to line up - - name: Checkout - uses: actions/checkout@v3 - - name: Git Log - run: git log - # Install create-dmg - - name: Install create-dmg - run: brew install create-dmg - # The following commands to clear previous PATHS and restore to defaults since we have to maintain the instance ourselves - - name: Clean Previous Path - run: | - export PATH="" - export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" - echo $PATH - # Set up caching for conda env so that the workflow runs quickly after the first time - - name: Setup Conda Caching - uses: actions/cache@v3 - with: - path: ~/conda_pkgs_dir - key: conda-macos-3-9-${{ hashFiles('build/conda/conda-3-9-env-full.yaml') }} - # Set up miniconda using the environment yaml file within the repo - - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v2.2.0 - with: - miniconda-version: "latest" - auto-update-conda: true - channels: conda-forge,defaults - show-channel-urls: true - channel-priority: flexible - environment-file: build/conda/conda-3-9-env-full.yaml - activate-environment: build_env - use-only-tar-bz2: true # Needed for caching some reason - - name: Install requirements - run: | - pip list - python -m pip install -r requirements-full.txt - - name: Install Specific Papermill - run: | - pip list - pip uninstall papermill -y - pip install git+https://github.com/nteract/papermill.git@main - # This is basically the same as build4mac.sh - - name: Build Bundle - run: | - pip list - python -m PyInstaller build/pyinstaller/terminal.spec --clean - osascript build/pyinstaller/setup_icons.applescript - mkdir DMG - cp -r build/pyinstaller/macOS_package_assets/* DMG/ - mv dist/OpenBBTerminal DMG/OpenBB\ Terminal/.OpenBB - - name: Creating Keychain - env: - MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} - MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} - MACOS_CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} - run: | # when pushing to main, make to generate new cert, and utilize secrets to store new password, and identity - echo "Decoding" - echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 - echo "Creating Keychain" - security create-keychain -p $MACOS_KEYCHAIN_PWD build.keychain - echo "Setting Default Keychain" - security default-keychain -s build.keychain - echo "Unlocking Keychain" - security unlock-keychain -p $MACOS_KEYCHAIN_PWD build.keychain - echo "Importing Keychain" - security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign - echo "Setting Partition List" - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_KEYCHAIN_PWD build.keychain - - name: Codesign Specific Binaries - env: - MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} - MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} - MACOS_CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} - run: | - echo "Code Signing SO Files" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*/*/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*/*/*/*.so - echo "Code Signing DYLIB Files" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*/*/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/.dylibs/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/torch/.dylibs/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/sklearn/.dylibs/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/scipy/.dylibs/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/xgboost/.dylibs/*.dylib - - echo "Code Signing Other Files" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/prophet_model.bin - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/diagnose - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/print - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/stanc - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/stansummary - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/pyarrow/plasma-store-server - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/torch/bin/protoc - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/torch/bin/protoc-3.13.0.0 - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/torch/bin/torch_shm_manager - echo "Code Sign OpenBB Executable File" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/OpenBBTerminal - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/OpenBBPlotsBackend - - name: Create DMG - run: create-dmg --volname "OpenBB Terminal" --volicon "images/dmg_volume.icns" --background "images/openbb_dmg_background.png" --icon "OpenBB Terminal" 190 250 --window-pos 190 120 --window-size 800 400 --icon-size 100 --text-size 14 --app-drop-link 600 250 --eula LICENSE --format UDZO --no-internet-enable "OpenBB Terminal".dmg DMG - - name: Code Sign DMG Installer - env: - MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} - MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} - MACOS_CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} - run: | - echo "Code Signing DMG Installer" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY OpenBB\ Terminal.dmg - echo "Verify Signing" - codesign --verify --deep --strict --verbose=2 OpenBB\ Terminal.dmg - - name: Deleting Previous Keychain - run: | - echo "Deleting Previous Keychain to Clean Instance" - rm -rf /Users/openbb/Library/Keychains/build.keychain-db - - name: Clean up Build Artifacts - run: | - rm -rf build/terminal - rm -rf dist - rm -rf DMG - - name: Notarize DMG - env: - NOTARIZE_APPLE_ID: ${{ secrets.NOTARIZE_APPLE_ID }} - NOTARIZE_APPLE_PWD: ${{ secrets.NOTARIZE_APPLE_PWD }} - NOTARIZE_APPLE_TEAM_ID: ${{ secrets.NOTARIZE_APPLE_TEAM_ID }} - run: | - xcrun notarytool submit OpenBB\ Terminal.dmg --apple-id "$NOTARIZE_APPLE_ID" --password "$NOTARIZE_APPLE_PWD" --team-id "$NOTARIZE_APPLE_TEAM_ID" --wait - - name: Staple - run: | - xcrun stapler staple "OpenBB Terminal.dmg" - - name: Save Build Artifact DMG - uses: actions/upload-artifact@v3 - with: - name: Intel MacOS DMG Artifact - path: OpenBB\ Terminal.dmg - - name: Convert & Mount DMG - run: | # Remove the converting disc image at the end - hdiutil convert OpenBB\ Terminal.dmg -format UDTO -o openbbterminal.cdr - hdiutil attach openbbterminal.cdr - rm -rf openbbterminal.cdr - - name: Directory Change - run: | - cd - cd /Volumes/OpenBB\ Terminal - ls - cp -R OpenBB\ Terminal ~/Desktop - - name: Unmount DMG - run: hdiutil detach /dev/disk2 - - - name: Run Integration Tests - run: | - /Users/openbb/Desktop/OpenBB\ Terminal/.OpenBB/OpenBBTerminal -t -s forecast cryptocurrency reports alternative economy futures econometrics dashboards portfolio stocks/test_stocks_options_screen.openbb stocks/test_stocks_options.openbb forex etf stocks/test_stocks_fa.openbb > result.txt - cat result.txt - grep "================================ integration test summary ================================" result.txt -A100 | tail --bytes=2000 > failed_tests.txt - - - name: Upload summary to Slack - uses: adrey/slack-file-upload-action@master - with: - token: ${{ secrets.SLACK_API_TOKEN }} - initial_comment: "Intel MacOs Build Integration test summary" - title: "Intel MacOs Build Integration test summary" - path: failed_tests.txt - channel: ${{ secrets.SLACK_CHANNEL_ID }} - - - name: Remove OpenBB Folder - run: rm -rf /Users/openbb/Desktop/OpenBB\ Terminal - - name: Remove OpenBB Exports Folder - run: rm -rf ~/Desktop/OPENBB-exports diff --git a/.github/workflows/m1_macos_build.yml b/.github/workflows/m1_macos_build.yml deleted file mode 100644 index cb30f0b39d1..00000000000 --- a/.github/workflows/m1_macos_build.yml +++ /dev/null @@ -1,205 +0,0 @@ -name: M1 MacOS Build - -env: - OPENBB_ENABLE_QUICK_EXIT: true - OPENBB_LOG_COLLECT: false - OPENBB_USE_ION: false - OPENBB_USE_PROMPT_TOOLKIT: false - OPENBB_FILE_OVERWRITE: true - PIP_DEFAULT_TIMEOUT: 100 - PYTHONNOUSERSITE: 1 - -on: workflow_dispatch - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - Build: - name: M1 MacOS Build - runs-on: [self-hosted, macos, ARM64] - steps: - # Checkout repository main branch. this allows for the commit hashes to line up - - name: Checkout - uses: actions/checkout@v3 - - name: Git Log - run: git log - # Install create-dmg - - name: Install create-dmg - run: brew install create-dmg - # The following commands to clear previous PATHS and restore to defaults since we have to maintain the instance ourselves - - name: Clean Previous Path - run: | - export PATH="" - export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" - echo $PATH - # Set up caching for conda env so that the workflow runs quickly after the first time - - name: Setup Conda Caching - uses: actions/cache@v3 - with: - path: ~/conda_pkgs_dir - key: conda-macos-3-9-${{ hashFiles('build/conda/conda-3-9-env-full.yaml') }} - # Set up miniconda using the environment yaml file within the repo - - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v2.2.0 - with: - miniconda-version: "latest" - auto-update-conda: true - channels: conda-forge,defaults - show-channel-urls: true - channel-priority: flexible - environment-file: build/conda/conda-3-9-env-full.yaml - activate-environment: build_env - auto-activate-base: false - use-only-tar-bz2: true # Needed for caching some reason - - - name: Run Poetry - run: | - pip list - python -m pip install -r requirements-full.txt - - - name: Install Specific Papermill - run: | - pip uninstall papermill -y - pip install git+https://github.com/nteract/papermill.git@main - - # This is basically the same as build4mac.sh - - name: Build Bundle - run: | - python -m PyInstaller build/pyinstaller/terminal.spec --clean - osascript build/pyinstaller/setup_icons.applescript - mkdir DMG - cp -r build/pyinstaller/macOS_package_assets/* DMG/ - mv dist/OpenBBTerminal DMG/OpenBB\ Terminal/.OpenBB - - name: Creating Keychain - env: - MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} - MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} - MACOS_CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} - run: | # when pushing to main, make to generate new cert, and utilize secrets to store new password, and identity - echo "Ensuring Keychain with same name does not exist" - rm -rf /Users/openbb/Library/Keychains/build.keychain-db - echo "Decoding certificate" - echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 - echo "Creating Keychain" - security create-keychain -p $MACOS_KEYCHAIN_PWD build.keychain - echo "Setting Default Keychain" - security default-keychain -s build.keychain - echo "Unlocking Keychain" - security unlock-keychain -p $MACOS_KEYCHAIN_PWD build.keychain - echo "Importing Keychain" - security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign - echo "Setting Partition List" - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_KEYCHAIN_PWD build.keychain - - name: Codesign Specific Binaries - env: - MACOS_CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} - run: | - echo "Code Signing SO Files" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*/*/*.so - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*/*/*/*.so - echo "Code Signing DYLIB Files" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/*/*/*/*/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/.dylibs/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/torch/.dylibs/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/sklearn/.dylibs/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/scipy/.dylibs/*.dylib - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/xgboost/.dylibs/*.dylib - echo "Code Signing Other Files" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/prophet_model.bin - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/diagnose - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/print - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/stanc - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/stansummary - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/pyarrow/plasma-store-server - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/torch/bin/protoc - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/torch/bin/protoc-3.13.0.0 - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/torch/bin/torch_shm_manager - echo "Code Sign OpenBB Executable File" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/OpenBBTerminal - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY DMG/OpenBB\ Terminal/.OpenBB/OpenBBPlotsBackend - - name: Create DMG - run: create-dmg --volname "OpenBB Terminal" --volicon "images/dmg_volume.icns" --background "images/openbb_dmg_background.png" --icon "OpenBB Terminal" 190 250 --window-pos 190 120 --window-size 800 400 --icon-size 100 --text-size 14 --app-drop-link 600 250 --eula LICENSE --format UDZO --no-internet-enable "OpenBB Terminal".dmg DMG - - name: Code Sign DMG Installer - env: - MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} - MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} - MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} - MACOS_CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} - run: | - echo "Code Signing DMG Installer" - /usr/bin/codesign --deep --force --verify --verbose --options runtime --entitlements "build/pyinstaller/entitlements.plist" -s $MACOS_CODESIGN_IDENTITY OpenBB\ Terminal.dmg - echo "Verify Signing" - codesign --verify --deep --strict --verbose=2 OpenBB\ Terminal.dmg - - name: Deleting Previous Keychain - run: | - echo "Deleting Previous Keychain to Clean Instance" - rm -rf /Users/openbb/Library/Keychains/build.keychain-db - - name: Clean up Build Artifacts - run: | - rm -rf build/terminal - rm -rf dist - rm -rf DMG - - name: Notorize DMG - env: - NOTARIZE_APPLE_ID: ${{ secrets.NOTARIZE_APPLE_ID }} - NOTARIZE_APPLE_PWD: ${{ secrets.NOTARIZE_APPLE_PWD }} - NOTARIZE_APPLE_TEAM_ID: ${{ secrets.NOTARIZE_APPLE_TEAM_ID }} - run: | - xcrun notarytool submit OpenBB\ Terminal.dmg --apple-id "$NOTARIZE_APPLE_ID" --password "$NOTARIZE_APPLE_PWD" --team-id "$NOTARIZE_APPLE_TEAM_ID" --wait - - name: Staple - run: | - xcrun stapler staple "OpenBB Terminal.dmg" - - name: Clean up Build Artifacts - run: | - rm -rf build/terminal - rm -rf dist - rm -rf DMG - - name: Save Build Artifact DMG - uses: actions/upload-artifact@v3 - with: - name: M1 MacOS DMG Artifact - path: OpenBB\ Terminal.dmg - - name: Convert & Mount DMG - run: | - hdiutil convert OpenBB\ Terminal.dmg -format UDTO -o openbbterminal.cdr - hdiutil attach openbbterminal.cdr - rm -rf openbbterminal.cdr - - name: Directory Change - run: | - cd - cd /Volumes/OpenBB\ Terminal - ls - cp -R OpenBB\ Terminal ~/Desktop - - name: Unmount DMG - run: hdiutil detach /dev/disk4 - - - name: Run Integration Tests - run: | - /Users/openbb/Desktop/OpenBB\ Terminal/.OpenBB/OpenBBTerminal -t -s forecast cryptocurrency reports alternative economy futures econometrics dashboards portfolio stocks/test_stocks_options_screen.openbb stocks/test_stocks_options.openbb forex etf stocks/test_stocks_fa.openbb > result.txt - cat result.txt - grep "================================ integration test summary ================================" result.txt -A100 | tail --bytes=2000 > failed_tests.txt - - - name: Upload summary to Slack - uses: adrey/slack-file-upload-action@master - with: - token: ${{ secrets.SLACK_API_TOKEN }} - initial_comment: "M1 MacOs Build Integration test summary" - title: "M1 MacOs Build Integration test summary" - path: failed_tests.txt - channel: ${{ secrets.SLACK_CHANNEL_ID }} - - - name: Remove OpenBB Folder - run: rm -rf /Users/openbb/Desktop/OpenBB\ Terminal - - name: Remove OpenBB Exports Folder - run: rm -rf ~/Desktop/OPENBB-exports diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml new file mode 100644 index 00000000000..8543f9ebe0e --- /dev/null +++ b/.github/workflows/macos_build.yml @@ -0,0 +1,155 @@ +name: MacOS Build + +env: + OPENBB_ENABLE_QUICK_EXIT: true + OPENBB_LOG_COLLECT: false + OPENBB_USE_ION: false + OPENBB_USE_PROMPT_TOOLKIT: false + OPENBB_FILE_OVERWRITE: true + PIP_DEFAULT_TIMEOUT: 100 + PYTHONNOUSERSITE: 1 + +on: workflow_dispatch + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + Build: + name: MacOS Build + runs-on: ${{ matrix.items.os }} + strategy: + matrix: + items: [ + {os: [self-hosted, macos, ARM64], name: "OpenBBM1.pkg"}, + {os: [self-hosted, macos, x64], name: "OpenBBIntel.pkg"} + ] + steps: + # Checkout repository main branch. this allows for the commit hashes to line up + - name: Checkout + uses: actions/checkout@v3 + - name: Git Log + run: git log + # The following commands to clear previous PATHS and restore to defaults since we have to maintain the instance ourselves + - name: Clean Previous Path + run: | + export PATH="" + export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" + echo $PATH + # Set up caching for conda env so that the workflow runs quickly after the first time + - name: Setup Conda Caching + uses: actions/cache@v3 + with: + path: ~/conda_pkgs_dir + key: conda-macos-3-9-${{ hashFiles('build/conda/conda-3-9-env-full.yaml') }} + # Set up miniconda using the environment yaml file within the repo + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2.2.0 + with: + miniconda-version: "latest" + auto-update-conda: true + channels: conda-forge,defaults + show-channel-urls: true + channel-priority: flexible + environment-file: build/conda/conda-3-9-env-full.yaml + activate-environment: build_env + auto-activate-base: false + use-only-tar-bz2: true # Needed for caching some reason + + - name: Install Dependencies + run: | + pip list + python -m pip install -r requirements-full.txt + pip install openbb + + - name: Build Bundle + run: build/pyinstaller/build4mac.sh + shell: bash + - name: Creating Application Keychain + env: + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} + MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} + MACOS_CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} + run: | # when pushing to main, make to generate new cert, and utilize secrets to store new password, and identity + echo "Ensuring Keychain with same name does not exist" + rm -rf /Users/openbb/Library/Keychains/build.keychain-db + echo "Decoding certificate" + echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 + echo "Creating Keychain" + security create-keychain -p $MACOS_KEYCHAIN_PWD build.keychain + echo "Setting Default Keychain" + security default-keychain -s build.keychain + echo "Unlocking Keychain" + security unlock-keychain -p $MACOS_KEYCHAIN_PWD build.keychain + echo "Importing Keychain" + security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign + echo "Setting Partition List" + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_KEYCHAIN_PWD build.keychain + - name: Create Signed Package + env: + APPLE_DEVELOPER_CERTIFICATE_ID: ${{ secrets.MACOS_INSTALLER_CODESIGN_IDENTITY }} + MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} + MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }} + MACOS_INSTALLER_KEYCHAIN_PWD: ${{ secrets.MACOS_INSTALLER_KEYCHAIN_PWD }} + APPLE_SIGNING_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} + run: | + security unlock-keychain -p $MACOS_INSTALLER_KEYCHAIN_PWD install.keychain + build/pyinstaller/macOS/build-macos.sh OpenBBTerminal 0.0.1 + mv build/pyinstaller/macOS/target/pkg/OpenBBTerminalM1.pkg OpenBBTerminalM1.pkg + shell: bash + - name: Deleting Previous Keychain + run: | + echo "Deleting Previous Keychain to Clean Instance" + rm -rf /Users/openbb/Library/Keychains/build.keychain-db + - name: Clean up Build Artifacts + run: | + rm -rf build/terminal + rm -rf dist + rm -rf DMG + - name: Notorize DMG + env: + NOTARIZE_APPLE_ID: ${{ secrets.NOTARIZE_APPLE_ID }} + NOTARIZE_APPLE_PWD: ${{ secrets.NOTARIZE_APPLE_PWD }} + NOTARIZE_APPLE_TEAM_ID: ${{ secrets.NOTARIZE_APPLE_TEAM_ID }} + run: | + xcrun notarytool submit OpenBBTerminalM1.pkg --apple-id "$NOTARIZE_APPLE_ID" --password "$NOTARIZE_APPLE_PWD" --team-id "$NOTARIZE_APPLE_TEAM_ID" --wait + - name: Staple + run: | + xcrun stapler staple OpenBBTerminalM1.pkg + - name: Clean up Build Artifacts + run: | + rm -rf build/terminal + rm -rf dist + rm -rf DMG + - name: Save Build Artifact PKG + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.items.name }} + path: OpenBBTerminalM1.pkg + - name: Get contents from PkgUtil + run: | + pkgutil --expand-full OpenBBTerminalM1.pkg extract/ + rm -rf OpenBBTerminalM1.pkg + + - name: Run Integration Tests + run: | + extract/OpenBBTerminal.pkg/Payload/Applications/OpenBB\ Terminal/.OpenBB/OpenBBTerminal -t -s forecast cryptocurrency reports alternative economy futures econometrics dashboards portfolio stocks/test_stocks_options_screen.openbb stocks/test_stocks_options.openbb forex etf stocks/test_stocks_fa.openbb > result.txt + cat result.txt + grep "================================ integration test summary ================================" result.txt -A100 | tail --bytes=2000 > failed_tests.txt + + - name: Upload summary to Slack + uses: adrey/slack-file-upload-action@master + with: + token: ${{ secrets.SLACK_API_TOKEN }} + initial_comment: "M1 MacOs Build Integration test summary" + title: "M1 MacOs Build Integration test summary" + path: failed_tests.txt + channel: ${{ secrets.SLACK_CHANNEL_ID }} + + - name: Remove OpenBB Folder + run: | + rm -rf /Users/openbb/Desktop/OpenBB\ Terminal + rm -rf ~/Desktop/OPENBB-exports + rm -rf extract/ diff --git a/build/pyinstaller/build4mac.sh b/build/pyinstaller/build4mac.sh index bb8ed69c1b4..5f6758be10f 100755 --- a/build/pyinstaller/build4mac.sh +++ b/build/pyinstaller/build4mac.sh @@ -1,6 +1,8 @@ #!/bin/bash DISK_IMAGE_NAME="OpenBB Terminal" +SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +BUNDLER_PATH="$SCRIPTPATH/macOS/build-macos.sh" # exit when any command fails set -e @@ -12,7 +14,7 @@ rm -rf build/terminal && rm -rf dist && rm -rf DMG rm -rf openbb_terminal/logs # Running build -pyinstaller build/pyinstaller/terminal.spec --clean +pyinstaller build/pyinstaller/terminal.spec # --clean # Assign icons to the built folder and launcher osascript build/pyinstaller/setup_icons.applescript @@ -23,41 +25,3 @@ mkdir DMG # Copy relevant artifacts to the packaging folder cp -r build/pyinstaller/macOS_package_assets/* DMG/ mv dist/OpenBBTerminal DMG/"$DISK_IMAGE_NAME"/.OpenBB - -osascript build/pyinstaller/setup_icons_post.applescript - -# Create a DMG with create-dmg -# -# NOTE: -# Code signing and notarization requires adding the following: -# -# --codesign "Common name of the Developer certificate" -# --format UDIF -# --notarize "Notarization identity " see: -# https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow - -if ! command -v create-dmg &> /dev/null -then - echo "create could not be found" - echo "install create-dmg from brew or github" - exit -fi - -create-dmg \ - --volname "OpenBB Terminal" \ - --volicon "images/dmg_volume.icns" \ - --background "images/openbb_dmg_background.png" \ - --icon "OpenBB Terminal" 190 250 \ - --window-pos 190 120 \ - --window-size 800 400 \ - --icon-size 100 \ - --text-size 14 \ - --app-drop-link 600 250 \ - --eula LICENSE \ - --format UDZO \ - --no-internet-enable \ - "OpenBB Terminal".dmg DMG - - -# Clean Up artifacts from this build -rm -rf build/terminal && rm -rf dist && rm -rf DMG diff --git a/build/pyinstaller/macOS/.gitignore b/build/pyinstaller/macOS/.gitignore new file mode 100644 index 00000000000..2f7896d1d13 --- /dev/null +++ b/build/pyinstaller/macOS/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/build/pyinstaller/macOS/build-macos.sh b/build/pyinstaller/macOS/build-macos.sh new file mode 100755 index 00000000000..2a29a422523 --- /dev/null +++ b/build/pyinstaller/macOS/build-macos.sh @@ -0,0 +1,215 @@ +#!/bin/bash + +#Parameters +SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +TARGET_DIRECTORY="$SCRIPTPATH/target" +BASE_DIRECTORY="$( cd -- "$(dirname "$1")" >/dev/null 2>&1 ; pwd -P )" +APP_DIRECTORY="$BASE_DIRECTORY/DMG/OpenBB Terminal" +BINARIES="$BASE_DIRECTORY/DMG/OpenBB\ Terminal/.OpenBB" +ENTITLEMENTS="$BASE_DIRECTORY/build/pyinstaller/entitlements.plist" +PRODUCT=${1} +VERSION=${2} +DATE=`date +%Y-%m-%d` +TIME=`date +%H:%M:%S` +LOG_PREFIX="[$DATE $TIME]" + + +function printUsage() { + echo -e "\033[1mUsage:\033[0m" + echo "$0 [APPLICATION_NAME] [APPLICATION_VERSION]" + echo + echo -e "\033[1mOptions:\033[0m" + echo " -h (--help)" + echo + echo -e "\033[1mExample::\033[0m" + echo "$0 openbbpro 0.0.1" + +} + +#Argument validation +if [ -z "$APPLE_DEVELOPER_CERTIFICATE_ID" ]; then + echo "APPLE_DEVELOPER_CERTIFICATE_ID environment variable is not set" + echo "Please run 'security find-identity -v', and then use the value for" + echo "the developer ID Installer (and NOT the Developer ID Application)" + exit 1 +fi +if [[ "$1" == "-h" || "$1" == "--help" ]]; then + printUsage + exit 1 +fi +if [ -z "$1" ]; then + echo "Please enter a valid application name for your application" + echo + printUsage + exit 1 +else + echo "Application Name : $1" +fi +if [[ "$2" =~ [0-9]+.[0-9]+.[0-9]+ ]]; then + echo "Application Version : $2" +else + echo "Please enter a valid version for your application (format [0-9].[0-9].[0-9])" + echo + printUsage + exit 1 +fi +if [ -z "$APPLE_SIGNING_IDENTITY" ]; then + echo "Please set the APPLE_SIGNING_IDENTITY environment variable" + exit 1 +fi + +#Functions +go_to_dir() { + pushd $1 >/dev/null 2>&1 +} + +log_info() { + echo "${LOG_PREFIX}[INFO]" $1 +} + +log_warn() { + echo "${LOG_PREFIX}[WARN]" $1 +} + +log_error() { + echo "${LOG_PREFIX}[ERROR]" $1 +} + +deleteInstallationDirectory() { + log_info "Cleaning $TARGET_DIRECTORY directory." + rm -rf "$TARGET_DIRECTORY" + + if [[ $? != 0 ]]; then + log_error "Failed to clean $TARGET_DIRECTORY directory" $? + exit 1 + fi +} + +signFiles() { + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*.so + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*/*.so + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*/*/*.so + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*/*/*/*.so + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*/*/*/*/*.so + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*/*/*/*/*/*.so + echo "Code Signing DYLIB Files" + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*/*/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*/*/*/*/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/pyarrow/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/prophet/.dylibs/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/scipy/.dylibs/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/xgboost/.dylibs/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/torch/.dylibs/*.dylib + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/sklearn/.dylibs/*.dylib + echo "Coce Signing LIB Files" + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/*.lib + echo "Code Signing Other Files" + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/prophet/stan_model/prophet_model.bin + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/diagnose + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/print + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/stanc + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/prophet/stan_model/cmdstan-2.26.1/bin/stansummary + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/pyarrow/plasma-store-server + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/torch/bin/protoc + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/torch/bin/protoc-3.13.0.0 + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/torch/bin/torch_shm_manager + echo "Code Sign OpenBB Executable File" + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/OpenBBTerminal + codesign --deep --force --verify --verbose --options runtime --entitlements "$ENTITLEMENTS" -s "$APPLE_SIGNING_IDENTITY" build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/OpenBBPlotsBackend +} + +createInstallationDirectory() { + if [ -d "${TARGET_DIRECTORY}" ]; then + deleteInstallationDirectory + fi + mkdir -pv "$TARGET_DIRECTORY" + + if [[ $? != 0 ]]; then + log_error "Failed to create $TARGET_DIRECTORY directory" $? + exit 1 + fi +} + +copyDarwinDirectory(){ + createInstallationDirectory + cp -r "$SCRIPTPATH/darwin" "${TARGET_DIRECTORY}/" + chmod -R 755 "${TARGET_DIRECTORY}/darwin/scripts" + chmod -R 755 "${TARGET_DIRECTORY}/darwin/Resources" + chmod 755 "${TARGET_DIRECTORY}/darwin/Distribution" +} + +# This creates the target/darwin folder which contains the contents for formatting the installer +# It also created the target/darkwinpkg folder which has the .app to install +copyBuildDirectory() { + sed -i '' -e 's/__VERSION__/'${VERSION}'/g' "${TARGET_DIRECTORY}/darwin/scripts/postinstall" + sed -i '' -e 's/__PRODUCT__/'${PRODUCT}'/g' "${TARGET_DIRECTORY}/darwin/scripts/postinstall" + chmod -R 755 "${TARGET_DIRECTORY}/darwin/scripts/postinstall" + + sed -i '' -e 's/__VERSION__/'${VERSION}'/g' "${TARGET_DIRECTORY}/darwin/Distribution" + sed -i '' -e 's/__PRODUCT__/'${PRODUCT}'/g' "${TARGET_DIRECTORY}/darwin/Distribution" + chmod -R 755 "${TARGET_DIRECTORY}/darwin/Distribution" + + sed -i '' -e 's/__VERSION__/'${VERSION}'/g' "${TARGET_DIRECTORY}"/darwin/Resources/*.html + sed -i '' -e 's/__PRODUCT__/'${PRODUCT}'/g' "${TARGET_DIRECTORY}"/darwin/Resources/*.html + chmod -R 755 "${TARGET_DIRECTORY}/darwin/Resources/" + + rm -rf "${TARGET_DIRECTORY}/darwinpkg" + mkdir -p "${TARGET_DIRECTORY}/darwinpkg" + + mkdir -p "${TARGET_DIRECTORY}"/darwinpkg/Applications + cp -a "${APP_DIRECTORY}" "${TARGET_DIRECTORY}"/darwinpkg/Applications + + rm -rf "${TARGET_DIRECTORY}/package" + mkdir -p "${TARGET_DIRECTORY}/package" + chmod -R 755 "${TARGET_DIRECTORY}/package" + + rm -rf "${TARGET_DIRECTORY}/pkg" + mkdir -p "${TARGET_DIRECTORY}/pkg" + chmod -R 755 "${TARGET_DIRECTORY}/pkg" +} + +# Creates the target/package folder. This includes a basic.pkg file with no formatting +function buildPackage() { + log_info "Application installer package building started.(1/3)" + # For now I removed the --identifier + pkgbuild --version "${VERSION}" \ + --scripts "${TARGET_DIRECTORY}/darwin/scripts" \ + --root "${TARGET_DIRECTORY}/darwinpkg" \ + --identifier "OpenBB Terminal" \ + --ownership preserve \ + "${TARGET_DIRECTORY}/package/${PRODUCT}.pkg" +} + +# Creates the target/pkg folder. This includes the finished pkg file to let users download +function buildProduct() { + log_info "Application installer product building started.(2/3)" + productbuild --distribution "${TARGET_DIRECTORY}/darwin/Distribution" \ + --resources "${TARGET_DIRECTORY}/darwin/Resources" \ + --package-path "${TARGET_DIRECTORY}/package" \ + --sign "${APPLE_DEVELOPER_CERTIFICATE_ID}" \ + "${TARGET_DIRECTORY}/pkg/$1" +} + +function createInstaller() { + log_info "Application installer generation process started.(3 Steps)" + buildPackage + chmod -R 754 "${TARGET_DIRECTORY}/darwinpkg" + buildProduct OpenBBTerminalM1.pkg + log_info "Application installer generation steps finished." +} + +#Main script +log_info "Installer generating process started." + +copyDarwinDirectory +copyBuildDirectory +signFiles +chmod 755 build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/.env +# chmod -R 755 build/pyinstaller/macOS/target/darwinpkg/Applications/OpenBB\ Terminal/.OpenBB/ +createInstaller + +log_info "Installer generating process finished" +exit 0 diff --git a/build/pyinstaller/macOS/darwin/Distribution b/build/pyinstaller/macOS/darwin/Distribution new file mode 100644 index 00000000000..9e328d8662c --- /dev/null +++ b/build/pyinstaller/macOS/darwin/Distribution @@ -0,0 +1,36 @@ + + + __PRODUCT__ + + + + + + + + + + + + + + __PRODUCT__.pkg + + __PRODUCT__.pkg + diff --git a/build/pyinstaller/macOS/darwin/Resources/LICENSE.txt b/build/pyinstaller/macOS/darwin/Resources/LICENSE.txt new file mode 100644 index 00000000000..b366787995e --- /dev/null +++ b/build/pyinstaller/macOS/darwin/Resources/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-2022 OpenBB Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/build/pyinstaller/macOS/darwin/Resources/background-light.png b/build/pyinstaller/macOS/darwin/Resources/background-light.png new file mode 100644 index 00000000000..b0635239ac2 Binary files /dev/null and b/build/pyinstaller/macOS/darwin/Resources/background-light.png differ diff --git a/build/pyinstaller/macOS/darwin/Resources/background.png b/build/pyinstaller/macOS/darwin/Resources/background.png new file mode 100644 index 00000000000..8cdbe927529 Binary files /dev/null and b/build/pyinstaller/macOS/darwin/Resources/background.png differ diff --git a/build/pyinstaller/macOS/darwin/Resources/banner.png b/build/pyinstaller/macOS/darwin/Resources/banner.png new file mode 100644 index 00000000000..3290b6063ea Binary files /dev/null and b/build/pyinstaller/macOS/darwin/Resources/banner.png differ diff --git a/build/pyinstaller/macOS/darwin/Resources/conclusion.html b/build/pyinstaller/macOS/darwin/Resources/conclusion.html new file mode 100644 index 00000000000..b6fc0e8b257 --- /dev/null +++ b/build/pyinstaller/macOS/darwin/Resources/conclusion.html @@ -0,0 +1,35 @@ + + + + + + + +
+

WSO2 API Manager

+

Thank you for installing WSO2 API MAnager.

+
Run API Manager
+

Open a new terminal and run the following command to get start with APIM server:

+   $ wso2am-2.6.0 [command] +
+
+
+
Resources
+

Go through following links for additional information.

+ +
+
+
+
Uninstall WSO2 API Manager
+

Run the following command to uninstall WSO2 API Manager.
+
  $ sudo bash /Library/__PRODUCT__/__VERSION__/uninstall.sh
+

+
+

+

Copyright © 2019 WSO2 Inc. All rights reserved. API Manager and its use subject to a license agreement and are also subject to copyright, trademark patent and/or other laws.

+
+ + diff --git a/build/pyinstaller/macOS/darwin/Resources/uninstall.sh b/build/pyinstaller/macOS/darwin/Resources/uninstall.sh new file mode 100644 index 00000000000..27873ddf9f7 --- /dev/null +++ b/build/pyinstaller/macOS/darwin/Resources/uninstall.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +#Generate application uninstallers for macOS. + +#Parameters +DATE=`date +%Y-%m-%d` +TIME=`date +%H:%M:%S` +LOG_PREFIX="[$DATE $TIME]" + +#Functions +log_info() { + echo "${LOG_PREFIX}[INFO]" $1 +} + +log_warn() { + echo "${LOG_PREFIX}[WARN]" $1 +} + +log_error() { + echo "${LOG_PREFIX}[ERROR]" $1 +} + +#Check running user +if (( $EUID != 0 )); then + echo "Please run as root." + exit +fi + +echo "Welcome to Application Uninstaller" +echo "The following packages will be REMOVED:" +echo " __PRODUCT__-__VERSION__" +while true; do + read -p "Do you wish to continue [Y/n]?" answer + [[ $answer == "y" || $answer == "Y" || $answer == "" ]] && break + [[ $answer == "n" || $answer == "N" ]] && exit 0 + echo "Please answer with 'y' or 'n'" +done + + +#Need to replace these with install preparation script +VERSION=__VERSION__ +PRODUCT=__PRODUCT__ + +echo "Application uninstalling process started" +# remove link to shorcut file +find "/usr/local/bin/" -name "__PRODUCT__-__VERSION__" | xargs rm +if [ $? -eq 0 ] +then + echo "[1/3] [DONE] Successfully deleted shortcut links" +else + echo "[1/3] [ERROR] Could not delete shortcut links" >&2 +fi + +#forget from pkgutil +pkgutil --forget "org.$PRODUCT.$VERSION" > /dev/null 2>&1 +if [ $? -eq 0 ] +then + echo "[2/3] [DONE] Successfully deleted application informations" +else + echo "[2/3] [ERROR] Could not delete application informations" >&2 +fi + +#remove application source distribution +[ -e "/Library/${PRODUCT}/${VERSION}" ] && rm -rf "/Library/${PRODUCT}/${VERSION}" +if [ $? -eq 0 ] +then + echo "[3/3] [DONE] Successfully deleted application" +else + echo "[3/3] [ERROR] Could not delete application" >&2 +fi + +echo "Application uninstall process finished" +exit 0 diff --git a/build/pyinstaller/macOS/darwin/Resources/welcome.html b/build/pyinstaller/macOS/darwin/Resources/welcome.html new file mode 100644 index 00000000000..393d21d1799 --- /dev/null +++ b/build/pyinstaller/macOS/darwin/Resources/welcome.html @@ -0,0 +1,14 @@ + + + + + + +
+
+

OpenBB is a leading open source investment research software platform for accessing and analyzing financial market data. We represent millions of investors who want to leverage state-of-the-art data science and machine learning technologies to make sense of raw unrefined data. Our mission is to make investment research effective, powerful and accessible to everyone.

+

This installation procedure will install the OpenBB Terminal.

+

+
+ + diff --git a/build/pyinstaller/macOS/darwin/scripts/postinstall b/build/pyinstaller/macOS/darwin/scripts/postinstall new file mode 100644 index 00000000000..8c3cbfc39d9 --- /dev/null +++ b/build/pyinstaller/macOS/darwin/scripts/postinstall @@ -0,0 +1,3 @@ +#!/bin/bash + +exit 0 diff --git a/build/pyinstaller/macOS_package_assets/OpenBB Terminal/OpenBB Terminal b/build/pyinstaller/macOS_package_assets/OpenBB Terminal/OpenBB Terminal index 5503832bff9..bef482647c6 100755 --- a/build/pyinstaller/macOS_package_assets/OpenBB Terminal/OpenBB Terminal +++ b/build/pyinstaller/macOS_package_assets/OpenBB Terminal/OpenBB Terminal @@ -1,14 +1,13 @@ #!/bin/bash -clear + +echo "1" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -xattr -r -d com.apple.quarantine "$SCRIPTDIR"/.OpenBB - echo " _ _ _ " echo " | | | (_) " echo " | | ___ __ _ __| |_ _ __ __ _ " -echo " | | / _ \ / _\` |/ _\` | | '_ \ / _\` | " +echo " | | / _ \ / _\` |/ _\` | | '_ \ / _\` | " echo " | |___| (_) | (_| | (_| | | | | | (_| |_ _ _ " echo " |______\___/ \__,_|\__,_|_|_| |_|\__, (_|_|_)" echo " __/ | "