Skip to content

Fix checkout

Fix checkout #447

Workflow file for this run

name: Release Build CI
# Controls when the workflow will run
# Triggers the workflow on push or pull request events and manually from the Actions tab
on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
workflow_dispatch:
jobs:
build:
env:
GRPC_BUILD_ENABLE_CCACHE: "ON"
GH_TOKEN: ${{ secrets.GNUS_TOKEN_1 }}
runs-on: ${{matrix.host}}
strategy:
fail-fast: false
matrix:
target: [Android, iOS, OSX, Linux, Windows]
build-type: [Release]
include:
- target: Linux
host: ubuntu-latest
- target: Windows
host: windows-latest
- target: OSX
host: macos-latest
- target: Android
host: ubuntu-latest
abi: arm64-v8a
- target: iOS
host: macos-latest
steps:
- name: Checkout SuperGenius repository
uses: actions/checkout@v4
with:
path: "SuperGenius"
submodules: "recursive"
- name: Set branch name for thirdparty download
id: tp-branch
run: |
current_branch=$(git -C SuperGenius rev-parse --abbrev-ref HEAD)
# Check if the branch exists in the thirdparty repository
if git ls-remote --heads https://github.com/GeniusVentures/thirdparty.git $current_branch | grep -q $current_branch; then
echo "Using same branch for thirdparty"
thirdparty_branch=${current_branch}
else
echo "Using develop branch from thirdparty"
thirdparty_branch=develop
fi
echo "THIRDPARTY_BRANCH=$thirdparty_branch" >>$GITHUB_OUTPUT
shell: bash
- name: Download thirdparty release
working-directory: ${{github.workspace}}
run: |
mkdir thirdparty
cd thirdparty
tag_name=${{matrix.target}}-${{steps.tp-branch.outputs.THIRDPARTY_BRANCH}}-Release
gh release download ${tag_name} --repo GeniusVentures/thirdparty -p "*-lib.tar.gz"
echo "Found libraries:"
for library in *-lib.tar.gz; do
echo "${library}"
tar -xzf "${library}"
done
shell: bash
- name: Configure Linux host
if: ${{ matrix.host == 'ubuntu-latest'}}
run: |
sudo update-alternatives --install /usr/bin/cc cc $(which clang) 100
sudo update-alternatives --install /usr/bin/c++ c++ $(which clang++) 100
sudo update-alternatives --set cc $(which clang)
sudo update-alternatives --set c++ $(which clang++)
sudo apt install ccache ninja-build libvulkan-dev -y
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
- name: Configure Windows host
if: ${{ matrix.host == 'windows-latest'}}
run: |
choco install ccache -A
- name: Configure macOS host
if: ${{ matrix.host == 'macos-latest'}}
run: |
brew install ccache ninja bash
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
- name: Add Darwin toolchain
if: ${{ matrix.target == 'OSX'}}
run: rustup target add x86_64-apple-darwin
- name: Add iOS toolchain
if: ${{ matrix.target == 'iOS' }}
run: |
rustup toolchain install nightly-aarch64-apple-darwin
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
rustup target add aarch64-apple-ios
- name: Add Android toolchain
if: ${{ matrix.target == 'Android' }}
run: |
rustup target add aarch64-linux-android
- name: Install bindgen
run: cargo install cbindgen
- name: Add wasm Rust target
run: rustup target add wasm32-unknown-emscripten
- name: Set build directory
run: |
if ${{matrix.target == 'Android'}}; then
BUILD_DIRECTORY=build/${{matrix.target}}/${{matrix.build-type}}/${{matrix.abi}}
else
BUILD_DIRECTORY=build/${{matrix.target}}/${{matrix.build-type}}
fi
echo "BUILD_DIRECTORY=$BUILD_DIRECTORY" >> $GITHUB_ENV
shell: bash
- name: Configure CMake for Android
if: ${{ matrix.target == 'Android'}}
working-directory: ${{github.workspace}}/SuperGenius
run: cmake -S build/${{matrix.target}} -B $BUILD_DIRECTORY -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DANDROID_ABI=${{matrix.abi}} -DTHIRDPARTY_BUILD_DIR=${{github.workspace}}/thirdparty -DTHIRDPARTY_DIR=${{github.workspace}}/thirdparty
- name: Configure CMake for Mac x86
if: ${{ matrix.target == 'OSX'}}
working-directory: ${{github.workspace}}/SuperGenius
run: cmake -S build/${{matrix.target}} -B $BUILD_DIRECTORY -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DPLATFORM=MAC -DTHIRDPARTY_BUILD_DIR=${{github.workspace}}/thirdparty -DTHIRDPARTY_DIR=${{github.workspace}}/thirdparty
- name: Configure CMake for iOS
if: ${{ matrix.target == 'iOS'}}
working-directory: ${{github.workspace}}/SuperGenius
run: cmake -S build/${{matrix.target}} -B $BUILD_DIRECTORY -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DPLATFORM=OS64 -DTHIRDPARTY_BUILD_DIR=${{github.workspace}}/thirdparty -DTHIRDPARTY_DIR=${{github.workspace}}/thirdparty
- name: Configure CMake for Linux
if: ${{matrix.target == 'Linux'}}
working-directory: ${{github.workspace}}/SuperGenius
run: cmake -S build/${{matrix.target}} -B $BUILD_DIRECTORY -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DTHIRDPARTY_BUILD_DIR=${{github.workspace}}/thirdparty -DTHIRDPARTY_DIR=${{github.workspace}}/thirdparty
- name: Configure CMake for Windows
if: ${{matrix.target == 'Windows'}}
working-directory: ${{github.workspace}}/SuperGenius
run: cmake -S build/${{matrix.target}} -B $env:BUILD_DIRECTORY -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DTHIRDPARTY_BUILD_DIR=${{github.workspace}}/thirdparty -DTHIRDPARTY_DIR=${{github.workspace}}/thirdparty
- name: Build SuperGenius
working-directory: ${{github.workspace}}/SuperGenius
run: cmake --build $BUILD_DIRECTORY --config ${{matrix.build-type}} -j
shell: bash
- name: Install SuperGenius
working-directory: ${{env.BUILD_DIRECTORY}}
run: cmake --install .
- name: Compressing Build Artifacts
working-directory: ${{github.workspace}}/SuperGenius
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
shopt -s extglob
rm -rf !(build) .[!.]* ..?*
cd build
rm -rf !(${{matrix.target}}) .[!.]* ..?*
cd ${{matrix.target}}
rm -rf !(Release) .[!.]* ..?*
cd Release
if [[ "${{matrix.target == 'Android'}}"]]; then
rm -rf !(${{matrix.abi}}) .[!.]* ..?*
cd ${{matrix.abi}}
fi
rm -rf !(SuperGenius) .[!.]* ..?*
cd $GITHUB_WORKSPACE
tar -czvf SuperGenius.tar.gz SuperGenius/
shell: bash
- name: Set Release Variables
id: vars
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
if ${{matrix.target == 'Android'}}; then
OS_NAME=${{matrix.target}}-${{matrix.abi}}
else
OS_NAME=${{matrix.target}}
fi
branch_name=${GITHUB_REF#refs/heads/}
build_type=Release
file_name="${OS_NAME}-${branch_name}-${build_type}.tar.gz"
echo "RELEASE_TAG=${OS_NAME}-${branch_name}-${build_type}-${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "RELEASE_NAME=${OS_NAME} ${branch_name} ${build_type} (${GITHUB_SHA::7})" >> $GITHUB_ENV
echo "FILE_NAME=$file_name" >> $GITHUB_ENV
shell: bash
- name: Rename Artifact
if: ${{ github.event_name == 'workflow_dispatch' }}
run: mv SuperGenius.tar.gz ${{ env.FILE_NAME }}
shell: bash
- name: Create GitHub Release
if: ${{ github.event_name == 'workflow_dispatch' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GNUS_TOKEN_1 }}
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: ${{ env.RELEASE_NAME }}
draft: false
prerelease: false
- name: Upload Release Asset
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GNUS_TOKEN_1 }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.FILE_NAME }}
asset_name: ${{ env.FILE_NAME }}
asset_content_type: application/gzip