mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-12-01 13:44:16 +00:00
[V5] CLI 2.0 - Pluggable Backends, Non-TTY Default, HTTP Dispatcher, Spec Files + Codegen (#7433)
* stash some changes * add more robust testing * mypy * point PR at V5 * introduce spec file * codespell * test fix * fix workflow environment setup * fix workflow environment setup * fix workflow environment setup * add pyyaml to dependencies * split lint jobs * fix workflow environment setup * fix workflow environment setup * workflow env setup * workflow env setup * clean up code comments * add auth hook entrypoints * codespell * add codegen feature * codespell * move _unpack into dispatchers for consistency with codegen packages * surface nested models in the response * fix missing coverage in CI * socrata updates * test fix * detect plotly output * add --include and --exclude flags from generate-extension command * cap test matrix at python 3.14 * no useless comments * platform controller command description split * merge URL overloads from path params * exclude none and unset from model dump --------- Co-authored-by: deeleeramone <> Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
117
.github/workflows/test-unit-cli.yml
vendored
117
.github/workflows/test-unit-cli.yml
vendored
@@ -1,48 +1,121 @@
|
||||
name: 🖥️ Unit test CLI
|
||||
name: 🖥️ openbb-cli
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
- v5
|
||||
paths:
|
||||
- 'cli/**'
|
||||
- '.github/workflows/test-unit-cli.yml'
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- v5
|
||||
paths:
|
||||
- 'cli/**'
|
||||
- '.github/workflows/test-unit-cli.yml'
|
||||
merge_group:
|
||||
types: [checks_requested]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: cli
|
||||
|
||||
jobs:
|
||||
unit_tests:
|
||||
runs-on: ubuntu-latest
|
||||
test:
|
||||
name: Test (${{ matrix.os }} / Python ${{ matrix.python_version }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
OPENBB_ALLOW_ON_COMMAND_OUTPUT: "True"
|
||||
OPENBB_ALLOW_MUTABLE_EXTENSIONS: "True"
|
||||
UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
matrix:
|
||||
python_version:
|
||||
["3.10", "3.11", "3.12", "3.13", "3.14"]
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Linux: full sweep across every supported Python.
|
||||
- { os: ubuntu-latest, python_version: "3.10" }
|
||||
- { os: ubuntu-latest, python_version: "3.11" }
|
||||
- { os: ubuntu-latest, python_version: "3.12" }
|
||||
- { os: ubuntu-latest, python_version: "3.13" }
|
||||
- { os: ubuntu-latest, python_version: "3.14" }
|
||||
# macOS and Windows: min and max supported.
|
||||
- { os: macos-latest, python_version: "3.10" }
|
||||
- { os: macos-latest, python_version: "3.14" }
|
||||
- { os: windows-latest, python_version: "3.10" }
|
||||
- { os: windows-latest, python_version: "3.14" }
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
- name: Install Python ${{ matrix.python_version }}
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: ${{ matrix.python_version }}
|
||||
allow-prereleases: true
|
||||
cache: "pip"
|
||||
python-version: ${{ matrix.python_version }}
|
||||
allow-prereleases: true
|
||||
cache: "pip"
|
||||
|
||||
- name: Cache pip packages
|
||||
uses: actions/cache@v5
|
||||
- name: Cache uv (built wheels — scipy/numpy/pandas source builds)
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ matrix.python_version }}-${{ hashFiles('cli/poetry.lock') }}
|
||||
path: ${{ github.workspace }}/.uv-cache
|
||||
key: uv-${{ runner.os }}-py${{ matrix.python_version }}-${{ hashFiles('cli/pyproject.toml', 'cli/uv.lock', 'openbb_platform/core/pyproject.toml', 'openbb_platform/obbject_extensions/charting/pyproject.toml', 'openbb_platform/extensions/devtools/pyproject.toml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
uv-${{ runner.os }}-py${{ matrix.python_version }}-
|
||||
|
||||
- name: Run tests
|
||||
- name: Install gfortran + OpenBLAS (macOS, prerelease Python — scipy source build)
|
||||
if: runner.os == 'macOS' && matrix.python_version == '3.15'
|
||||
shell: bash
|
||||
working-directory: .
|
||||
run: |
|
||||
pip install nox
|
||||
nox -f .github/scripts/noxfile.py -s unit_test_cli --python ${{ matrix.python_version }}
|
||||
set -euo pipefail
|
||||
brew install gcc openblas pkg-config
|
||||
GFORTRAN_BIN=$(ls /opt/homebrew/opt/gcc/bin/gfortran-* | tail -1)
|
||||
GFORTRAN_DIR=$(dirname "$GFORTRAN_BIN")
|
||||
ln -sf "$GFORTRAN_BIN" "$GFORTRAN_DIR/gfortran"
|
||||
echo "$GFORTRAN_DIR" >> "$GITHUB_PATH"
|
||||
"$GFORTRAN_DIR/gfortran" --version
|
||||
OPENBLAS_PC="$(brew --prefix openblas)/lib/pkgconfig"
|
||||
echo "PKG_CONFIG_PATH=$OPENBLAS_PC" >> "$GITHUB_ENV"
|
||||
PKG_CONFIG_PATH="$OPENBLAS_PC" pkg-config --modversion openblas
|
||||
|
||||
- name: Install gfortran (Linux, prerelease Python — scipy source build)
|
||||
if: runner.os == 'Linux' && matrix.python_version == '3.15'
|
||||
shell: bash
|
||||
working-directory: .
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y gfortran libopenblas-dev liblapack-dev
|
||||
gfortran --version
|
||||
|
||||
- name: Install openbb-cli
|
||||
run: |
|
||||
python -m pip install --upgrade pip uv
|
||||
python -m uv pip install --system -e ".[charting]" --group dev
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
python -m pytest tests \
|
||||
--cov=openbb_cli \
|
||||
--cov-config=.coveragerc \
|
||||
--cov-report=term-missing \
|
||||
--cov-report=xml:coverage-unit.xml
|
||||
|
||||
- name: Upload unit-test coverage artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openbb-cli-coverage-unit-${{ matrix.os }}-py${{ matrix.python_version }}
|
||||
path: cli/coverage-unit.xml
|
||||
|
||||
Reference in New Issue
Block a user