Repository navigation
Test iOS host-buffer validation gate and clarify error wording (#44 follow-up) #80
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: Validate | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| tools: | |
| name: tools (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # macOS runs the Mach-O import audit tests that other hosts skip. | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # The wrapper tests compile against upstream's and ggml's headers. | |
| submodules: recursive | |
| - name: Fetch exact historical source controls | |
| # checkout may initialize shallow submodules. These immutable objects | |
| # supply the old ABI and per-carry allocator negatives; never fetch | |
| # a moving branch or silently skip them when absent. | |
| run: | | |
| git -C third_party/stable-diffusion.cpp fetch --depth=1 origin be486498eadc29dc3cd234d944c2180ed42b1415 | |
| git -C third_party/stable-diffusion.cpp/ggml fetch --depth=1 origin a5915eb0e47adef21c3f25b889a008925ea838c2 | |
| - run: python3 -m unittest discover -s tests -v | |
| dart-vm: | |
| name: dart vm (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| # Pinned: the harness expects this VM's aborts in its controls. | |
| sdk: 3.13.5 | |
| - name: Report progress while the Dart VM shuts down | |
| run: python3 -m unittest discover -s tests -p test_progress_stress.py -v | |
| env: | |
| SD_REQUIRE_DART: "1" | |
| SD_PROGRESS_STRESS_RUNS: "25" | |
| exit-teardown: | |
| name: exit teardown (${{ matrix.runtime }}) | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # The runtime as shipped, and one in which a use after free aborts. | |
| - { runtime: release, sanitizer: "" } | |
| - { runtime: address sanitizer, sanitizer: address } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: ./.github/actions/setup-toolchain | |
| with: | |
| target: macos-arm64 | |
| - uses: dart-lang/setup-dart@v1 | |
| if: ${{ !matrix.sanitizer }} | |
| with: | |
| sdk: 3.13.5 | |
| - name: Build | |
| if: ${{ !matrix.sanitizer }} | |
| run: python3 tools/build.py build --target macos-arm64 | |
| - name: Free tracked contexts at exit | |
| # With a sanitizer the test builds its own runtime, which the Dart VM | |
| # cannot load. The model is written by the test; nothing is | |
| # downloaded. | |
| run: python3 -m unittest discover -s tests -p test_exit_teardown_runtime.py -v | |
| env: | |
| SD_REQUIRE_RUNTIME: "1" | |
| SD_REQUIRE_DART: ${{ !matrix.sanitizer && '1' || '' }} | |
| SD_EXIT_TEARDOWN_SANITIZER: ${{ matrix.sanitizer }} | |
| SD_EXIT_TEARDOWN_RUNS: "3" | |
| linux-asan-native: | |
| name: exit teardown (Linux native address sanitizer) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 25 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: ./.github/actions/setup-toolchain | |
| with: | |
| target: linux-x64 | |
| - name: Verify the existing GCC floor | |
| run: | | |
| test "$(g++ -dumpversion | cut -d. -f1)" -ge 13 | |
| g++ --version | |
| - name: Run the native ASan shutdown matrix | |
| # The test builds its ASan runtime and generated fixture, then runs | |
| # every Linux native scenario. Missing runtime/build/checks fail. | |
| # Sanitized Dart and Apple-only tests explicitly skip; ordinary Dart | |
| # stays in the separate Linux release-runtime build lane below. | |
| run: python3 -B -m unittest discover -s tests -p test_exit_teardown_runtime.py -v | |
| env: | |
| SD_EXIT_TEARDOWN_TARGET: linux-x64 | |
| SD_EXIT_TEARDOWN_SANITIZER: address | |
| SD_EXIT_TEARDOWN_RUNS: "1" | |
| SD_REQUIRE_RUNTIME: "1" | |
| CMAKE_BUILD_PARALLEL_LEVEL: "4" | |
| build: | |
| name: build (${{ matrix.target }}) | |
| runs-on: ${{ matrix.runs_on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { target: macos-arm64, runs_on: macos-latest, smoke: "--expect-device CPU" } | |
| - { target: macos-x64, runs_on: macos-latest } | |
| - { target: ios-arm64, runs_on: macos-latest } | |
| - { target: ios-arm64-sim, runs_on: macos-latest } | |
| - { target: ios-x64-sim, runs_on: macos-latest } | |
| - { target: android-arm64, runs_on: ubuntu-latest } | |
| - { target: linux-x64, runs_on: ubuntu-24.04, smoke: "--expect-device CPU" } | |
| - { target: linux-x64-vulkan, runs_on: ubuntu-24.04, smoke: "--expect-device Vulkan" } | |
| - { target: windows-x64, runs_on: windows-2022, smoke: "--expect-device CPU" } | |
| - { target: windows-x64-vulkan, runs_on: windows-2022, smoke: "--expect-device CPU" } | |
| steps: | |
| - name: Enable long Git paths on the Windows runner | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| # CUTLASS exceeds MAX_PATH during recursive checkout, before CMake's | |
| # short build paths apply. System scope survives checkout's temporary | |
| # HOME and affects only this disposable hosted runner. | |
| run: git config --system core.longpaths true | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: ./.github/actions/setup-toolchain | |
| with: | |
| target: ${{ matrix.target }} | |
| - name: Build | |
| shell: bash | |
| run: python tools/build.py build --target ${{ matrix.target }} | |
| env: | |
| ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_LATEST_HOME }} | |
| - name: Validate exports and dependencies | |
| shell: bash | |
| run: python tools/validate_artifacts.py ${{ matrix.target }} | |
| env: | |
| ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_LATEST_HOME }} | |
| - name: Load and list devices | |
| # Linux Vulkan runs on Mesa lavapipe (software): functional check only. | |
| if: matrix.smoke | |
| shell: bash | |
| run: python tools/smoke_test.py ${{ matrix.target }} ${{ matrix.smoke }} | |
| env: | |
| # ggml skips CPU-type Vulkan devices such as lavapipe unless listed. | |
| GGML_VK_VISIBLE_DEVICES: "0" | |
| - name: Check the context defaults and conversion ABI | |
| if: runner.os != 'Windows' && matrix.smoke | |
| run: python3 -m unittest discover -s tests -p test_runtime_api.py -v | |
| env: | |
| SD_RUNTIME_API_TARGET: ${{ matrix.target }} | |
| SD_REQUIRE_RUNTIME: "1" | |
| - name: Generate from FP8 weights | |
| # Metal needs a Mac: GitHub's macOS runners list no Metal device. | |
| if: runner.os != 'Windows' && matrix.smoke | |
| run: python3 -m unittest discover -s tests -p test_fp8_runtime.py -v | |
| env: | |
| SD_FP8_TARGET: ${{ matrix.target }} | |
| SD_REQUIRE_RUNTIME: "1" | |
| GGML_VK_VISIBLE_DEVICES: "0" | |
| - name: Split graph evaluation | |
| # Metal needs a Mac: GitHub's macOS runners list no Metal device. | |
| if: runner.os != 'Windows' && matrix.smoke | |
| run: python3 -m unittest discover -s tests -p test_graph_split_runtime.py -v | |
| env: | |
| SD_GRAPH_SPLIT_TARGET: ${{ matrix.target }} | |
| SD_REQUIRE_RUNTIME: "1" | |
| GGML_VK_VISIBLE_DEVICES: "0" | |
| - name: Check loader scratch memory | |
| # Metal needs a Mac: GitHub's macOS runners list no Metal device. | |
| if: runner.os == 'macOS' && matrix.smoke | |
| run: python3 -m unittest discover -s tests -p test_loader_scratch_runtime.py -v | |
| env: | |
| SD_REQUIRE_RUNTIME: "1" | |
| - uses: dart-lang/setup-dart@v1 | |
| if: runner.os == 'Linux' && matrix.smoke | |
| - name: Verify cooperative host shutdown | |
| # On Linux the host joins workers before exit(). The scenarios pass on the | |
| # CPU; the Vulkan target's on lavapipe are reported. | |
| if: runner.os == 'Linux' && matrix.smoke | |
| run: python3 -m unittest discover -s tests -p test_exit_teardown_runtime.py -v | |
| env: | |
| SD_EXIT_TEARDOWN_TARGET: ${{ matrix.target }} | |
| SD_EXIT_TEARDOWN_RUNS: "3" | |
| SD_REQUIRE_RUNTIME: "1" | |
| SD_REQUIRE_DART: "1" | |
| GGML_VK_VISIBLE_DEVICES: "0" | |
| - uses: actions/upload-artifact@v4 | |
| if: runner.os == 'macOS' | |
| with: | |
| name: bin-${{ matrix.target }} | |
| path: bin/${{ matrix.target }} | |
| if-no-files-found: error | |
| apple-xcframework: | |
| needs: build | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: bin-* | |
| path: artifacts | |
| - name: Stage payloads | |
| run: | | |
| for dir in artifacts/bin-*; do | |
| mkdir -p "bin/${dir#artifacts/bin-}" | |
| cp -R "$dir"/. "bin/${dir#artifacts/bin-}/" | |
| done | |
| - name: Build and validate the XCFramework | |
| run: python3 tools/apple_xcframework.py build --tag v0.0.0 --dist dist | |
| - name: Validate the XCFramework privacy manifests | |
| run: >- | |
| python3 tools/apple_privacy_manifest.py --audit-imports | |
| dist/stable-diffusion-native-apple-xcframework-v0.0.0.zip | |
| - name: Link the XCFramework into a SwiftPM consumer | |
| run: python3 tools/apple_xcframework.py consumer dist/stable-diffusion-native-apple-xcframework-v0.0.0.zip |