diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d2ef75..c7f827e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -101,6 +101,78 @@ jobs: path: | sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip + ubuntu-latest-cmake-vulkan: + runs-on: ubuntu-latest + + steps: + - name: Clone + uses: actions/checkout@v6 + with: + submodules: recursive + fetch-depth: 0 + repository: 'leejet/stable-diffusion.cpp' + + - name: Setup Vulkan deps + run: | + sudo apt-get update + sudo apt-get install -y libvulkan-dev spirv-headers + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.15.1 + + - name: Dependencies + id: depends + run: | + sudo apt-get update + sudo apt-get install -y build-essential libgl-dev + + - name: Build + id: cmake_build + run: | + mkdir build + cd build + cmake .. \ + -DSD_VULKAN=ON \ + -DGGML_NATIVE=OFF \ + -DSD_BUILD_SHARED_LIBS=ON + cmake --build . --config Release + + - name: Get commit hash + id: commit + if: ${{ github.event_name == 'schedule' || github.event.inputs.create_release == 'true' }} + uses: prompt/actions-commit-hash@v2 + + - name: Fetch system info + id: system-info + run: | + echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" + echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT" + echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT" + echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" + + - name: Pack artifacts + id: pack_artifacts + if: ${{ github.event_name == 'schedule' || github.event.inputs.create_release == 'true' }} + run: | + cp ggml/LICENSE ./build/bin/ggml.txt + cp LICENSE ./build/bin/stable-diffusion.cpp.txt + zip -j sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-vulkan.zip ./build/bin/* + + - name: Upload artifacts + if: ${{ github.event_name == 'schedule' || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v4 + with: + name: sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-vulkan.zip + path: | + sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-vulkan.zip + ubuntu-latest-cuda: runs-on: ubuntu-22.04 @@ -395,6 +467,8 @@ jobs: include: - build: "avx2" defines: "-DGGML_NATIVE=OFF -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON" + - build: "vulkan" + defines: "-DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF" steps: - name: Clone uses: actions/checkout@v6 @@ -869,6 +943,7 @@ jobs: needs: - ubuntu-latest-cmake + - ubuntu-latest-cmake-vulkan - ubuntu-latest-cuda - ubuntu-arm64-cuda - windows-latest-cuda @@ -966,6 +1041,11 @@ jobs: "artifact/sd-${BRANCH}-${SHORT}-bin-Linux-*-x86_64.zip" \ "artifact/sd-${BRANCH}-${SHORT}-bin-win-avx2-x64.zip" + # Vulkan: same runner as CPU, differs only in -DSD_VULKAN=ON. + # Only builds Linux since the runner doesn't have a dedicated Windows vulkan build. + check_family vulkan \ + "artifact/sd-${BRANCH}-${SHORT}-bin-Linux-*-x86_64-vulkan.zip" + check_family metal \ "artifact/sd-${BRANCH}-${SHORT}-bin-Darwin-arm64-metal.zip" \ "artifact/sd-${BRANCH}-${SHORT}-bin-Darwin-arm64-metal-latest.zip"