From 5739a24808b3180b57e92c728312bb9db30c2ba7 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 27 Jul 2026 20:43:28 +1000 Subject: [PATCH] CI: make the Autodesk connector workflow a test gate, ship it on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three related cleanups to how the bonsaiviewer-autodesk connector is built and shipped. build-bonsaiviewer-autodesk.yml no longer builds a bundle. Its four-runner matrix produced autodesk--.zip artifacts that nothing consumed — shipping happens in the platform pipelines, which each invoke packaging/build.py themselves. What is left is the crate's only lint and test coverage, so the workflow is renamed to match what it does and a header comment records where the shipped binary actually comes from. build_osx.yml now builds and bundles the connector, which it never did: macOS users have been getting a Bonsai Viewer with no Autodesk connector at all. ConnectorDiscovery resolves applicationDirPath()/connectors, which inside a bundle is Contents/MacOS, so that is where the folder lands. The tkinter probes in the Windows and Linux workflows are dropped. They guarded the old PyInstaller connector's Tk GUI (de7520418) and have been dead since the Rust rewrite (9d9f4054f); python3.11-tkinter goes with them. Co-Authored-By: Claude Opus 5 --- .../workflows/build-bonsaiviewer-autodesk.yml | 59 ++----------------- .github/workflows/build_osx.yml | 21 ++++++- .github/workflows/build_rocky.yml | 3 +- .github/workflows/build_rocky_arm.yml | 3 +- .github/workflows/build_win.yml | 7 +-- 5 files changed, 29 insertions(+), 64 deletions(-) diff --git a/.github/workflows/build-bonsaiviewer-autodesk.yml b/.github/workflows/build-bonsaiviewer-autodesk.yml index f91a163088..20de1a80c0 100644 --- a/.github/workflows/build-bonsaiviewer-autodesk.yml +++ b/.github/workflows/build-bonsaiviewer-autodesk.yml @@ -1,4 +1,9 @@ -name: Build Bonsai Viewer Autodesk Connector +# Lint/test gate for the bonsaiviewer-autodesk crate — nothing here ships. +# The connector binary that reaches users is built by the platform pipelines +# (build_rocky.yml, build_rocky_arm.yml, build_win.yml, build_osx.yml), each +# of which runs packaging/build.py itself and bundles dist/autodesk/ into the +# Bonsai Viewer archive. +name: Test Bonsai Viewer Autodesk Connector on: workflow_dispatch: @@ -39,55 +44,3 @@ jobs: - name: cargo test run: cargo test --all-features - - build: - name: ${{ matrix.os_label }}-${{ matrix.arch }} - needs: test - runs-on: ${{ matrix.runner }} - strategy: - fail-fast: false - matrix: - include: - # Linux: build on the oldest reasonable glibc (Ubuntu 22.04 / glibc - # 2.35) so the bundle runs on older distributions. - - os_label: linux - arch: x86_64 - runner: ubuntu-22.04 - # macOS Apple Silicon. - - os_label: macos - arch: arm64 - runner: macos-14 - # macOS Intel. macos-13 is the last Intel runner GitHub provides. - - os_label: macos - arch: x86_64 - runner: macos-13 - # Windows x86_64. - - os_label: windows - arch: x86_64 - runner: windows-latest - - defaults: - run: - working-directory: src/bonsaiviewer-autodesk - - steps: - - uses: actions/checkout@v6 - - - uses: dtolnay/rust-toolchain@stable - - - uses: Swatinem/rust-cache@v2 - with: - workspaces: src/bonsaiviewer-autodesk - - # python3 is the runner default on all four hosts; packaging/build.py - # only uses stdlib (subprocess, shutil, zipfile, pathlib, platform), - # no pip-installable deps. - - name: Build connector bundle - run: python3 packaging/build.py - - - name: Upload connector zip - uses: actions/upload-artifact@v7 - with: - name: autodesk-${{ matrix.os_label }}-${{ matrix.arch }} - path: src/bonsaiviewer-autodesk/dist/autodesk-${{ matrix.os_label }}-${{ matrix.arch }}.zip - if-no-files-found: error diff --git a/.github/workflows/build_osx.yml b/.github/workflows/build_osx.yml index fd94c02d30..8debff8b3c 100644 --- a/.github/workflows/build_osx.yml +++ b/.github/workflows/build_osx.yml @@ -48,6 +48,12 @@ jobs: # Mac is using bison 2.5 by default, but we need 3.5+ for swig. echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + # The bonsaiviewer-autodesk connector is a Rust crate; the "Package + # .zip archives" step below runs `cargo build --release` via + # packaging/build.py. Match the dedicated connector workflow's stable + # toolchain, rather than whatever Rust the runner image happens to ship. + - uses: dtolnay/rust-toolchain@stable + - name: Install aws cli run: | python -m pip install awscli @@ -127,6 +133,13 @@ jobs: - name: Package .zip archives run: | VERSION=v`cat VERSION` + # packaging/build.py stages the connector binary + connector.json + # into dist/autodesk/; the .app loop below copies that folder into + # the bundle. Same on-disk shape as the Linux and Windows builds. + python3 src/bonsaiviewer-autodesk/packaging/build.py + autodesk_connector_dir="$PWD/src/bonsaiviewer-autodesk/dist/autodesk" + test -d "$autodesk_connector_dir" + cd ./build/`uname`/*/10.15/install/ifcopenshell mkdir -p ~/output install_root="$PWD" @@ -180,9 +193,15 @@ jobs: # root because their install rule uses `BUNDLE DESTINATION "."` — # that's the layout Qt's macdeployqt expects. macdeployqt has # already embedded the Qt frameworks inside each bundle during - # install/strip, so we zip the .app as-is. + # install/strip, so the only thing left to stage is the connector. find "$install_root" -maxdepth 1 -type d -name "*.app" | while read app_path; do app=`basename "$app_path" .app` + if [ "$app" = "BonsaiViewer" ]; then + # ConnectorDiscovery looks in applicationDirPath()/connectors, + # which for a bundle is Contents/MacOS. + mkdir -p "$app_path/Contents/MacOS/connectors" + cp -a "$autodesk_connector_dir" "$app_path/Contents/MacOS/connectors/" + fi pushd "$install_root" > /dev/null zip -qq -r "$HOME/output/${app}-${VERSION}-${GITHUB_SHA:0:7}-macos${{ matrix.oldarch }}64.zip" "$(basename "$app_path")" popd > /dev/null diff --git a/.github/workflows/build_rocky.yml b/.github/workflows/build_rocky.yml index 655d2d6cf7..aad496678d 100644 --- a/.github/workflows/build_rocky.yml +++ b/.github/workflows/build_rocky.yml @@ -28,13 +28,12 @@ jobs: sqlite-devel bzip2-devel zlib-devel openssl-devel xz-devel \ readline-devel ncurses-devel libffi-devel libuuid-devel git-lfs \ findutils xz byacc patchelf libxkbcommon-devel \ - python3.11 python3.11-pip python3.11-tkinter \ + python3.11 python3.11-pip \ dbus-devel \ libXext-devel libXinerama-devel libXcursor-devel libXrender-devel \ libXfixes-devel libXft-devel pango-devel cairo-devel libstdc++-static python3 -m pip install aqtinstall git config --global --add safe.directory '*' - python3.11 -c "import tkinter; print('Tk', tkinter.TkVersion)" - name: Install Rust # The bonsaiviewer-autodesk connector is a Rust crate; the "Package diff --git a/.github/workflows/build_rocky_arm.yml b/.github/workflows/build_rocky_arm.yml index 3d597294ff..adfe9865f5 100644 --- a/.github/workflows/build_rocky_arm.yml +++ b/.github/workflows/build_rocky_arm.yml @@ -40,12 +40,11 @@ jobs: sqlite-devel bzip2-devel zlib-devel openssl-devel xz-devel \ readline-devel ncurses-devel libffi-devel libuuid-devel git-lfs \ findutils xz byacc patchelf libxkbcommon-devel \ - python3-tkinter dbus-devel \ + dbus-devel \ libXext-devel libXinerama-devel libXcursor-devel libXrender-devel \ libXfixes-devel libXft-devel pango-devel cairo-devel libstdc++-static python3 -m pip install aqtinstall git config --global --add safe.directory '*' - python3 -c "import tkinter; print('Tk', tkinter.TkVersion)" - name: Install Rust # The bonsaiviewer-autodesk connector is a Rust crate; the "Package diff --git a/.github/workflows/build_win.yml b/.github/workflows/build_win.yml index 06a3e2bad3..60edf94528 100644 --- a/.github/workflows/build_win.yml +++ b/.github/workflows/build_win.yml @@ -68,16 +68,11 @@ jobs: with: python-version: '3.12' - # The connector's PyInstaller bundle embeds a tkinter GUI; verify Tk is - # present so a missing-tk regression fails here, not inside the build. - - name: Verify tkinter is available - run: python -c "import tkinter; print('Tk', tkinter.TkVersion)" - # Build the Autodesk connector before the C++ build: build-all-win.py # bundles it next to BonsaiViewer.exe while archiving the executables. # bonsaiviewer-autodesk is a Rust connector; packaging/build.py runs # `cargo build --release` and stages the binary + connector.json into - # dist/autodesk/ — same layout the old PyInstaller flow produced. + # dist/autodesk/. - name: Build Autodesk connector working-directory: src/bonsaiviewer-autodesk run: python packaging/build.py