From 0694c805628c168071542d785dc5004df3335d88 Mon Sep 17 00:00:00 2001 From: Luqman Date: Mon, 16 Jan 2023 15:25:38 +0100 Subject: [PATCH 1/3] Minor Fix for branch name check (#3979) --- .github/workflows/branch-name-check.yml | 2 +- .github/workflows/unit-test.yml | 47 ++++++------------------- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/.github/workflows/branch-name-check.yml b/.github/workflows/branch-name-check.yml index 9a0f5f364ab..87ac7fdd36a 100644 --- a/.github/workflows/branch-name-check.yml +++ b/.github/workflows/branch-name-check.yml @@ -5,7 +5,7 @@ on: branches: - develop - main - types: [opened, edited] + types: [opened, synchronize, edited] concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index eca182bbca0..08ab8472086 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -20,12 +20,10 @@ concurrency: jobs: check-files-changed: - name: Check for changes to python files and the openbb_terminal folder + name: Check for changes 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 @@ -36,48 +34,23 @@ jobs: # to be able to push to GitHub. persist-credentials: false - # 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 - source_branch=$(jq -r .pull_request.head.ref "$GITHUB_EVENT_PATH") - 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 - echo "python-changes=true" >> $GITHUB_OUTPUT - else - 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 + # Check for changes to python files, lockfiles and the openbb_terminal folder + - name: Check for changes to files to trigger unit test id: check-changes run: | - if [ ${{ steps.python-changes.outputs.python-changes }} == 'true' ] || [ ${{ steps.folder-changes.outputs.folder-changes }} == 'true' ]; then + 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 ".py$|openbb_terminal\/.*|pyproject.toml|poetry.lock|requirements.txt|requirements-full.txt"; then echo "check-changes=true" >> $GITHUB_OUTPUT else echo "check-changes=false" >> $GITHUB_OUTPUT fi - - name: Show Output result for python-changes + - name: Show output of previous step run: | - echo "python-changes=${{ steps.python-changes.outputs.python-changes }}" - echo "folder-changes=${{ steps.folder-changes.outputs.folder-changes }}" + # 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: From 0b9af50b6d8025c38ca527ab2472da22af45f6b7 Mon Sep 17 00:00:00 2001 From: Luqman Date: Mon, 16 Jan 2023 16:21:28 +0100 Subject: [PATCH 2/3] Gitflow - Added manual trigger to Linting (#3981) * Minor Fix for branch name check * added manual trigger to linting --- .github/workflows/linting.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 2357cc8fc89..4cdcda486a0 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -13,6 +13,7 @@ on: - 'feature/*' - 'hotfix/*' - 'release/[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?' + workflow_dispatch: # Cancel previous runs that are not yet completed. concurrency: From d7457dee4947d10071d4a243ed7bead231b116ba Mon Sep 17 00:00:00 2001 From: Luqman Date: Mon, 16 Jan 2023 16:53:43 +0100 Subject: [PATCH 3/3] Linting fix (#3984) Linting fix --- .github/workflows/branch-name-check.yml | 1 - .github/workflows/linting.yml | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branch-name-check.yml b/.github/workflows/branch-name-check.yml index 87ac7fdd36a..f3a415d2f7c 100644 --- a/.github/workflows/branch-name-check.yml +++ b/.github/workflows/branch-name-check.yml @@ -18,7 +18,6 @@ jobs: source-branch: ${{ steps.branch-name-check.outputs.source-branch }} target-branch: ${{ steps.branch-name-check.outputs.target-branch }} steps: - # Extract the source and target branches for the PR - name: Extract branch names id: branch-name-check run: | diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 4cdcda486a0..25501201bd5 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -8,12 +8,13 @@ env: PIP_DEFAULT_TIMEOUT: 100 on: + pull_request: + types: [opened, synchronize, edited] push: branches: - 'feature/*' - 'hotfix/*' - 'release/[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?' - workflow_dispatch: # Cancel previous runs that are not yet completed. concurrency: