docs: voice.md docstrings for the undocumented public surface #134
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SDK Wheels | |
| on: | |
| push: | |
| paths: | |
| - 'sdk/**' | |
| - 'sdk-abi/**' | |
| - 'shield-swap-sdk/**' | |
| - '.github/workflows/sdk-wheels.yml' | |
| - '.github/workflows/sdk.yml' | |
| branches: | |
| - main | |
| - master | |
| tags: | |
| - '*' | |
| pull_request: | |
| paths: | |
| - 'sdk/**' | |
| - 'sdk-abi/**' | |
| - 'shield-swap-sdk/**' | |
| - '.github/workflows/sdk-wheels.yml' | |
| - '.github/workflows/sdk.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # The crate is abi3-py37, so each platform needs exactly one wheel that works | |
| # on every CPython >= 3.7. 32-bit targets (i686/x86) are deliberately dropped: | |
| # snarkvm 4.x and its aws-lc-sys dependency do not support them. | |
| jobs: | |
| tests: | |
| uses: ./.github/workflows/sdk.yml | |
| build: | |
| name: build (${{ matrix.platform.name }}) | |
| needs: [tests] | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: linux-x86_64 | |
| runner: ubuntu-latest | |
| target: x86_64 | |
| - name: linux-aarch64 | |
| # native arm runner — avoids cross-compiling aws-lc-sys C code | |
| runner: ubuntu-24.04-arm | |
| target: aarch64 | |
| - name: macos-x86_64 | |
| runner: macos-15-intel | |
| target: x86_64 | |
| - name: macos-aarch64 | |
| runner: macos-latest | |
| target: aarch64 | |
| - name: windows-x64 | |
| runner: windows-latest | |
| target: x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| # Build the mainnet extension module wheel. | |
| - name: Build mainnet wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| # Run from sdk/ so cargo picks up sdk/.cargo/config.toml (macOS | |
| # needs its dynamic_lookup link flags; cargo resolves config from | |
| # the working directory, not the manifest path). | |
| working-directory: ./sdk | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --features mainnet | |
| sccache: 'true' | |
| manylinux: ${{ startsWith(matrix.platform.name, 'linux') && '2_28' || 'auto' }} | |
| # The manylinux container needs git (snarkvm is a git dependency) | |
| # and cmake + a C toolchain (aws-lc-sys builds C sources). | |
| before-script-linux: | | |
| if command -v dnf &> /dev/null; then | |
| dnf install -y git cmake clang | |
| elif command -v yum &> /dev/null; then | |
| yum install -y git cmake3 clang && ln -sf "$(command -v cmake3)" /usr/local/bin/cmake | |
| fi | |
| # maturin emits one cdylib per invocation (named by pyproject | |
| # module-name). Build a second wheel for the testnet extension module with | |
| # module-name overridden to aleo._aleolib_testnet. | |
| - name: Override module-name for testnet build | |
| shell: bash | |
| run: | | |
| cp sdk/pyproject.toml sdk/pyproject.toml.mainnet.bak | |
| sed -i.bak 's/module-name = "aleo._aleolib_mainnet"/module-name = "aleo._aleolib_testnet"/' sdk/pyproject.toml | |
| - name: Build testnet wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: ./sdk | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist-testnet --no-default-features --features testnet | |
| sccache: 'true' | |
| manylinux: ${{ startsWith(matrix.platform.name, 'linux') && '2_28' || 'auto' }} | |
| before-script-linux: | | |
| if command -v dnf &> /dev/null; then | |
| dnf install -y git cmake clang | |
| elif command -v yum &> /dev/null; then | |
| yum install -y git cmake3 clang && ln -sf "$(command -v cmake3)" /usr/local/bin/cmake | |
| fi | |
| # Splice the testnet .so into the mainnet wheel -> one two-network wheel. | |
| - name: Merge testnet module into wheel | |
| shell: bash | |
| run: | | |
| mv sdk/pyproject.toml.mainnet.bak sdk/pyproject.toml | |
| # The manylinux build runs in a Docker container that writes sdk/dist | |
| # and sdk/dist-testnet as root; this step runs on the host as the | |
| # runner user, so reclaim ownership before repacking the wheel | |
| # (Linux only — native macOS/Windows builds are already runner-owned). | |
| if [ "$RUNNER_OS" = "Linux" ]; then | |
| sudo chown -R "$(id -u):$(id -g)" sdk/dist sdk/dist-testnet | |
| fi | |
| python .github/scripts/merge_testnet_so.py sdk/dist sdk/dist-testnet | |
| # Every runner here matches its wheel's platform, so install and smoke | |
| # test the actual artifact — importing BOTH networks — before it ships. | |
| # Install by path: --find-links also consults PyPI, and once this | |
| # version is published there pip may prefer the PyPI wheel over the | |
| # one just built (tag-order tie on macOS/Windows). | |
| - name: Smoke test wheel | |
| shell: bash | |
| run: | | |
| pip install sdk/dist/aleo_sdk-*.whl | |
| python -c " | |
| from aleo.mainnet import PrivateKey as MainnetPrivateKey | |
| from aleo.testnet import PrivateKey as TestnetPrivateKey | |
| import aleo.mainnet as mainnet | |
| import aleo.testnet as testnet | |
| mpk = MainnetPrivateKey.random() | |
| tpk = TestnetPrivateKey.random() | |
| assert str(mpk).startswith('APrivateKey1') | |
| assert str(mpk.address).startswith('aleo1') | |
| assert str(tpk.address).startswith('aleo1') | |
| assert mainnet.Network.id() == 0 | |
| assert testnet.Network.id() == 1 | |
| print('two-network wheel ok:', mpk.address, tpk.address) | |
| " | |
| - name: Upload wheel | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.platform.name }} | |
| path: sdk/dist | |
| build-abi: | |
| name: abi-build (${{ matrix.platform.name }}) | |
| needs: [tests] | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: linux-x86_64 | |
| runner: ubuntu-latest | |
| target: x86_64 | |
| - name: linux-aarch64 | |
| runner: ubuntu-24.04-arm | |
| target: aarch64 | |
| - name: macos-x86_64 | |
| runner: macos-15-intel | |
| target: x86_64 | |
| - name: macos-aarch64 | |
| runner: macos-latest | |
| target: aarch64 | |
| - name: windows-x64 | |
| runner: windows-latest | |
| target: x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Build wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: ./sdk-abi | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| sccache: 'true' | |
| manylinux: ${{ startsWith(matrix.platform.name, 'linux') && '2_28' || 'auto' }} | |
| before-script-linux: | | |
| if command -v dnf &> /dev/null; then | |
| dnf install -y git cmake clang | |
| elif command -v yum &> /dev/null; then | |
| yum install -y git cmake3 clang && ln -sf "$(command -v cmake3)" /usr/local/bin/cmake | |
| fi | |
| - name: Smoke test wheel | |
| shell: bash | |
| run: | | |
| pip install sdk-abi/dist/*.whl | |
| python -c "import aleo_abi; print(aleo_abi.generate_abi.__name__)" | |
| - name: Upload wheel | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: abi-wheels-${{ matrix.platform.name }} | |
| path: sdk-abi/dist | |
| sdist: | |
| needs: [tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: ./sdk | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: sdk/dist | |
| sdist-abi: | |
| needs: [tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| working-directory: ./sdk-abi | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: abi-wheels-sdist | |
| path: sdk-abi/dist | |
| # shield-swap-sdk is pure Python (hatchling): one universal wheel + sdist. | |
| # Depends on the built aleo-sdk wheel so its hermetic suite runs against | |
| # the exact artifact shipping in this release, not a PyPI version. | |
| build-shield-swap: | |
| name: shield-swap-build | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: wheels-linux-x86_64 | |
| path: sdk-dist | |
| - name: Build wheel + sdist | |
| run: | | |
| pip install build | |
| python -m build shield-swap-sdk --outdir shield-swap-sdk/dist | |
| - name: Test against the built aleo-sdk wheel | |
| run: | | |
| pip install sdk-dist/aleo_sdk-*.whl | |
| pip install "$(ls shield-swap-sdk/dist/*.whl)[async,mcp]" pytest pytest-asyncio | |
| cd shield-swap-sdk && python -m pytest | |
| - name: AGENTS.md up to date | |
| run: python shield-swap-sdk/codegen/gen_context.py --check | |
| # Prove the installed wheel imports on its own, away from the source tree. | |
| - name: Smoke test wheel | |
| run: | | |
| cd "$RUNNER_TEMP" | |
| python -c "import aleo_shield_swap; print('shield-swap-sdk', aleo_shield_swap.__version__)" | |
| python -m aleo_shield_swap | head -1 # packaged agent guide | |
| - name: Upload wheel | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: shield-swap-wheels-universal | |
| path: shield-swap-sdk/dist | |
| # Publishing uses PyPI trusted publishing (OIDC) — no token secret. Each | |
| # package has its own job because a pending publisher must be unique per | |
| # (repo, workflow, environment): the job's environment name must exactly | |
| # match the publisher registered on PyPI for that project. All three gate | |
| # on every build job, and they release strictly in dependency order: | |
| # abi -> sdk -> shield-swap (shield-swap-sdk requires aleo-sdk on PyPI). | |
| release-abi: | |
| name: Release aleo-contract-abi-generator | |
| runs-on: ubuntu-latest | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| needs: [build, sdist, build-abi, sdist-abi, build-shield-swap] | |
| environment: pypi-abi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: 'abi-wheels-*' | |
| merge-multiple: true | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist | |
| skip-existing: true | |
| release-sdk: | |
| name: Release aleo-sdk | |
| runs-on: ubuntu-latest | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| needs: [build, sdist, build-abi, sdist-abi, build-shield-swap, release-abi] | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: 'wheels-*' | |
| merge-multiple: true | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist | |
| skip-existing: true | |
| release-shield-swap: | |
| name: Release shield-swap-sdk | |
| runs-on: ubuntu-latest | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| needs: [build, sdist, build-abi, sdist-abi, build-shield-swap, release-sdk] | |
| environment: pypi-shield-swap | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: 'shield-swap-wheels-*' | |
| merge-multiple: true | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist | |
| skip-existing: true |