Skip to content

V5

V5 #60

name: 🧪 test openbb-oecd
on:
pull_request:
branches: [develop, main, v5, feature/v5-platform-api]
paths:
- "openbb_platform/providers/oecd/**"
- ".github/workflows/test-unit-openbb-oecd.yml"
workflow_dispatch:
inputs:
force_cache_rebuild:
description: "Force the build hook to regenerate the OECD cache from live SDMX (ignores actions/cache)."
type: boolean
default: false
permissions:
contents: read
concurrency:
# Cancel in-flight matrix runs when a new commit lands on the same PR.
group: test-openbb-oecd-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build sdist + wheel
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: openbb_platform/providers/oecd
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip uv
- name: Restore OECD SDMX cache
id: oecd-cache
uses: actions/cache@v5
with:
path: openbb_platform/providers/oecd/openbb_oecd/assets/oecd_cache.json.xz
key: oecd-sdmx-${{ hashFiles('openbb_platform/providers/oecd/openbb_oecd/utils/generate_cache.py') }}
restore-keys: |
oecd-sdmx-
- name: Build sdist + wheel
env:
OPENBB_OECD_FORCE_CACHE_REBUILD: ${{ inputs.force_cache_rebuild == true && '1' || '0' }}
run: uv build --no-sources
- uses: actions/upload-artifact@v5
with:
name: openbb-oecd-dist
path: openbb_platform/providers/oecd/dist/
if-no-files-found: error
retention-days: 7
lint:
name: Lint (ruff + ty)
needs: build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: openbb_platform/providers/oecd
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip uv
- uses: actions/download-artifact@v5
with:
name: openbb-oecd-dist
path: openbb_platform/providers/oecd/dist
- name: Seed the cache asset from the built wheel
run: |
WHEEL=$(ls dist/openbb_oecd-*.whl | head -1)
mkdir -p openbb_oecd/assets
python -c "
import sys, zipfile, shutil
wheel = sys.argv[1]
dest = sys.argv[2]
with zipfile.ZipFile(wheel) as z:
with z.open('openbb_oecd/assets/oecd_cache.json.xz') as src, open(dest, 'wb') as out:
shutil.copyfileobj(src, out)
" "$WHEEL" openbb_oecd/assets/oecd_cache.json.xz
ls -la openbb_oecd/assets/oecd_cache.json.xz
- name: Install openbb-oecd in editable mode (+ dev group)
run: |
uv pip install --system -e .
uv pip install --system --group dev
- name: ruff check
run: ruff check openbb_oecd tests hatch_build.py
- name: ruff format --check
run: ruff format --check openbb_oecd tests hatch_build.py
- name: ty check
run: ty check openbb_oecd
test:
name: Test (${{ matrix.os }} / Python ${{ matrix.python_version }})
needs: build
strategy:
fail-fast: false
matrix:
include:
- { 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" }
- { os: ubuntu-latest, python_version: "3.15" }
- { os: macos-latest, python_version: "3.10" }
- { os: macos-latest, python_version: "3.15" }
- { os: windows-latest, python_version: "3.10" }
- { os: windows-latest, python_version: "3.14" }
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
working-directory: openbb_platform/providers/oecd
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
allow-prereleases: true
- uses: actions/download-artifact@v5
with:
name: openbb-oecd-dist
path: openbb_platform/providers/oecd/dist
- run: python -m pip install --upgrade pip uv
- name: Seed the cache asset from the built wheel
run: |
WHEEL=$(ls dist/openbb_oecd-*.whl | head -1)
mkdir -p openbb_oecd/assets
python -c "
import sys, zipfile, shutil
wheel = sys.argv[1]
dest = sys.argv[2]
with zipfile.ZipFile(wheel) as z:
with z.open('openbb_oecd/assets/oecd_cache.json.xz') as src, open(dest, 'wb') as out:
shutil.copyfileobj(src, out)
" "$WHEEL" openbb_oecd/assets/oecd_cache.json.xz
- name: Install openbb-oecd from source (+ dev group)
run: |
uv pip install --system -e .
uv pip install --system --group dev
- name: Run unit tests
run: pytest tests --cov=openbb_oecd --cov-report=term-missing --cov-fail-under=100