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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
174 changes: 174 additions & 0 deletions .github/workflows/experiment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: CI Next Gen
on: [pull_request]

jobs:
# =========================================================
# 1. DISCOVERY
# =========================================================
discover:
runs-on: ubuntu-latest
outputs:
chunks: ${{ steps.chunking.outputs.chunks }}
python_versions: '["3.9", "3.10", "3.11", "3.12", "3.14"]'
steps:
- uses: actions/checkout@v4
- id: changes
uses: tj-actions/changed-files@v44

- id: chunking
env:
CHANGED_FILES: ${{ steps.changes.outputs.all_changed_files }}
run: |
python -c '
import os, json

packages = os.environ.get("CHANGED_FILES", "").split()
NUM_BUCKETS = 20

chunks = [[] for _ in range(NUM_BUCKETS)]
for i, pkg in enumerate(packages):
chunks[i % NUM_BUCKETS].append(pkg)

formatted = [" ".join(chunk) for chunk in chunks if chunk]

with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"chunks={json.dumps(formatted)}\n")
'

# =========================================================
# 2. UNIT TESTS
# =========================================================
unit-tests:
needs: discover
if: ${{ needs.discover.outputs.chunks != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 50
matrix:
chunk: ${{ fromJSON(needs.discover.outputs.chunks) }}
python-version: ${{ fromJSON(needs.discover.outputs.python_versions) }}

name: Unit (Chunk, ${{ matrix.python-version }})
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Run Unit Tests
run: |
export NOX_DEFAULT_VENV_BACKEND=uv
FAILED=0
for pkg in ${{ matrix.chunk }}; do
echo "::group::Testing $pkg"
cd $pkg
uvx --with 'nox[uv]' nox -s "unit-${{ matrix.python-version }}" || FAILED=1
cd $GITHUB_WORKSPACE
echo "::endgroup::"
done
exit $FAILED

# =========================================================
# 3. LINT
# =========================================================
lint:
needs: discover
if: ${{ needs.discover.outputs.chunks != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 20
matrix:
chunk: ${{ fromJSON(needs.discover.outputs.chunks) }}

name: Lint (Chunk)
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.14"
enable-cache: true

- name: Run Lint
run: |
export NOX_DEFAULT_VENV_BACKEND=uv
FAILED=0
for pkg in ${{ matrix.chunk }}; do
echo "::group::Linting $pkg"
cd $pkg
uvx --with 'nox[uv]' nox -s "lint" || FAILED=1
cd $GITHUB_WORKSPACE
echo "::endgroup::"
done
exit $FAILED

# =========================================================
# 4. DOCS
# =========================================================
docs:
needs: discover
if: ${{ needs.discover.outputs.chunks != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 20
matrix:
chunk: ${{ fromJSON(needs.discover.outputs.chunks) }}

name: Docs (Chunk)
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.14"
enable-cache: true

- name: Run Docs
run: |
export NOX_DEFAULT_VENV_BACKEND=uv
FAILED=0
for pkg in ${{ matrix.chunk }}; do
echo "::group::Docs for $pkg"
cd $pkg
uvx --with 'nox[uv]' nox -s "docs" || FAILED=1
cd $GITHUB_WORKSPACE
echo "::endgroup::"
done
exit $FAILED

# =========================================================
# 5. CORE DEPENDENCIES
# =========================================================
core-deps:
needs: discover
if: ${{ needs.discover.outputs.chunks != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 50
matrix:
chunk: ${{ fromJSON(needs.discover.outputs.chunks) }}
python-version: ${{ fromJSON(needs.discover.outputs.python_versions) }}

name: Core Deps (Chunk, ${{ matrix.python-version }})
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Run Core Deps
run: |
export NOX_DEFAULT_VENV_BACKEND=uv
FAILED=0
for pkg in ${{ matrix.chunk }}; do
echo "::group::Core Deps Testing $pkg"
cd $pkg
uvx --with 'nox[uv]' nox -s "core_deps_from_source" -p "${{ matrix.python-version }}" || FAILED=1
cd $GITHUB_WORKSPACE
echo "::endgroup::"
done
exit $FAILED
Loading
Loading