Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .bumpversion.cfg

This file was deleted.

39 changes: 29 additions & 10 deletions .github/workflows/integration-ml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pre-commit/action@v3.0.1
python-version: "3.11"
- uses: astral-sh/setup-uv@v4
- name: Check lockfile
run: uv lock --check
- name: Run pre-commit
run: |
# Use the locked dev environment so local and CI hooks run with the same toolchain.
uv sync --locked --group dev
uv run pre-commit run --all-files

test:
needs: pre-commit
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ['3.11']
python-version: ["3.11"]
environment: [staging, production]

steps:
Expand All @@ -37,33 +44,45 @@ jobs:

- name: Checkout code
uses: actions/checkout@v4

- name: Pull LFS objects
run: git lfs pull

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- uses: astral-sh/setup-uv@v4

- name: Check lockfile
run: uv lock --check

- name: Install Python dependencies
run: |
python -m pip install --no-cache-dir --upgrade pip
# Install dev tooling (pytest, etc.) from the locked local project config.
uv sync --locked --only-group dev

# Keep install source parity with previous behavior:
# - staging: install local package from this checkout
# - production: install published package from PyPI
if [ "${{ matrix.environment }}" = "production" ]; then
pip install --no-cache-dir "neuracore[dev,ml,examples]"
uv pip install "neuracore[ml,examples]"
else
pip install --no-cache-dir ".[dev,ml,examples]"
uv pip install ".[ml,examples]"
fi

- name: Run Integration Test
env:
# Run the same test against both staging and production using matrix-selected credentials/URL.
NEURACORE_API_URL: ${{ matrix.environment == 'staging' && 'https://staging.api.neuracore.com/api' || 'https://api.neuracore.com/api' }}
NEURACORE_API_KEY: ${{ matrix.environment == 'staging' && secrets.STAGING_SERVICE_API_KEY || secrets.PROD_SERVICE_API_KEY }}
NEURACORE_ORG_ID: ${{ matrix.environment == 'staging' && vars.STAGING_SERVICE_ORG_ID || vars.PROD_SERVICE_ORG_ID }}
NEURACORE_ENDPOINT_TIMEOUT: 30
DISPLAY: :0
run: |
# ML integration tests require an X display and system GL/XML dependencies.
sudo apt-get update
sudo apt-get install -y libxml2-utils xvfb libgl1-mesa-dev libgl1-mesa-glx libosmesa6-dev
Xvfb $DISPLAY -screen 0 1280x1024x24 &
pytest -o log_cli=true --log-cli-level=INFO -v -n 8 tests/integration/test_algorithm.py
uv run pytest -o log_cli=true --log-cli-level=INFO -v -n 8 tests/integration/test_algorithm.py
30 changes: 21 additions & 9 deletions .github/workflows/integration-platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pre-commit/action@v3.0.1
python-version: "3.11"
- uses: astral-sh/setup-uv@v4
- name: Check lockfile
run: uv lock --check
- name: Run pre-commit
run: |
# Use the locked dev environment so hook behavior is deterministic in CI.
uv sync --locked --group dev
uv run pre-commit run --all-files

test:
needs: pre-commit
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.11']
python-version: ["3.11"]
environment: [staging, production]

steps:
Expand All @@ -39,19 +46,24 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- uses: astral-sh/setup-uv@v4

- name: Check lockfile
run: uv lock --check

- name: Install Python dependencies
run: |
python -m pip install --no-cache-dir --upgrade pip
pip install --no-cache-dir ".[dev,ml]"
# Install dev tooling plus the ML extra required by the platform integration test.
uv sync --locked --group dev --extra ml

- name: Run Integration Test
env:
# Run the same platform integration test against staging and production endpoints.
NEURACORE_API_URL: ${{ matrix.environment == 'staging' && 'https://staging.api.neuracore.com/api' || 'https://api.neuracore.com/api' }}
NEURACORE_API_KEY: ${{ matrix.environment == 'staging' && secrets.STAGING_SERVICE_API_KEY || secrets.PROD_SERVICE_API_KEY }}
NEURACORE_ORG_ID: ${{ matrix.environment == 'staging' && vars.STAGING_SERVICE_ORG_ID || vars.PROD_SERVICE_ORG_ID }}
run: pytest -o log_cli=true --log-cli-level=INFO tests/integration/test_consume_stream.py::test_get_latest_data_from_multiple_nodes
run: uv run pytest -o log_cli=true --log-cli-level=INFO tests/integration/test_consume_stream.py::test_get_latest_data_from_multiple_nodes
26 changes: 17 additions & 9 deletions .github/workflows/pr-pre-commit-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,26 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.10', '3.11']
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: pre-commit/action@v3.0.1
- uses: astral-sh/setup-uv@v4
- name: Check lockfile
run: uv lock --check
- name: Run pre-commit
run: |
uv sync --locked --group dev
uv run pre-commit run --all-files

