mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-28 20:23:36 +00:00
Move files used in gh actions from root (#6346)
* Move files used in gh actions from root * keep this * pydocstyle * ^ * fix: relative path, os independent * use relative root path * ^ * move noxfile.py to .github/scripts * remove flag
This commit is contained in:
29
.github/scripts/noxfile.py
Normal file
29
.github/scripts/noxfile.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Nox sessions."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import nox
|
||||
|
||||
ROOT_DIR = Path(__file__).parent.parent.parent
|
||||
PLATFORM_DIR = ROOT_DIR / "openbb_platform"
|
||||
PLATFORM_TESTS = [
|
||||
str(PLATFORM_DIR / p) for p in ["tests", "core", "providers", "extensions"]
|
||||
]
|
||||
|
||||
|
||||
@nox.session(python=["3.9", "3.10", "3.11"])
|
||||
def tests(session):
|
||||
"""Run the test suite."""
|
||||
session.install("poetry", "toml")
|
||||
session.run(
|
||||
"python",
|
||||
str(PLATFORM_DIR / "dev_install.py"),
|
||||
"-e",
|
||||
"all",
|
||||
external=True,
|
||||
)
|
||||
session.install("pytest")
|
||||
session.install("pytest-cov")
|
||||
session.run(
|
||||
"pytest", *PLATFORM_TESTS, f"--cov={PLATFORM_DIR}", "-m", "not integration"
|
||||
)
|
||||
4
.github/workflows/draft-release.yml
vendored
4
.github/workflows/draft-release.yml
vendored
@@ -36,8 +36,8 @@ jobs:
|
||||
- name: 🧬 Process Changelog
|
||||
run: |
|
||||
pip install requests openai
|
||||
python process_changelog.py CHANGELOG.md ${{ github.event.inputs.release_pr_number }}
|
||||
python summarize_changelog.py ${{ secrets.GITHUB_TOKEN }} ${{ secrets.OPENAI_API_KEY }}
|
||||
python .github/scripts/process_changelog.py CHANGELOG.md ${{ github.event.inputs.release_pr_number }}
|
||||
python .github/scripts/summarize_changelog.py ${{ secrets.GITHUB_TOKEN }} ${{ secrets.OPENAI_API_KEY }}
|
||||
cat CHANGELOG.md
|
||||
|
||||
- name: 🛫 Create Release
|
||||
|
||||
2
.github/workflows/platform-core.yml
vendored
2
.github/workflows/platform-core.yml
vendored
@@ -43,4 +43,4 @@ jobs:
|
||||
- name: Run tests
|
||||
run: |
|
||||
pip install nox
|
||||
nox -s tests --python ${{ matrix.python_version }}
|
||||
nox -f .github/scripts/noxfile.py -s tests --python ${{ matrix.python_version }}
|
||||
|
||||
25
noxfile.py
25
noxfile.py
@@ -1,25 +0,0 @@
|
||||
import nox
|
||||
|
||||
test_locations = [
|
||||
"openbb_platform/tests",
|
||||
"openbb_platform/core",
|
||||
"openbb_platform/providers",
|
||||
"openbb_platform/extensions",
|
||||
]
|
||||
|
||||
|
||||
@nox.session(python=["3.9", "3.10", "3.11"])
|
||||
def tests(session):
|
||||
session.install("poetry", "toml")
|
||||
session.run(
|
||||
"python",
|
||||
"./openbb_platform/dev_install.py",
|
||||
"-e",
|
||||
"all",
|
||||
external=True,
|
||||
)
|
||||
session.install("pytest")
|
||||
session.install("pytest-cov")
|
||||
session.run(
|
||||
"pytest", *test_locations, "--cov=openbb_platform/", "-m", "not integration"
|
||||
)
|
||||
@@ -20,6 +20,8 @@ from openbb_core.app.router import CommandMap
|
||||
from pydantic.fields import FieldInfo
|
||||
from pydantic_core import PydanticUndefined
|
||||
|
||||
ROOT_DIR = Path(__file__).parent.parent.parent.parent
|
||||
|
||||
TEST_TEMPLATE = """\n\n@parametrize(
|
||||
"params",
|
||||
[
|
||||
@@ -43,9 +45,9 @@ def find_extensions(filter_chart: Optional[bool] = True):
|
||||
filter_ext = ["tests", "__pycache__"]
|
||||
if filter_chart:
|
||||
filter_ext.append("charting")
|
||||
extensions = [x for x in Path("openbb_platform/extensions").iterdir() if x.is_dir()]
|
||||
extensions = [x for x in (ROOT_DIR / "extensions").iterdir() if x.is_dir()]
|
||||
extensions.extend(
|
||||
[x for x in Path("openbb_platform/obbject_extensions").iterdir() if x.is_dir()]
|
||||
[x for x in (ROOT_DIR / "obbject_extensions").iterdir() if x.is_dir()]
|
||||
)
|
||||
extensions = [x for x in extensions if x.name not in filter_ext]
|
||||
return extensions
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
|
||||
import glob
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import toml
|
||||
|
||||
ROOT_DIR = Path(__file__).parent.parent
|
||||
|
||||
|
||||
def test_optional_packages():
|
||||
"""Ensure only required extensions are built and versions respect pyproject.toml"""
|
||||
data = toml.load("openbb_platform/pyproject.toml")
|
||||
data = toml.load(ROOT_DIR / "pyproject.toml")
|
||||
dependencies = data["tool"]["poetry"]["dependencies"]
|
||||
extras = data["tool"]["poetry"]["extras"]
|
||||
all_packages = extras["all"]
|
||||
@@ -32,7 +35,7 @@ def test_optional_packages():
|
||||
|
||||
def test_default_package_files():
|
||||
"""Ensure only required extensions are built and versions respect pyproject.toml"""
|
||||
data = toml.load("openbb_platform/pyproject.toml")
|
||||
data = toml.load(Path(ROOT_DIR / "pyproject.toml"))
|
||||
dependencies = data["tool"]["poetry"]["dependencies"]
|
||||
package_files = glob.glob("openbb_platform/openbb/package/*.py")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user