build-workflow #1778
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-workflow | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths-ignore: | |
| - "doc/**" | |
| - "html/**" | |
| - "**.md" | |
| - "THANKS" | |
| - "LICENSE" | |
| - "NOTICE" | |
| - "test/**" | |
| - ".github/workflows/e2e-test.yml" | |
| - ".github/workflows/claude.yml" | |
| schedule: | |
| # UTC の 01:00 は JST だと 10:00 。 | |
| # 1-5 で 月曜日から金曜日 | |
| - cron: "0 1 * * 1-5" | |
| jobs: | |
| build-windows: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| name: | |
| - windows_x86_64 | |
| name: Build momo for ${{ matrix.name }} | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: microsoft/setup-msbuild@v2 | |
| - name: Get Versions | |
| run: | | |
| Get-Content "DEPS" | Foreach-Object { | |
| if (!$_) { continue } | |
| $var = $_.Split('=') | |
| New-Variable -Name $var[0] -Value $var[1] -Force | |
| } | |
| echo "cuda_version=${CUDA_VERSION}" >> ${Env:GITHUB_OUTPUT} | |
| id: versions | |
| # CUDA のインストールバイナリのダウンロードは 3GB ぐらいあって、 | |
| # ビルドの度に取得するのはつらいのでキャッシュする | |
| # (インストールする nvcc は解凍後で 100MB 程度なのでキャッシュ可能) | |
| - name: Cache CUDA ${{ steps.versions.outputs.cuda_version }} | |
| id: cache-cuda | |
| uses: actions/cache@v4 | |
| with: | |
| path: _install\windows_x86_64\release\cuda | |
| key: windows-cuda-${{ steps.versions.outputs.cuda_version }}.v1 | |
| - run: echo "${CUDA_VERSION}" > _install\windows_x86_64\release\cuda.version | |
| if: steps.cache-cuda.outputs.cache-hit == 'true' | |
| - run: python3 run.py build --package ${{ matrix.name }} | |
| - name: Get package name | |
| run: | | |
| Get-Content "_package\${{ matrix.name }}\release\momo.env" | Foreach-Object { | |
| if (!$_) { continue } | |
| $var = $_.Split('=') | |
| New-Variable -Name $var[0] -Value $var[1] -Force | |
| } | |
| echo "name=${PACKAGE_NAME}" >> ${Env:GITHUB_OUTPUT} | |
| id: package_name | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ steps.package_name.outputs.name }} | |
| path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }} | |
| - name: Upload Environment | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ matrix.name }}.env | |
| path: _package/${{ matrix.name }}/release/momo.env | |
| build-macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| name: | |
| - macos_arm64 | |
| name: Build momo for ${{ matrix.name }} | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: python3 run.py build --package ${{ matrix.name }} | |
| - name: Get package name | |
| run: | | |
| source _package/${{ matrix.name }}/release/momo.env | |
| echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
| id: package_name | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ steps.package_name.outputs.name }} | |
| path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }} | |
| - name: Upload Environment | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ matrix.name }}.env | |
| path: _package/${{ matrix.name }}/release/momo.env | |
| build-ubuntu: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: ubuntu-24.04_x86_64 | |
| os: ubuntu-24.04 | |
| - name: ubuntu-22.04_x86_64 | |
| os: ubuntu-22.04 | |
| - name: raspberry-pi-os_armv8 | |
| os: ubuntu-22.04 | |
| - name: ubuntu-22.04_armv8_jetson | |
| os: ubuntu-22.04 | |
| name: Build momo for ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Disk cleanup | |
| run: | | |
| set -x | |
| df -h | |
| sudo du -h -d1 /usr/local | |
| sudo du -h -d1 /usr/local/share | |
| sudo du -h -d1 /usr/local/lib | |
| sudo du -h -d1 /usr/share | |
| RMI=`docker images -q -a` | |
| if [ -n "$RMI" ]; then | |
| docker rmi $RMI | |
| fi | |
| # 4.6G | |
| sudo rm -rf /usr/local/.ghcup | |
| # 1.7G | |
| sudo rm -rf /usr/share/swift | |
| # 1.4G | |
| sudo rm -rf /usr/share/dotnet | |
| df -h | |
| - name: Install deps for Jetson and Raspberry Pi OS series | |
| if: matrix.name == 'ubuntu-22.04_armv8_jetson' || matrix.name == 'raspberry-pi-os_armv8' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install multistrap binutils-aarch64-linux-gnu | |
| # multistrap に insecure なリポジトリからの取得を許可する設定を入れる | |
| sudo sed -e 's/Apt::Get::AllowUnauthenticated=true/Apt::Get::AllowUnauthenticated=true";\n$config_str .= " -o Acquire::AllowInsecureRepositories=true/' -i /usr/sbin/multistrap | |
| - uses: shiguredo/github-actions/.github/actions/setup-cuda-toolkit@main | |
| if: matrix.name == 'ubuntu-24.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' | |
| id: cuda | |
| with: | |
| platform: ${{ matrix.os }} | |
| cuda_version: 12.9.1 | |
| - name: Install deps for ${{ matrix.name }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y software-properties-common | |
| # clang-20 | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod a+x llvm.sh | |
| sudo ./llvm.sh 20 | |
| - name: Install deps for ${{ matrix.name }} | |
| if: matrix.name == 'ubuntu-24.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' | |
| run: | | |
| # Intel VPL のために libva-dev, libdrm-dev を入れる | |
| DEBIAN_FRONTEND=noninteractive sudo apt-get -y install libva-dev libdrm-dev | |
| # スクリーンキャプチャあたりのためのパッケージを入れる | |
| DEBIAN_FRONTEND=noninteractive sudo apt-get -y install libxrandr-dev libxdamage-dev libxcomposite-dev libxtst-dev | |
| - run: python3 run.py build --package ${{ matrix.name }} | |
| - name: Get package name | |
| run: | | |
| source _package/${{ matrix.name }}/release/momo.env | |
| echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
| id: package_name | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ steps.package_name.outputs.name }} | |
| path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }} | |
| - name: Upload Environment | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ matrix.name }}.env | |
| path: _package/${{ matrix.name }}/release/momo.env | |
| # E2E テストの実行 | |
| e2e_test: | |
| needs: [build-windows, build-macos, build-ubuntu] | |
| uses: ./.github/workflows/e2e-test.yml | |
| with: | |
| from_build: true | |
| secrets: inherit | |
| create-release: | |
| name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/202') | |
| needs: | |
| - build-windows | |
| - build-macos | |
| - build-ubuntu | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: windows_x86_64 | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: macos_arm64 | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: raspberry-pi-os_armv8 | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: ubuntu-22.04_x86_64 | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: ubuntu-24.04_x86_64 | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: ubuntu-22.04_armv8_jetson | |
| - name: Env to output | |
| run: | | |
| # 改行をスペースに変換してpackage_pathsに設定 | |
| echo "package_paths=$(cat package_paths.env | tr '\n' ' ')" >> $GITHUB_OUTPUT | |
| id: env | |
| - name: Release (Prerelease) | |
| if: contains(github.ref, 'canary') | |
| run: | | |
| gh release create "${{ github.ref_name }}" \ | |
| ${{ steps.env.outputs.package_paths }} \ | |
| --title "${{ github.ref_name }}" \ | |
| --prerelease | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Release (Stable) | |
| if: ${{ !contains(github.ref, 'canary') }} | |
| run: | | |
| gh release create "${{ github.ref_name }}" \ | |
| ${{ steps.env.outputs.package_paths }} \ | |
| --title "${{ github.ref_name }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| notification: | |
| name: Slack Notification | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - build-windows | |
| - build-macos | |
| - build-ubuntu | |
| - e2e_test | |
| - create-release | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: rtCamp/action-slack-notify@v2 | |
| if: | | |
| needs.build-windows.result == 'failure' || | |
| needs.build-macos.result == 'failure' || | |
| needs.build-ubuntu.result == 'failure' || | |
| needs.e2e_test.result == 'failure' || | |
| needs.create-release.result == 'failure' | |
| env: | |
| SLACK_CHANNEL: open-momo | |
| SLACK_COLOR: danger | |
| SLACK_TITLE: Failure build | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |