From 9435fd74804e6ebdae6f8116879d75ea5ee2ba75 Mon Sep 17 00:00:00 2001 From: Luqman Date: Tue, 11 Apr 2023 19:53:05 +0100 Subject: [PATCH] Workflow improvements (#4734) --- .github/release-drafter.yml | 2 +- .github/workflows/README.md | 62 ++++++------------- .github/workflows/build-release.yml | 16 +---- .github/workflows/code-coverage.yml | 50 --------------- .../{docker.yml => docker-build.yml} | 1 - .../{draft.yml => draft-release.yml} | 0 .../workflows/{labels.yml => labels-PR.yml} | 0 .../workflows/{issue.yml => labels-issue.yml} | 0 .../{macos_build.yml => macos-build.yml} | 0 .github/workflows/{mac.yml => macos-ml.yml} | 0 .github/workflows/nightly-build.yml | 6 +- .../{nightly-pypi.yml => pypi-nightly.yml} | 0 .../workflows/{windows.yml => windows_ml.yml} | 2 +- 13 files changed, 28 insertions(+), 111 deletions(-) delete mode 100644 .github/workflows/code-coverage.yml rename .github/workflows/{docker.yml => docker-build.yml} (99%) rename .github/workflows/{draft.yml => draft-release.yml} (100%) rename .github/workflows/{labels.yml => labels-PR.yml} (100%) rename .github/workflows/{issue.yml => labels-issue.yml} (100%) rename .github/workflows/{macos_build.yml => macos-build.yml} (100%) rename .github/workflows/{mac.yml => macos-ml.yml} (100%) rename .github/workflows/{nightly-pypi.yml => pypi-nightly.yml} (100%) rename .github/workflows/{windows.yml => windows_ml.yml} (98%) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 27c0c25eba9..c921a292950 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -7,7 +7,7 @@ exclude-contributors: - 'deeleeramone' - 'hjoaquim' - 'jose-donato' - - 'luqman-bello' + - 'luqmanbello' - 'martinb-bb' - 'montezdesousa' - 'tehcoderer' diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 546e6b4432b..f9199285bbf 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -1,26 +1,25 @@ # OpenBB Workflows This directory contains the workflows for the OpenBB 🦋 Project. The workflows are: -| Workflows | Summary -| :-------------------- |:--- -| branch-name-check.yml | Checks if the branch name is valid and follows the naming convention. -| build-release.yml | Builds the project and runs the tests. -| docker.yml | Builds the docker image and pushes it to the docker hub. -| draft.yml | Creates a draft release when a new tag is pushed. -| gh-pages.yml | Builds the documentation and deploy to github pages. -| integration-test.yml | Runs the integration tests. -| intel_macos_build.yml | Builds the project on Intel Macs. -| issue.yml | Creates an issue when a new bug is reported. -| labels.yml | Adds labels to the issues and pull requests. -| linting.yml | Runs the linters. -| m1_macos_build.yml | Builds the project on M1 Macs. -| mac.yml | Builds the project on Mac OS X Full Clean Build with ML. -| nightly-build.yml | Builds the project and runs the integration tests every night on the `develop` branch. -| pypi.yml | Publishes the package to PyPI. -| nightly-pypi.yml | Publishes the package to PyPI every night on the `develop` branch. -| unit-test.yml | Runs the unit tests. -| windows.yml | Builds the project on Windows 10 Full Clean Build with ML. -| windows10_build.yml | Builds the project on Windows 10. +| Workflows | Summary | Branches +| :-------------------- |:------------------ | :------------------ +| branch-name-check.yml | Checks if the branch name is valid and follows the naming convention. | all branches +| build-release.yml | Builds the project and runs the tests. | main, release/* +| docker-build.yml | Builds the docker image and pushes it to the docker hub. | all branches (only pushes to docker hub on main) +| draft-release.yml | Creates a draft release when a new tag is pushed. | - +| gh-pages.yml | Builds the documentation and deploy to github pages. | main and release/* +| integration-test.yml | Runs the integration tests. | all branches +| labels-issue.yml | Creates an issue when a new bug is reported. | - +| labels-PR.yml | Adds labels to the issues and pull requests. | - +| linting.yml | Runs the linters. | all branches +| macos-build.yml | Builds the project on M1 Macs. | develop, main, release/* +| macos-ml.yml | Builds the project on Mac OS X Full Clean Build with ML. | main +| nightly-build.yml | Builds the project and runs the integration tests every night on the `develop` branch. | develop +| pypi.yml | Publishes the package to PyPI. | all branches (only pushes to PyPI on main) +| pypi-nightly.yml | Publishes the package to PyPI every night on the `develop` branch. | develop +| unit-test.yml | Runs the unit tests. | all branches +| windows_ml.yml | Builds the project on Windows 10 Full Clean Build with ML. | main +| windows10_build.yml | Builds the project on Windows 10. | all branches ## Branch Name Check Workflow Objective: To check if pull request branch names follow the GitFlow naming convention before merging. @@ -74,7 +73,7 @@ Steps 6. Publishing the Docker Image: This step publishes the Docker image to the GitHub Container Registry. The Docker image is only pushed to the registry if the branch being built is `main`. -## Draft Workflow +## Release Drafter Workflow This GitHub Actions workflow is designed to automatically generate and update draft releases in a GitHub repository. The workflow is triggered when it is manually dispatched, allowing you to control when the draft releases are updated. ## GH Pages Workflow @@ -95,27 +94,6 @@ The workflow consists of the following steps: The results of the tests are captured in a file called `result.txt`. The summary of the tests, including information about failed tests, is then uploaded to Slack using the `adrey/slack-file-upload-action` GitHub Action. -## Intel MacOS Build Workflow -This GitHub Actions workflow is responsible for building and testing the project on Intel Macs. The workflow is triggered by the workflow_dispatch event, which means it can be manually triggered. The concurrency group for the job is defined based on the Github workflow and the Github ref, and it is set to cancel in-progress runs. - -The job named `Build` has several steps: - -1. Checkout the repository's main branch. -2. Git log to see the history of the repository. -3. Install `create-dmg` using Homebrew. -4. Clean up previous environment variables and set PATH to default. -5. Set up conda environment caching. -6. Set up Miniconda using the `build/conda/conda-3-9-env-full.yaml` file. -7. Use Poetry to install the necessary dependencies. -8. Install Pyinstaller. -9. Install Portfolio Optimization and Forecasting Toolkits. -10. Install a specific version of Papermill using pip. -11. Build the bundle using Pyinstaller and do some additional tasks such as setting up icons. -12. Create a keychain and decode a certificate using a password stored in Github secrets. -13. Code sign specific binaries using the certificate and password from the previous step. - -This workflow builds the OpenBB Terminal application on MacOS and signs it with a certificate to allow it to run on the MacOS system. - ## Linting Workflow This GitHub Actions workflow is responsible for running linting checks on the codebase. This workflow is triggered on pull request events such as `opened`, `synchronize`, and `edited`, and push events on branches with names that start with `feature/`, `hotfix/`, or `release/`. The workflow also sets a number of environment variables and uses Github Actions caching to improve performance. diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 7e131a46206..2e616a35fc5 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -35,20 +35,10 @@ jobs: trigger-macos-build: runs-on: ubuntu-latest steps: - - name: Trigger M1 MacOs Build + - name: Trigger MacOs Build uses: aurelien-baudet/workflow-dispatch@v2 with: - workflow: m1_macos_build.yml - token: ${{ secrets.GITHUB_TOKEN }} - wait-for-completion-timeout: 2h - - trigger-intel-build: - runs-on: ubuntu-latest - steps: - - name: Trigger Intel MacOs Build - uses: aurelien-baudet/workflow-dispatch@v2 - with: - workflow: intel_macos_build.yml + workflow: macos_-uild.yml token: ${{ secrets.GITHUB_TOKEN }} wait-for-completion-timeout: 2h @@ -58,5 +48,5 @@ jobs: - name: Trigger docker Build uses: aurelien-baudet/workflow-dispatch@v2 with: - workflow: docker.yml + workflow: docker-build.yml token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml deleted file mode 100644 index 637fd88be10..00000000000 --- a/.github/workflows/code-coverage.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Code Coverage Tests - -on: workflow_dispatch - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - code-coverage: - runs-on: ubuntu-latest - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - steps: - - name: Checkout code - if: github.event_name == 'push' - uses: actions/checkout@v3 - - - name: Checkout specific ref - if: github.event_name == 'pull_request' - run: git fetch origin ${{ github.event.pull_request.head.ref }} && git checkout FETCH_HEAD - - - name: Setup Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: "3.9" - architecture: x64 - - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - version: 1.4.0 - virtualenvs-create: true - virtualenvs-in-project: true - - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v3 - with: - path: .venv - key: venv-${{ runner.os }}-v1-${{ hashFiles('**/poetry.lock') }} - - - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction -E optimization - - - name: Run code coverage tests - run: | - source $VENV - pytest --cov --cov-fail-under=50 \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker-build.yml similarity index 99% rename from .github/workflows/docker.yml rename to .github/workflows/docker-build.yml index e99d5b99f94..12e2ad1826d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker-build.yml @@ -9,7 +9,6 @@ jobs: OPENBBTERMINAL_DOCKER_GITHUB_REPOSITORY: ${{ github.repository }} OPENBB_LOGGING_APP_NAME: "gst_docker" - steps: - name: Checkout Code uses: actions/checkout@v3 diff --git a/.github/workflows/draft.yml b/.github/workflows/draft-release.yml similarity index 100% rename from .github/workflows/draft.yml rename to .github/workflows/draft-release.yml diff --git a/.github/workflows/labels.yml b/.github/workflows/labels-PR.yml similarity index 100% rename from .github/workflows/labels.yml rename to .github/workflows/labels-PR.yml diff --git a/.github/workflows/issue.yml b/.github/workflows/labels-issue.yml similarity index 100% rename from .github/workflows/issue.yml rename to .github/workflows/labels-issue.yml diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos-build.yml similarity index 100% rename from .github/workflows/macos_build.yml rename to .github/workflows/macos-build.yml diff --git a/.github/workflows/mac.yml b/.github/workflows/macos-ml.yml similarity index 100% rename from .github/workflows/mac.yml rename to .github/workflows/macos-ml.yml diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 48f535c100a..7a0d2e98d2f 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -33,17 +33,17 @@ jobs: - name: Trigger M1 & Intel MacOs Build uses: aurelien-baudet/workflow-dispatch@v2 with: - workflow: macos_build.yml + workflow: macos-build.yml token: ${{ secrets.GITHUB_TOKEN }} wait-for-completion-timeout: 2h trigger-docker-build: runs-on: ubuntu-latest steps: - - name: Trigger docker Build + - name: Trigger Docker Build uses: aurelien-baudet/workflow-dispatch@v2 with: - workflow: docker.yml + workflow: docker-build.yml token: ${{ secrets.GITHUB_TOKEN }} trigger-pypi-build: diff --git a/.github/workflows/nightly-pypi.yml b/.github/workflows/pypi-nightly.yml similarity index 100% rename from .github/workflows/nightly-pypi.yml rename to .github/workflows/pypi-nightly.yml diff --git a/.github/workflows/windows.yml b/.github/workflows/windows_ml.yml similarity index 98% rename from .github/workflows/windows.yml rename to .github/workflows/windows_ml.yml index 6c5763f28b4..634c5c3a206 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows_ml.yml @@ -18,7 +18,7 @@ on: description: "Test scenario tags" jobs: windows-conda: - name: Windows-latest, Conda-latest, Python 3.9 + name: Windows-latest, Conda-latest, Python 3.9 runs-on: windows-latest steps: - name: Set git to use LF