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:
montezdesousa
2024-04-26 18:18:00 +01:00
committed by GitHub
parent 7f90d7406b
commit bd75a9746f
8 changed files with 41 additions and 32 deletions

View 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"
)

View File

@@ -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

View File

@@ -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 }}

View File

@@ -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"
)

View File

@@ -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

View File

@@ -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")