v0.9.2 #78
Workflow file for this run
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: Build Wheels | |
| on: | |
| release: | |
| types: [ published ] | |
| workflow_dispatch: # Allow manual triggering | |
| env: | |
| SKIP_INSTALL_NODEJS: '1' | |
| CARGO_INCREMENTAL: '0' | |
| jobs: | |
| # Load shared configuration | |
| config: | |
| uses: ./.github/workflows/config.yml | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| needs: config | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: ${{ fromJson(needs.config.outputs.platforms) }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Set up Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ needs.config.outputs.rust-toolchain }} | |
| # sccache caches individual compilation units via GHA cache API. | |
| # Works on host and inside cibuildwheel's manylinux containers. | |
| # Cache is pre-warmed by the Warm Caches workflow on push to main. | |
| - name: Setup sccache | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| continue-on-error: true | |
| - name: Export GHA cache env vars | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || ''); | |
| core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
| core.exportVariable('ACTIONS_CACHE_SERVICE_V2', process.env.ACTIONS_CACHE_SERVICE_V2 || ''); | |
| # Build guest on host BEFORE cibuildwheel container because: | |
| # - manylinux (AlmaLinux/RHEL) doesn't have musl packages in repos | |
| # - Building musl-cross-make from source takes ~15 minutes | |
| # - Ubuntu host has musl-tools via apt (~30 seconds) | |
| # - Guest is static musl binary, doesn't need manylinux glibc compatibility | |
| # - Shim must be built IN container (needs glibc 2.28 for manylinux) | |
| - name: Build guest binary (Linux only) | |
| if: runner.os == 'Linux' | |
| run: | | |
| make setup:build guest | |
| # Cache only the final binary (11MB), not entire target dir (2.3GB) | |
| # Guest is not rebuilt in container (SKIP_GUEST_BUILD=1), so no incremental compilation needed | |
| GUEST_TARGET=$(scripts/util.sh --target) | |
| mkdir -p ".cache/$GUEST_TARGET/release" | |
| cp "target/$GUEST_TARGET/release/boxlite-guest" ".cache/$GUEST_TARGET/release/" | |
| # Clean up to save disk space (sccache stores compilation cache separately) | |
| rm -rf target ~/.rustup ~/.cargo | |
| mkdir -p target | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.2.0 | |
| env: | |
| CIBW_BUILD_VERBOSITY: 0 | |
| with: | |
| package-dir: sdks/python | |
| - name: Upload wheels as artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: ./wheelhouse/*.whl | |
| retention-days: 7 | |
| test_wheels: | |
| name: Test wheel on ${{ matrix.platform.os }} / Python ${{ matrix.python-version }} | |
| needs: [ config, build_wheels ] | |
| runs-on: ${{ matrix.platform.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| platform: ${{ fromJson(needs.config.outputs.platforms) }} | |
| python-version: ${{ fromJson(needs.config.outputs.python-versions) }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Download wheels | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: wheels-${{ matrix.platform.os }} | |
| path: wheelhouse | |
| - name: Install wheel | |
| run: | | |
| # --no-index ensures wheel has no external dependencies (acts as lint) | |
| pip install --find-links=wheelhouse --no-index boxlite | |
| - name: Test import | |
| run: | | |
| python -c "import boxlite; print(f'BoxLite version: {boxlite.__version__}')" | |
| # Note: Cannot run VM tests on GitHub-hosted runners due to nested virtualization limitations: | |
| # - macOS-15 (ARM): Hypervisor framework not available in virtualized environment | |
| # - ubuntu-latest: KVM not available on standard runners (only on larger paid runners) | |
| # VM execution tests must be run manually on physical hardware or self-hosted runners | |
| publish: | |
| name: Publish to PyPI | |
| needs: [ build_wheels, test_wheels ] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| permissions: | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
| steps: | |
| - name: Download all wheels | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - name: List wheels | |
| run: ls -lh dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ | |
| skip-existing: true | |
| upload_to_release: | |
| name: Upload wheels to GitHub Release | |
| needs: [ build_wheels, test_wheels ] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| permissions: | |
| contents: write # Required to upload to releases | |
| steps: | |
| - name: Download all wheels | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - name: Upload wheels to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/*.whl | |
| fail_on_unmatched_files: true |