wip #507
Workflow file for this run
This file contains 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: | |
push: | |
paths-ignore: | |
- 'doc/**' | |
- '**.md' | |
- 'LICENSE' | |
- 'NOTICE' | |
jobs: | |
build-windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
name: | |
- windows_x86_64 | |
name: Build sora-cpp-sdk for ${{ matrix.name }} | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: microsoft/[email protected] | |
- name: Env to output | |
run: | | |
echo "userprofile=${Env:USERPROFILE}" >> ${Env:GITHUB_OUTPUT} | |
echo "username=${Env:USERNAME}" >> ${Env:GITHUB_OUTPUT} | |
id: env | |
- name: Bazel cache (cache) | |
uses: actions/cache@v3 | |
with: | |
path: "${{ steps.env.outputs.userprofile }}/_bazel_${{ steps.env.outputs.username }}/cache" | |
key: bazel-cache-${{ matrix.name }}-v1 | |
- name: Bazel cache (install) | |
uses: actions/cache@v3 | |
with: | |
path: "${{ steps.env.outputs.userprofile }}/_bazel_${{ steps.env.outputs.username }}/install" | |
key: bazel-install-${{ matrix.name }}-v1 | |
- name: Get Versions | |
run: | | |
Get-Content "VERSION" | 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 NVCC ${{ steps.versions.outputs.cuda_version }} | |
id: cache-cuda | |
uses: actions/cache@v3 | |
with: | |
path: _install\windows_x86_64\release\cuda\nvcc | |
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: pip install numpy | |
- run: python3 run.py --test --package ${{ matrix.name }} | |
env: | |
SORA_CPP_SDK_TEMP_DIR: C:\ | |
- name: Get package name | |
run: | | |
Get-Content "_package\${{ matrix.name }}\release\sora.env" | Foreach-Object { | |
if (!$_) { continue } | |
$var = $_.Split('=') | |
New-Variable -Name $var[0] -Value $var[1] -Force | |
} | |
echo "name=${PACKAGE_NAME}" >> ${Env:GITHUB_OUTPUT} | |
echo "boost_name=${BOOST_PACKAGE_NAME}" >> ${Env:GITHUB_OUTPUT} | |
echo "lyra_name=${LYRA_PACKAGE_NAME}" >> ${Env:GITHUB_OUTPUT} | |
id: package_name | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }} | |
- name: Upload Boost Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.boost_name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.boost_name }} | |
- name: Upload Lyra Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.lyra_name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.lyra_name }} | |
- name: Upload Environment | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }}.env | |
path: _package/${{ matrix.name }}/release/sora.env | |
build-macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
name: | |
- macos_arm64 | |
- ios | |
name: Build sora-cpp-sdk for ${{ matrix.name }} | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Env to output | |
run: | | |
echo "user=`users`" >> $GITHUB_OUTPUT | |
id: env | |
- name: Bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: "/private/var/tmp/_bazel_${{ steps.env.outputs.user }}" | |
key: bazel-${{ matrix.name }}-v2 | |
- run: pip3 install numpy | |
- run: python3 run.py --test --package ${{ matrix.name }} | |
- name: Get package name | |
run: | | |
source _package/${{ matrix.name }}/release/sora.env | |
echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
echo "boost_name=${BOOST_PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
echo "lyra_name=${LYRA_PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
id: package_name | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }} | |
- name: Upload Boost Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.boost_name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.boost_name }} | |
- name: Upload Lyra Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.lyra_name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.lyra_name }} | |
- name: Upload Environment | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }}.env | |
path: _package/${{ matrix.name }}/release/sora.env | |
build-ubuntu: | |
strategy: | |
fail-fast: false | |
matrix: | |
name: | |
- ubuntu-20.04_x86_64 | |
- ubuntu-22.04_x86_64 | |
- ubuntu-20.04_armv8_jetson | |
- android | |
name: Build sora-cpp-sdk for ${{ matrix.name }} | |
runs-on: ${{ matrix.name == 'ubuntu-22.04_x86_64' && 'ubuntu-22.04' || 'ubuntu-20.04' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel-${{ matrix.name }}-v1 | |
- name: Install deps for ${{ matrix.name }} | |
if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' | |
run: | | |
source VERSION | |
# clang-12 と CUDA を入れる | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common | |
# CUDA 10 なので ubuntu1804 で正しい | |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin | |
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub | |
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" | |
sudo apt-get update | |
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION clang-12 | |
# Intel Media SDK のために libva-dev, libdrm-dev を入れる | |
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install libva-dev libdrm-dev | |
- name: Install deps for Jetson series | |
if: matrix.name == 'ubuntu-20.04_armv8_jetson' | |
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 | |
# Lyra ビルドのためにクロスコンパイル環境一式を入れる | |
sudo apt-get -y install libstdc++-9-dev-arm64-cross gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
- name: Install deps for Android | |
if: matrix.name == 'android' | |
run: | | |
sudo apt-get -y install ninja-build | |
- name: Setup Android SDK | |
uses: android-actions/[email protected] | |
if: matrix.name == 'android' | |
- run: pip3 install numpy | |
- run: python3 run.py --test --package ${{ matrix.name }} | |
- name: Get package name | |
run: | | |
source _package/${{ matrix.name }}/release/sora.env | |
echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
echo "boost_name=${BOOST_PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
echo "lyra_name=${LYRA_PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
id: package_name | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }} | |
- name: Upload Boost Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.boost_name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.boost_name }} | |
- name: Upload Lyra Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.package_name.outputs.lyra_name }} | |
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.lyra_name }} | |
- name: Upload Environment | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }}.env | |
path: _package/${{ matrix.name }}/release/sora.env | |
create-release: | |
name: Create Release | |
if: contains(github.ref, 'tags/202') | |
needs: | |
- build-windows | |
- build-macos | |
- build-ubuntu | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/download | |
with: | |
platform: windows_x86_64 | |
- uses: ./.github/actions/download | |
with: | |
platform: macos_arm64 | |
- uses: ./.github/actions/download | |
with: | |
platform: ios | |
- uses: ./.github/actions/download | |
with: | |
platform: ubuntu-20.04_armv8_jetson | |
- uses: ./.github/actions/download | |
with: | |
platform: ubuntu-20.04_x86_64 | |
- uses: ./.github/actions/download | |
with: | |
platform: ubuntu-22.04_x86_64 | |
- uses: ./.github/actions/download | |
with: | |
platform: android | |
- name: Env to output | |
run: | | |
echo "package_paths<<EOF" >> $GITHUB_OUTPUT | |
cat package_paths.env >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
id: env | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | |
${{ steps.env.outputs.package_paths }} |