From 872662dc826bba7d007ccc7017e2234760026be0 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 08:18:49 +0100 Subject: [PATCH 01/29] testing gitflow --- .github/workflows/linting.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index bba6d0a68342..34c2369ae808 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -10,8 +10,8 @@ env: on: push: branches: - - 'feature/*' - - 'hotfix/*' + - "feature/*" + - "hotfix/*" - 'release/[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?' # Cancel previous runs that are not yet completed. @@ -39,8 +39,9 @@ jobs: key: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }} restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }} - - run: pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff - - run: pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six + - run: | + pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff + pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six - run: bandit -x ./tests -r . || true - run: black --diff --check . - run: codespell --ignore-words-list=commun,statics,ro,zar,zlot,jewl,ba,buil,coo,ether,hist,hsi,mape,navagation,operatio,pres,ser,yeld,shold,ist,varian,datas,ake,creat,vie,hel,ket,toke,certi,buidl,ot,te --quiet-level=2 --skip=./tests,.git,*.css,*.csv,*.html,*.ini,*.ipynb,*.js,*.json,*.lock,*.scss,*.txt,*.yaml,./build/pyinstaller,./website/config.toml @@ -52,12 +53,12 @@ jobs: pylint terminal.py openbb_terminal tests markdown-link-check: - name: Markdown Linting - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - name: Check out the code - - name: Lint Code Base - uses: docker://avtodev/markdown-lint:v1 - with: - args: "./*.md ./changelogs/*.md ./openbb_terminal/**/*.md ./discordbot/**/*.md" \ No newline at end of file + name: Markdown Linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + name: Check out the code + - name: Lint Code Base + uses: docker://avtodev/markdown-lint:v1 + with: + args: "./*.md ./changelogs/*.md ./openbb_terminal/**/*.md ./discordbot/**/*.md" From e9475703ab27554a55ddd6a3abfc67b04a575437 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 08:25:05 +0100 Subject: [PATCH 02/29] Name changes --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 34c2369ae808..23870d226d15 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -21,7 +21,7 @@ concurrency: jobs: code-linting: - name: Running General Linting Tools + name: General Code Linting runs-on: ubuntu-latest steps: - name: Checkout Code From 59f69c02f963f67f3c43367216a3e38ab3da9658 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 08:42:23 +0100 Subject: [PATCH 03/29] Testing python changes --- tests/test_helpers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 7820199cf709..dbfc099b9344 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,6 +1,5 @@ import pandas as pd - def no_dfs(args: list, kwargs: dict) -> bool: """Returns false if there are in dataframe objects given""" for item in args: From 4f8bde5e4c6558846056a2a506fa9d2c1f250151 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 08:55:18 +0100 Subject: [PATCH 04/29] Added Checkout to Base test --- .github/workflows/unit-test.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index d58a70199dab..5e3e04193554 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -14,7 +14,6 @@ on: - main types: [opened, synchronize] - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -45,7 +44,6 @@ jobs: echo "python-changes=false" >> $GITHUB_OUTPUT fi - - name: Show Output result for python-changes run: | echo "python-changes=${{ steps.python-changes.outputs.python-changes }}" @@ -56,8 +54,8 @@ jobs: runs-on: ubuntu-latest if: needs.python-changes.outputs.python-changes == 'true' steps: - - name: Show Output result for python-changes - run: echo "python-changes=${{ needs.python-changes.outputs.python-changes }}" + - name: Checkout Code + uses: actions/checkout@v3 - name: Setup Python 3.9 uses: actions/setup-python@v4 @@ -153,7 +151,7 @@ jobs: run: | source $VENV python terminal.py - + full-test: name: Full Test Suite - (${{ matrix.python-version }}, ${{ matrix.os }}) needs: [base-test] @@ -317,4 +315,4 @@ jobs: - name: Start Terminal and exit shell: bash -l {0} - run: python terminal.py \ No newline at end of file + run: python terminal.py From 913d4201fcbb28da670faa4673f266ebcbf26a67 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 11:09:47 +0100 Subject: [PATCH 05/29] More minor fixes for merge --- .github/workflows/test.yml | 1 + .github/workflows/unit-test.yml | 4 ++++ tests/test_helpers.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d6b387d10f85..13db6ba0dabd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,7 @@ env: OPENBB_USE_ION: false OPENBB_USE_PROMPT_TOOLKIT: false PIP_DEFAULT_TIMEOUT: 100 + on: [workflow_dispatch] jobs: diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 5e3e04193554..619b162764ee 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -13,6 +13,10 @@ on: - develop - main types: [opened, synchronize] + push: + branches: + - develop + - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/tests/test_helpers.py b/tests/test_helpers.py index dbfc099b9344..5ceecf9070e0 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -8,4 +8,4 @@ def no_dfs(args: list, kwargs: dict) -> bool: for item in kwargs.values(): if isinstance(item, pd.DataFrame): return False - return True + return True \ No newline at end of file From fcda8da8a2301d6105d9ae7824cb0ee4c0655c29 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 11:13:06 +0100 Subject: [PATCH 06/29] Minor fix --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 619b162764ee..48514e180122 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -101,7 +101,7 @@ jobs: name: Vanilla Python Tests - ${{ matrix.python-version }} needs: [python-changes, base-test] runs-on: ${{ matrix.os }} - if: needs.python-changes.outputs.python-changes == 'true' && github.event.pull_request.base.ref == 'develop' + if: needs.python-changes.outputs.python-changes == 'true' && github.event.pull_request.base.ref == 'develop' && github.event.pull_request.merged != true strategy: fail-fast: true matrix: From 31b9184df1834c2d71680632b7fe2bd247909621 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 13:17:02 +0100 Subject: [PATCH 07/29] Added nightly build --- .github/workflows/nightly-build.yml | 95 +++++++++++++++++++++++++++++ gitflow.py | 1 + 2 files changed, 96 insertions(+) create mode 100644 .github/workflows/nightly-build.yml create mode 100644 gitflow.py diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml new file mode 100644 index 000000000000..44d699d90f40 --- /dev/null +++ b/.github/workflows/nightly-build.yml @@ -0,0 +1,95 @@ +name: Nightly Build + +env: + OPENBB_ENABLE_QUICK_EXIT: true + OPENBB_LOG_COLLECT: false + OPENBB_USE_ION: false + OPENBB_USE_PROMPT_TOOLKIT: false + PIP_DEFAULT_TIMEOUT: 100 + PYTHONNOUSERSITE: 1 + +on: + schedule: + - cron: "0 0 * * *" + push: + branches: + - develop + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + Windows-Build: + name: Windows10 Build + runs-on: [self-hosted, Windows, x64] + # Configuring ------------- + steps: + - name: Setup Windows Git Configuration # This is under the assumption that git is already installed on the system + run: | + Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1 + git config --system core.longpaths true + - name: Checkout + uses: actions/checkout@v2.4.2 + - name: Activate Base & Create OpenBB Environment + run: | + conda activate base + conda env create -n obb --file build/conda/conda-3-9-env-full.yaml + conda init + conda activate obb + conda env list + - name: Poetry Install + # Conda activate needs to be run every time because of the way that the workflow steps work + # on powershell where it creates a new shell every time for every step + run: | + conda activate obb + poetry install + - name: Poetry Install Portfolio Optimization and Forecasting Toolkits + run: | + conda activate obb + poetry install -E all + - name: Poetry Install Installer + run: | + conda activate obb + poetry install -E installer + - name: Install Specific Papermill + run: | + conda activate obb + pip uninstall papermill -y + pip install git+https://github.com/nteract/papermill.git@main + # Building ------------ + - name: Build Terminal.spec file + run: | + conda activate obb + pyinstaller build/pyinstaller/terminal.spec --clean + - name: Move Files into App Folder + run: cp -r .\dist\OpenBBTerminal\ .\build\nsis\app\ + # don't need this because log collection is turned off + # - name: Remove Log Data + # run: Remove-Item .\build\nsis\app\openbb_terminal\logs\ -Recurse + - name: Build Exe File + run: | + conda activate obb + C:\'.\Program Files (x86)\'\nsis\makensis.exe .\build\nsis\setup.nsi + - name: Save Build Artifact + uses: actions/upload-artifact@v3 + with: + name: Windows EXE Artifact + path: '.\build\nsis\OpenBB Terminal Setup.exe' + - name: Run Integration Tests + run: | + dist\OpenBBTerminal\OpenBBTerminal.exe C:\Users\Administrator\actions-runner\_work\OpenBBTerminal\OpenBBTerminal\openbb_terminal\miscellaneous\scripts -t + # Cleaning ------------------------ + # Make sure to add Remove-Item C:\Users\Administrator\Desktop\OPENBB-exports -Recurse whenever integration tests get fixed + - name: Remove Previous Build + run: | + Remove-Item '.\build\nsis\OpenBB Terminal Setup.exe' -Recurse + Remove-Item .\build\nsis\app\ -Recurse + Remove-Item .\dist\ -Recurse + Remove-Item .\build\terminal\ -Recurse + - name: Deactivate & Remove Conda Environment + run: | + conda deactivate obb + conda deactivate base + conda env remove -n obb + Remove-Item C:\Users\Administrator\miniconda3\envs\obb\ -Recurse diff --git a/gitflow.py b/gitflow.py new file mode 100644 index 000000000000..7df869a15e76 --- /dev/null +++ b/gitflow.py @@ -0,0 +1 @@ +print("Hello, World!") From 8d4e3d60e154337658b9ebd62b1310bff64d7aa4 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 14:32:03 +0100 Subject: [PATCH 08/29] Testing Merge --- .github/workflows/unit-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 48514e180122..c666d4e797a2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -158,7 +158,6 @@ jobs: full-test: name: Full Test Suite - (${{ matrix.python-version }}, ${{ matrix.os }}) - needs: [base-test] runs-on: ${{ matrix.os }} if: github.event.pull_request.merged == true strategy: @@ -217,7 +216,6 @@ jobs: tests-conda: name: Anaconda Python Tests - (${{ matrix.python-version }}, ${{ matrix.os }}) - needs: [base-test] runs-on: ${{ matrix.os }}-latest if: github.event.pull_request.merged == true strategy: From f899d6d11cce68e1b5c5e0fa99c4e14d746f798c Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 20:37:06 +0100 Subject: [PATCH 09/29] Merge error fix --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c666d4e797a2..6b42fdad45fc 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -12,7 +12,7 @@ on: branches: - develop - main - types: [opened, synchronize] + types: [opened, synchronize, closed] push: branches: - develop From 9bce0f243d6b6d6504ed7e0b2b622f33527bd6bb Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Mon, 9 Jan 2023 21:10:45 +0100 Subject: [PATCH 10/29] Merge fix --- .github/workflows/unit-test.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 6b42fdad45fc..b65593090bdc 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,4 +1,5 @@ name: Unit Test +# Description: This workflow runs unit tests on the OpenBB codebase for all supported Python versions and OSes. It is triggered on pull requests to the develop branch and when a pull request is merged to the main or develop branch. env: OPENBB_ENABLE_QUICK_EXIT: true @@ -7,16 +8,13 @@ env: OPENBB_USE_PROMPT_TOOLKIT: false PIP_DEFAULT_TIMEOUT: 100 +# It is triggered on pull requests is created or updated to the develop or main branch and when a pull request is merged to the main or develop branch. on: pull_request: branches: - develop - main - types: [opened, synchronize, closed] - push: - branches: - - develop - - main + types: [opened, synchronize, reopened, closed] concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 3402c0336c94524d3320b4b0c9fd236b3a910060 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 10:30:08 +0100 Subject: [PATCH 11/29] merge fix --- .github/workflows/unit-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index b65593090bdc..68c3d318827d 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,5 +1,4 @@ name: Unit Test -# Description: This workflow runs unit tests on the OpenBB codebase for all supported Python versions and OSes. It is triggered on pull requests to the develop branch and when a pull request is merged to the main or develop branch. env: OPENBB_ENABLE_QUICK_EXIT: true @@ -8,7 +7,6 @@ env: OPENBB_USE_PROMPT_TOOLKIT: false PIP_DEFAULT_TIMEOUT: 100 -# It is triggered on pull requests is created or updated to the develop or main branch and when a pull request is merged to the main or develop branch. on: pull_request: branches: @@ -25,6 +23,7 @@ jobs: python-changes: name: Check for changes to Python code runs-on: ubuntu-latest + if: github.event.pull_request.merged != true outputs: python-changes: ${{ steps.python-changes.outputs.python-changes }} steps: From 3a925053d8fb7f3cc1d0f5be11fc40a579852ad1 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 11:13:34 +0100 Subject: [PATCH 12/29] Merge fix --- .github/workflows/unit-test.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 68c3d318827d..bb489b8393d2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -27,9 +27,18 @@ jobs: outputs: python-changes: ${{ steps.python-changes.outputs.python-changes }} steps: - - name: Checkout Code - uses: actions/checkout@v1 - + - name: Checkout + uses: actions/checkout@v3 + with: + # Need to fetch more than the last commit so that setuptools-scm can + # create the correct version string. If the number of commits since + # the last release is greater than this, the version still be wrong. + # Increase if necessary. + fetch-depth: 100 + # The GitHub token is preserved by default but this job doesn't need + # to be able to push to GitHub. + persist-credentials: false + # Check for changes to Python code to avoid running tests unnecessarily - name: Check for changes to Python code id: python-changes @@ -39,7 +48,7 @@ jobs: target_branch=$(jq -r .pull_request.base.ref "$GITHUB_EVENT_PATH") # Check for changes to Python code to avoid running tests unnecessarily - if git diff --name-only origin/$target_branch HEAD | grep -E '\.py$'; then + if git diff --name-only origin/$target_branch HEAD | grep -E "\.py$""; then echo "python-changes=true" >> $GITHUB_OUTPUT else echo "python-changes=false" >> $GITHUB_OUTPUT From 8be596c108f3f031fb2e81a6a3a816547780c068 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 11:15:03 +0100 Subject: [PATCH 13/29] Merge fix --- .github/workflows/unit-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index bb489b8393d2..a3b46a7efa39 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -38,7 +38,7 @@ jobs: # The GitHub token is preserved by default but this job doesn't need # to be able to push to GitHub. persist-credentials: false - + # Check for changes to Python code to avoid running tests unnecessarily - name: Check for changes to Python code id: python-changes @@ -48,7 +48,7 @@ jobs: target_branch=$(jq -r .pull_request.base.ref "$GITHUB_EVENT_PATH") # Check for changes to Python code to avoid running tests unnecessarily - if git diff --name-only origin/$target_branch HEAD | grep -E "\.py$""; then + if git diff --name-only origin/$target_branch HEAD | grep -E "\.py$"; then echo "python-changes=true" >> $GITHUB_OUTPUT else echo "python-changes=false" >> $GITHUB_OUTPUT From d896d22dfa1cc06b641d9b0f7519e000e6bcb3b7 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 11:17:15 +0100 Subject: [PATCH 14/29] Merge fix --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index a3b46a7efa39..dfdb73513102 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -28,7 +28,7 @@ jobs: python-changes: ${{ steps.python-changes.outputs.python-changes }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v1 with: # Need to fetch more than the last commit so that setuptools-scm can # create the correct version string. If the number of commits since From 801d3bf308661d418de8ef448af22361e7ae8e81 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 11:20:04 +0100 Subject: [PATCH 15/29] merge fix --- gitflow.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gitflow.py b/gitflow.py index 7df869a15e76..922fe1f0de90 100644 --- a/gitflow.py +++ b/gitflow.py @@ -1 +1,4 @@ print("Hello, World!") + +# print another +print("Hello, World!") \ No newline at end of file From 74cd295cdba916e4bc8ccb425f76e2be436c73f6 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 11:46:00 +0100 Subject: [PATCH 16/29] [Gitflow] - Minor fix --- .github/workflows/nightly-build.yml | 8 +++----- .github/workflows/unit-test.yml | 5 ----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 44d699d90f40..c673750478d1 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -9,11 +9,9 @@ env: PYTHONNOUSERSITE: 1 on: - schedule: - - cron: "0 0 * * *" - push: - branches: - - develop + workflow_dispatch: + # schedule: + # - cron: "0 0 * * *" concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index dfdb73513102..a84083099ef7 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -23,17 +23,12 @@ jobs: python-changes: name: Check for changes to Python code runs-on: ubuntu-latest - if: github.event.pull_request.merged != true outputs: python-changes: ${{ steps.python-changes.outputs.python-changes }} steps: - name: Checkout uses: actions/checkout@v1 with: - # Need to fetch more than the last commit so that setuptools-scm can - # create the correct version string. If the number of commits since - # the last release is greater than this, the version still be wrong. - # Increase if necessary. fetch-depth: 100 # The GitHub token is preserved by default but this job doesn't need # to be able to push to GitHub. From 3d1eb29c725bd5d07d8e41491f5fabd6d1703527 Mon Sep 17 00:00:00 2001 From: Luqman Date: Tue, 10 Jan 2023 11:50:45 +0100 Subject: [PATCH 17/29] Feature/gitflow (#3914) (#3915) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * [Gitflow] - Minor fix From a033914458d3cee2baa1468ba38712a7c200d075 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 15:53:17 +0100 Subject: [PATCH 18/29] Nightly build feature --- .github/workflows/nightly-build.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index c673750478d1..49c3913a44d8 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -1,4 +1,4 @@ -name: Nightly Build +name: Nightly Build on the develop branch env: OPENBB_ENABLE_QUICK_EXIT: true @@ -9,9 +9,8 @@ env: PYTHONNOUSERSITE: 1 on: - workflow_dispatch: - # schedule: - # - cron: "0 0 * * *" + schedule: + - cron: "0 0 * * *" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -27,8 +26,12 @@ jobs: run: | Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1 git config --system core.longpaths true + - name: Checkout uses: actions/checkout@v2.4.2 + with: + ref: develop + - name: Activate Base & Create OpenBB Environment run: | conda activate base From 1f05d9011a5eff9232ada8713cd796619d710f6a Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 16:47:52 +0100 Subject: [PATCH 19/29] Added branch name docs --- CONTRIBUTING.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bf1094ee3429..ff30966ee2a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1529,6 +1529,14 @@ Network model. these get linked. Note: If you installed pre-commit hooks and one of the formatters re-formats your code, you'll need to go back to step 3 to add these. +### Branch Naming Conventions +The accepted branch naming conventions are: + +- `feature/feature-name` +- `hotfix/hotfix-name` +- `release/2.1.0` or `release/2.1.0rc0`. + +All `feature/feature-name` related branches can only have PRs pointing to `develop` branch. `hotfix/hotfix-name` and `release/2.1.0` or `release/2.1.0rc0` branches can only have PRs pointing to `main` branch. ## Add a Test Unit tests minimize errors in code and quickly find errors when they do arise. Integration tests are standard usage examples, which are also used to identify errors. From a64233409fbde15f86f5b48282136403a54bdb36 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 18:19:20 +0100 Subject: [PATCH 20/29] Auto doc adjustment --- .github/workflows/gh-pages.yml | 5 ++++- .github/workflows/unit-test.yml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index ff320231b5fc..7c9f0cf2da46 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,13 +1,16 @@ name: Deploy to GitHub Pages on: - push: + pull_request: branches: - main + types: [closed] + jobs: generate: name: Generate and Deploy documentation + if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - name: Git checkout diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c597d7d9798c..739e8de0a292 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -92,7 +92,7 @@ jobs: MPLBACKEND: Agg run: | source $VENV - pytest tests/ --optimization + pytest tests/ --optimization --autodoc - name: Start Terminal and exit run: | From 16b5bb6374e58f826fe29faa6822ff335a36cb5c Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 18:27:03 +0100 Subject: [PATCH 21/29] Fix markdown --- CONTRIBUTING.md | 1 + gitflow.py | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 gitflow.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff30966ee2a0..0324ff1104f1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1537,6 +1537,7 @@ The accepted branch naming conventions are: - `release/2.1.0` or `release/2.1.0rc0`. All `feature/feature-name` related branches can only have PRs pointing to `develop` branch. `hotfix/hotfix-name` and `release/2.1.0` or `release/2.1.0rc0` branches can only have PRs pointing to `main` branch. + ## Add a Test Unit tests minimize errors in code and quickly find errors when they do arise. Integration tests are standard usage examples, which are also used to identify errors. diff --git a/gitflow.py b/gitflow.py deleted file mode 100644 index 922fe1f0de90..000000000000 --- a/gitflow.py +++ /dev/null @@ -1,4 +0,0 @@ -print("Hello, World!") - -# print another -print("Hello, World!") \ No newline at end of file From 206e5688e60f659ecbcd9ad5f56ed74a4baffae4 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 18:28:40 +0100 Subject: [PATCH 22/29] Markdown fix --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0324ff1104f1..2bbddda24a9b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1530,6 +1530,7 @@ Network model. to go back to step 3 to add these. ### Branch Naming Conventions + The accepted branch naming conventions are: - `feature/feature-name` From f6836c783f3bf9126318e9df8a0d79d5a619ee11 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 18:30:16 +0100 Subject: [PATCH 23/29] markdown fix --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2bbddda24a9b..7521b1b93f1b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1533,9 +1533,9 @@ Network model. The accepted branch naming conventions are: -- `feature/feature-name` -- `hotfix/hotfix-name` -- `release/2.1.0` or `release/2.1.0rc0`. +- `feature/feature-name` +- `hotfix/hotfix-name` +- `release/2.1.0` or `release/2.1.0rc0`. All `feature/feature-name` related branches can only have PRs pointing to `develop` branch. `hotfix/hotfix-name` and `release/2.1.0` or `release/2.1.0rc0` branches can only have PRs pointing to `main` branch. From 7626709bfb42e4159e760c3211319f139d54652d Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Tue, 10 Jan 2023 20:42:37 +0100 Subject: [PATCH 24/29] code linting error fix --- tests/test_helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 5ceecf9070e0..655093c4bf7d 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -8,4 +8,5 @@ def no_dfs(args: list, kwargs: dict) -> bool: for item in kwargs.values(): if isinstance(item, pd.DataFrame): return False - return True \ No newline at end of file + return True + \ No newline at end of file From 6f42b3a314dae1170dd9cce4568ee85446c2598e Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Wed, 11 Jan 2023 15:38:25 +0100 Subject: [PATCH 25/29] fix linting test issue --- tests/test_helpers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 655093c4bf7d..dbfc099b9344 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -9,4 +9,3 @@ def no_dfs(args: list, kwargs: dict) -> bool: if isinstance(item, pd.DataFrame): return False return True - \ No newline at end of file From 24ad589c255859d3a6c51a967da913bfcd78d0d8 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Wed, 11 Jan 2023 15:54:16 +0100 Subject: [PATCH 26/29] Fixed linting check --- tests/test_helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index dbfc099b9344..7820199cf709 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,5 +1,6 @@ import pandas as pd + def no_dfs(args: list, kwargs: dict) -> bool: """Returns false if there are in dataframe objects given""" for item in args: From d53aafb5f8aeaaf6b2b722706b5e975ace4f716f Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Wed, 11 Jan 2023 16:06:05 +0100 Subject: [PATCH 27/29] linting fix --- .github/workflows/linting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 23870d226d15..b3a37713654e 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -10,8 +10,8 @@ env: on: push: branches: - - "feature/*" - - "hotfix/*" + - 'feature/*' + - 'hotfix/*' - 'release/[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?' # Cancel previous runs that are not yet completed. From 32aee17c276622f195b387d3e918a14373f8beb6 Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Wed, 11 Jan 2023 16:11:41 +0100 Subject: [PATCH 28/29] ruff version fix --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index b3a37713654e..2357cc8fc89e 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -40,7 +40,7 @@ jobs: restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }} - run: | - pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff + pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff==0.0.212 pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six - run: bandit -x ./tests -r . || true - run: black --diff --check . From 8e404fca8eedb31798542161e530385e209c0b5d Mon Sep 17 00:00:00 2001 From: "luqazino@gmail.com" Date: Fri, 13 Jan 2023 14:37:53 +0100 Subject: [PATCH 29/29] Check for changes in opebb_terminal --- .github/workflows/branch-name-check.yml | 5 ++- .github/workflows/unit-test.yml | 47 +++++++++++++++++++------ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/.github/workflows/branch-name-check.yml b/.github/workflows/branch-name-check.yml index fcefb2387909..9a0f5f364abb 100644 --- a/.github/workflows/branch-name-check.yml +++ b/.github/workflows/branch-name-check.yml @@ -1,12 +1,11 @@ name: Branch Name Check -# Description: Checks that the source branch name is valid for the target branch. This is used to ensure that PRs are only allowed to merge into the develop branch if they are from a feature, hotfix or release branch. Similarly, PRs are only allowed to merge into the main branch if they are from a hotfix or release branch. on: pull_request: branches: - develop - main - types: [opened, synchronize] + types: [opened, edited] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -25,7 +24,7 @@ jobs: run: | source_branch=$(jq -r .pull_request.head.ref "$GITHUB_EVENT_PATH") target_branch=$(jq -r .pull_request.base.ref "$GITHUB_EVENT_PATH") - + echo "Source-branch=$source_branch" >> $GITHUB_OUTPUT echo "target-branch=$target_branch" >> $GITHUB_OUTPUT diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 739e8de0a292..eca182bbca06 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -12,20 +12,21 @@ on: branches: - develop - main - types: [opened, synchronize, reopened, closed] + types: [opened, synchronize, edited, closed] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - # Check for changes to Python code - python-changes: - name: Check for changes to Python code + check-files-changed: + name: Check for changes to python files and the openbb_terminal folder runs-on: ubuntu-latest if: github.event.pull_request.merged != true outputs: python-changes: ${{ steps.python-changes.outputs.python-changes }} + folder-changes: ${{ steps.folder-changes.outputs.folder-changes }} + check-changes: ${{ steps.check-changes.outputs.check-changes }} steps: - name: Checkout uses: actions/checkout@v1 @@ -35,8 +36,8 @@ jobs: # to be able to push to GitHub. persist-credentials: false - # Check for changes to Python code to avoid running tests unnecessarily - - name: Check for changes to Python code + # Check for changes to Python files to avoid running tests unnecessarily + - name: python file check id: python-changes run: | # Extract the source and target branches for the PR @@ -50,15 +51,40 @@ jobs: echo "python-changes=false" >> $GITHUB_OUTPUT fi + # Check for changes to the openbb_terminal folder to avoid running tests unnecessarily + - name: Check for changes to the openbb_terminal folder + id: folder-changes + run: | + source_branch=$(jq -r .pull_request.head.ref "$GITHUB_EVENT_PATH") + target_branch=$(jq -r .pull_request.base.ref "$GITHUB_EVENT_PATH") + + if git diff --name-only origin/$target_branch HEAD | grep -E "openbb_terminal\/.*"; then + echo "folder-changes=true" >> $GITHUB_OUTPUT + else + echo "folder-changes=false" >> $GITHUB_OUTPUT + fi + + # combine the two checks into one + - name: Check for changes to python files or the openbb_terminal folder + id: check-changes + run: | + if [ ${{ steps.python-changes.outputs.python-changes }} == 'true' ] || [ ${{ steps.folder-changes.outputs.folder-changes }} == 'true' ]; then + echo "check-changes=true" >> $GITHUB_OUTPUT + else + echo "check-changes=false" >> $GITHUB_OUTPUT + fi + - name: Show Output result for python-changes run: | echo "python-changes=${{ steps.python-changes.outputs.python-changes }}" + echo "folder-changes=${{ steps.folder-changes.outputs.folder-changes }}" + echo "check-changes=${{ steps.check-changes.outputs.check-changes }}" base-test: name: Base Tests - Ubuntu-latest - Python 3.9 - needs: [python-changes] + needs: [check-files-changed] runs-on: ubuntu-latest - if: needs.python-changes.outputs.python-changes == 'true' + if: needs.check-files-changed.outputs.check-changes == 'true' && github.event.pull_request.base.ref == 'develop' steps: - name: Checkout Code uses: actions/checkout@v3 @@ -101,9 +127,8 @@ jobs: tests-python: name: Vanilla Python Tests - ${{ matrix.python-version }} - needs: [python-changes, base-test] + needs: [check-files-changed, base-test] runs-on: ${{ matrix.os }} - if: needs.python-changes.outputs.python-changes == 'true' && github.event.pull_request.base.ref == 'develop' && github.event.pull_request.merged != true strategy: fail-fast: true matrix: @@ -209,7 +234,7 @@ jobs: MPLBACKEND: Agg run: | source $VENV - pytest tests/ --optimization + pytest tests/ --optimization --autodoc - name: Start Terminal and exit run: |