test:
needs: pre-commit
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.10', '3.11']
python-version: ["3.10", "3.11"]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
Expand All @@ -47,21 +53,23 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- uses: astral-sh/setup-uv@v4

- name: Check lockfile
run: uv lock --check

- name: Install Python dependencies
run: |
python -m pip install --no-cache-dir --upgrade pip
pip install --no-cache-dir ".[dev,ml,import]"
run: uv sync --locked --group dev --extra ml --extra import

- name: Run unit tests (except PI0)
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
pytest tests/unit --ignore=tests/unit/ml/algorithms/test_pi0.py
uv run pytest tests/unit --ignore=tests/unit/ml/algorithms/test_pi0.py

- name: Run PI0 unit tests in isolated pytest process
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
pytest tests/unit/ml/algorithms/test_pi0.py
uv run pytest tests/unit/ml/algorithms/test_pi0.py
44 changes: 28 additions & 16 deletions .github/workflows/pr-publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,29 @@ jobs:
- name: Pull latest changes
run: git pull --tags

- name: Extract version from .bumpversion.cfg
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- uses: astral-sh/setup-uv@v4

- name: Check lockfile
run: uv lock --check

- name: Extract version from pyproject.toml
id: extract_version
run: |
VERSION=$(grep '^current_version = ' .bumpversion.cfg | cut -d'=' -f2 | tr -d ' ')
echo "version=$VERSION" >> $GITHUB_OUTPUT
VERSION=$(uv version --short)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Current version in repo: $VERSION"

- name: Check PyPI for existing version
id: check_pypi
run: |
# Query PyPI API for the latest version
PYPI_VERSION=$(curl -s https://pypi.org/pypi/neuracore/json | jq -r '.info.version' || echo "none")
echo "pypi_version=$PYPI_VERSION" >> $GITHUB_OUTPUT
echo "pypi_version=$PYPI_VERSION" >> "$GITHUB_OUTPUT"
echo "Latest version on PyPI: $PYPI_VERSION"

- name: Determine if we should publish
Expand All @@ -52,10 +62,10 @@ jobs:

if [ "$CURRENT_VERSION" = "$PYPI_VERSION" ]; then
echo "✗ Versions match - no publish needed"
echo "should_publish=false" >> $GITHUB_OUTPUT
echo "should_publish=false" >> "$GITHUB_OUTPUT"
else
echo "✓ Version changed - will publish"
echo "should_publish=true" >> $GITHUB_OUTPUT
echo "should_publish=true" >> "$GITHUB_OUTPUT"
fi

publish-python:
Expand All @@ -76,21 +86,21 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: "3.11"

- name: Install build tools
run: |
pip install --upgrade pip
pip install build twine
- uses: astral-sh/setup-uv@v4

- name: Check lockfile
run: uv lock --check

- name: Build Python package
run: python -m build
run: uv build

- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload --skip-existing dist/*
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_USERNAME }}
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: uv publish --check-url https://pypi.org/simple --trusted-publishing never dist/*

create-release:
needs: [check-if-release, publish-python]
Expand Down Expand Up @@ -122,7 +132,7 @@ jobs:

# Read changelog content and escape for JSON
CHANGELOG_CONTENT=$(cat "$CHANGELOG_PATH" | jq -Rs .)
echo "changelog_content=$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
echo "changelog_content=$CHANGELOG_CONTENT" >> "$GITHUB_OUTPUT"

echo "Read changelog from: $CHANGELOG_PATH"

Expand Down Expand Up @@ -232,6 +242,8 @@ jobs:
summary += `- 📝 [Changelog](https://github.com/${context.repo.owner}/${context.repo.repo}/blob/main/changelogs/${currentVersion}-changelog.md)\n\n`;
summary += '### Installation\n\n';
summary += '```bash\n';
summary += `uv pip install neuracore==${currentVersion}\n`;
summary += '# or\n';
summary += `pip install neuracore==${currentVersion}\n`;
summary += '```\n';
} else {
Expand Down
Loading
Loading