summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Maslek <jmaslek11@gmail.com>2023-10-09 16:59:12 -0400
committerGitHub <noreply@github.com>2023-10-09 16:59:12 -0400
commit4e3cfa3aa8a02bf519ba35a3d88b49e0943be269 (patch)
treeb4a659f849e62d827f3f7ae3dd5c703838c68a5e
parentde5837fed69fb0fcc7368d55e4f95256ed98ad21 (diff)
parent10568ca0808565486b5563560df06ffac8f30dc0 (diff)
Merge pull request #5536 from OpenBB-finance/feature/v4-tests
Add the v4 tests to default branch
-rw-r--r--.github/workflows/platform-api-integration-test.yml134
-rw-r--r--.github/workflows/platform-integration-test.yml96
2 files changed, 230 insertions, 0 deletions
diff --git a/.github/workflows/platform-api-integration-test.yml b/.github/workflows/platform-api-integration-test.yml
new file mode 100644
index 00000000000..02545c85764
--- /dev/null
+++ b/.github/workflows/platform-api-integration-test.yml
@@ -0,0 +1,134 @@
+name: API Integration Tests
+
+on:
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ api-integration-tests:
+ runs-on: ubuntu-latest
+ env:
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
+ OPENBB_API_AUTH: true
+ OPENBB_API_USERNAME: "USER"
+ OPENBB_API_PASSWORD: "PASS"
+
+ steps:
+ - name: Slack Notification - Starting
+ uses: act10ns/slack@v1
+ with:
+ status: starting
+ channel: "#workflows"
+ message: Starting API Integration Test...
+ if: always()
+
+ - name: Checkout code
+ 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: Load cached venv
+ id: cached-python-environment
+ uses: actions/cache@v3
+ with:
+ path: runner_env
+ key: runner_env-${{ runner.os }}-v1-${{ hashFiles('**/poetry.lock', '**/dev_install.py') }}
+
+ - name: Install Dependencies
+ if: steps.cached-python-environment.outputs.cache-hit != 'true'
+ run: |
+ python -m venv runner_env
+ source runner_env/bin/activate
+ pip install pytest poetry\
+ ./openbb_platform \
+ ./openbb_platform/providers/alpha_vantage \
+ ./openbb_platform/providers/cboe \
+ ./openbb_platform/providers/quandl \
+ ./openbb_platform/providers/fmp \
+ ./openbb_platform/providers/yfinance \
+ ./openbb_platform/providers/intrinio \
+ ./openbb_platform/extensions/futures \
+ ./openbb_platform/extensions/qa \
+ ./openbb_platform/extensions/ta \
+ ./openbb_platform/extensions/econometrics
+ pip uninstall -y openbb_core
+ pip uninstall -y openbb_provider
+ cd openbb_platform/platform/core
+ pip install -U .
+ cd ../provider/
+ pip install -U .
+ cd ../../../
+ pip install -U pydantic
+
+ - name: Populate System Setting Files
+ run: |
+ mkdir -p ~/.openbb_platform
+ touch ~/.openbb_platform/system_settings.json
+ echo '{"log_collect":false}' > ~/.openbb_platform/system_settings.json
+ cat ~/.openbb_platform/system_settings.json
+
+ - name: Create and Populate user_settings.json from GitHub Secrets
+ run: |
+ touch ~/.openbb_platform/user_settings.json
+ echo '{
+ "credentials": {
+ "benzinga_api_key": ${{ secrets.BENZINGA_API_KEY }},
+ "fmp_api_key": "${{ secrets.FMP_API_KEY }}",
+ "polygon_api_key": "${{ secrets.POLYGON_API_KEY }}",
+ "alpha_vantage_api_key": "${{ secrets.ALPHA_VANTAGE_API_KEY }}",
+ "fred_api_key": "${{ secrets.FRED_API_KEY }}",
+ "intrinio_api_key": "${{ secrets.INTRINIO_API_KEY }}"
+ }
+ }' > ~/.openbb_platform/user_settings.json
+
+ - name: Launch the Uvicorn Process
+ run: |
+ source runner_env/bin/activate
+ pip list
+ uvicorn openbb_core.api.rest_api:app --host 0.0.0.0 --port 8000 --reload &
+
+ - name: Wait for 10 seconds
+ run: sleep 10
+
+ - name: Run API Integration Tests
+ run: |
+ source runner_env/bin/activate
+ pip list
+ cd openbb_platform
+ pytest -m integration
+
+ - name: Cache pip packages
+ uses: actions/cache@v2
+ with:
+ path: ~/.cache/pip
+ key: runner_env-${{ runner.os }}-v1-${{ hashFiles('**/poetry.lock', '**/dev_install.py') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-
+
+ - name: Upload summary to Slack
+ uses: adrey/slack-file-upload-action@master
+ with:
+ token: ${{ secrets.SLACK_API_TOKEN }}
+ initial_comment: "API Integration test summary"
+ title: "Integration test summary"
+ path: summary.txt
+ channel: ${{ secrets.SLACK_CHANNEL_ID }}
+
+ - name: Slack Notification - Success/Failure
+ uses: act10ns/slack@v1
+ with:
+ status: ${{ job.status }}
+ steps: ${{ toJson(steps) }}
+ channel: "#workflows"
+ if: always()
diff --git a/.github/workflows/platform-integration-test.yml b/.github/workflows/platform-integration-test.yml
new file mode 100644
index 00000000000..806f2cc34e6
--- /dev/null
+++ b/.github/workflows/platform-integration-test.yml
@@ -0,0 +1,96 @@
+name: Integration Tests
+
+on:
+ push:
+ branches:
+ - release/*
+ - main
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ integration-tests:
+ runs-on: ubuntu-latest
+ env:
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
+ steps:
+ - name: Slack Notification - Starting
+ uses: act10ns/slack@v1
+ with:
+ status: starting
+ channel: '#workflows'
+ message: Starting Integration Test...
+ if: always()
+
+ - name: Checkout code
+ 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: Setup sudo apt installs for ubuntu-latest
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y \
+ libgtk-3-dev \
+ libwebkit2gtk-4.0-dev
+
+ - 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 integration tests
+ id: integration-tests
+ run: |
+ source $VENV
+ python terminal.py -t | tee result.txt
+ grep "================================ Integration Test Summary ================================" result.txt -A100 | tail --bytes=2000 > summary.txt
+ echo >> summary.txt
+
+ - name: Run Integration Tests Coverage Report
+ id: integration-tests-coverage
+ run: |
+ source $VENV
+ python terminal.py -t --coverage | tee result.txt
+ sed -n '/Integration Coverage Summary/,$p' result.txt >> summary.txt
+
+ - name: Upload summary to Slack
+ uses: adrey/slack-file-upload-action@master
+ with:
+ token: ${{ secrets.SLACK_API_TOKEN }}
+ initial_comment: "Integration test summary"
+ title: "Integration test summary"
+ path: summary.txt
+ channel: ${{ secrets.SLACK_CHANNEL_ID }}
+
+ - name: Slack Notification - Success/Failure
+ uses: act10ns/slack@v1
+ with:
+ status: ${{ job.status }}
+ steps: ${{ toJson(steps) }}
+ channel: '#workflows'
+ if: always()