Added sanitizer for MSVC and Windows version setting #1509
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: Release Build CI | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| paths-ignore: | |
| - ".github/**" | |
| - "Readme.md" | |
| pull_request: | |
| branches: | |
| - develop | |
| - main | |
| paths-ignore: | |
| - ".github/**" | |
| - "Readme.md" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Release tag" | |
| required: false | |
| type: string | |
| build_android_arm64v8a_release: | |
| description: 'Build Android arm64-v8a Release' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_android_arm64v8a_debug: | |
| description: 'Build Android arm64-v8a Debug' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_android_armv7a_release: | |
| description: 'Build Android armeabi-v7a Release' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_android_armv7a_debug: | |
| description: 'Build Android armeabi-v7a Debug' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_ios_release: | |
| description: 'Build iOS Release' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_ios_debug: | |
| description: 'Build iOS Debug' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_osx_release: | |
| description: 'Build OSX Release' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_osx_debug: | |
| description: 'Build OSX Debug' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_linux_x86_64_release: | |
| description: 'Build Linux x86_64 Release' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_linux_x86_64_debug: | |
| description: 'Build Linux x86_64 Debug' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_linux_aarch64_release: | |
| description: 'Build Linux aarch64 Release' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_linux_aarch64_debug: | |
| description: 'Build Linux aarch64 Debug' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_windows_release: | |
| description: 'Build Windows Release' | |
| required: true | |
| default: true | |
| type: boolean | |
| build_windows_debug: | |
| description: 'Build Windows Debug' | |
| required: true | |
| default: true | |
| type: boolean | |
| jobs: | |
| build: | |
| env: | |
| GRPC_BUILD_ENABLE_CCACHE: "ON" | |
| GH_TOKEN: ${{ secrets.GNUS_TOKEN_1 }} | |
| runs-on: ${{ matrix.host }} | |
| container: | |
| image: ${{ matrix.container }} | |
| options: ${{ '--cap-add=IPC_LOCK' }} | |
| credentials: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GNUS_TOKEN_1 }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: [ Android, iOS, OSX, Linux, Windows ] | |
| build-type: [ Debug, Release ] | |
| abi: [ "" ] | |
| include: | |
| - target: Linux | |
| host: sg-ubuntu-linux | |
| abi: "x86_64" | |
| build-type: "Release" | |
| container: ghcr.io/geniusventures/debian-bullseye:latest | |
| - target: Linux | |
| host: sg-ubuntu-linux | |
| abi: "x86_64" | |
| build-type: "Debug" | |
| container: ghcr.io/geniusventures/debian-bullseye:latest | |
| - target: Linux | |
| host: sg-arm-linux | |
| abi: "aarch64" | |
| build-type: "Release" | |
| container: ghcr.io/geniusventures/debian-bullseye:latest | |
| - target: Linux | |
| host: sg-arm-linux | |
| abi: "aarch64" | |
| build-type: "Debug" | |
| container: ghcr.io/geniusventures/debian-bullseye:latest | |
| - target: Windows | |
| host: SG-WIN11 | |
| - target: OSX | |
| host: gv-OSX-Large | |
| - target: Android | |
| host: sg-ubuntu-linux | |
| abi: arm64-v8a | |
| build-type: "Release" | |
| - target: Android | |
| host: sg-ubuntu-linux | |
| abi: arm64-v8a | |
| build-type: "Debug" | |
| - target: Android | |
| host: sg-ubuntu-linux | |
| abi: armeabi-v7a | |
| build-type: "Release" | |
| - target: Android | |
| host: sg-ubuntu-linux | |
| abi: armeabi-v7a | |
| build-type: "Debug" | |
| - target: iOS | |
| host: macos-latest | |
| exclude: | |
| - target: Android | |
| abi: "" | |
| - target: Linux | |
| abi: "" | |
| steps: | |
| - name: Check if build should run (Unix) | |
| if: ${{ matrix.target != 'Windows' }} | |
| run: | | |
| SHOULD_RUN="true" | |
| if [ '${{ github.event_name }}' == 'workflow_dispatch' ]; then | |
| case '${{ matrix.target }}-${{ matrix.abi }}-${{ matrix.build-type }}' in | |
| Android-arm64-v8a-Release) [ '${{ inputs.build_android_arm64v8a_release }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| Android-arm64-v8a-Debug) [ '${{ inputs.build_android_arm64v8a_debug }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| Android-armeabi-v7a-Release) [ '${{ inputs.build_android_armv7a_release }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| Android-armeabi-v7a-Debug) [ '${{ inputs.build_android_armv7a_debug }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| iOS-*-Release) [ '${{ inputs.build_ios_release }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| iOS-*-Debug) [ '${{ inputs.build_ios_debug }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| OSX-*-Release) [ '${{ inputs.build_osx_release }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| OSX-*-Debug) [ '${{ inputs.build_osx_debug }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| Linux-x86_64-Release) [ '${{ inputs.build_linux_x86_64_release }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| Linux-x86_64-Debug) [ '${{ inputs.build_linux_x86_64_debug }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| Linux-aarch64-Release) [ '${{ inputs.build_linux_aarch64_release }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| Linux-aarch64-Debug) [ '${{ inputs.build_linux_aarch64_debug }}' != 'true' ] && SHOULD_RUN="false" ;; | |
| esac | |
| fi | |
| if [ "$SHOULD_RUN" == "false" ]; then | |
| echo "Skipping build for ${{ matrix.target }} ${{ matrix.abi }} ${{ matrix.build-type }}" | |
| exit 78 | |
| fi | |
| - name: Check if build should run (Windows) | |
| if: ${{ matrix.target == 'Windows' }} | |
| run: | | |
| $SHOULD_RUN = "true" | |
| if ('${{ github.event_name }}' -eq 'workflow_dispatch') { | |
| $key = '${{ matrix.target }}-${{ matrix.abi }}-${{ matrix.build-type }}' | |
| switch -Wildcard ($key) { | |
| 'Windows-*-Release' { | |
| if ('${{ inputs.build_windows_release }}' -ne 'true') { $SHOULD_RUN = "false" } | |
| } | |
| 'Windows-*-Debug' { | |
| if ('${{ inputs.build_windows_debug }}' -ne 'true') { $SHOULD_RUN = "false" } | |
| } | |
| } | |
| } | |
| if ($SHOULD_RUN -eq "false") { | |
| Write-Output "Skipping build for ${{ matrix.target }} ${{ matrix.abi }} ${{ matrix.build-type }}" | |
| exit 78 | |
| } | |
| - name: Clean workspace (self-hosted runners - Unix) | |
| if: ${{ runner.environment == 'self-hosted' && matrix.target != 'Windows' }} | |
| working-directory: ${{ runner.workspace }} | |
| shell: bash | |
| run: | | |
| echo "=== PRE-CLEANUP DEBUG ===" | |
| echo "Current working directory: $(pwd)" | |
| echo "Runner workspace: ${{ runner.workspace }}" | |
| echo "GitHub workspace: ${{ github.workspace }}" | |
| echo "=== CLEANUP ARTIFACTS ===" | |
| # Clean up artifacts from previous runs (self-hosted runners only) | |
| # Use sudo on Linux to handle root-owned files left by container jobs | |
| SUDO="" | |
| if [ "$(uname)" = "Linux" ]; then | |
| SUDO="sudo" | |
| fi | |
| # Clean contents of SuperGenius directory but keep the directory itself | |
| if [ -d "SuperGenius" ]; then | |
| echo "Cleaning SuperGenius directory contents..." | |
| $SUDO rm -rf SuperGenius/* SuperGenius/.* 2>/dev/null || true | |
| echo "SuperGenius directory cleaned (kept the directory)" | |
| fi | |
| # Delete sibling dependency directories completely | |
| for dir in thirdparty zkLLVM; do | |
| if [ -d "$dir" ]; then | |
| echo "Removing $dir directory..." | |
| $SUDO rm -rf "$dir" | |
| fi | |
| done | |
| echo "=== POST-CLEANUP DEBUG ===" | |
| echo "Runner workspace contents:" | |
| ls -la | |
| if [ -d "SuperGenius" ]; then | |
| echo "SuperGenius directory exists and contains:" | |
| ls -la SuperGenius/ 2>/dev/null || echo " (empty)" | |
| fi | |
| - name: Clean workspace (self-hosted runners - Windows) | |
| if: ${{ runner.environment == 'self-hosted' && matrix.target == 'Windows' }} | |
| working-directory: ${{ runner.workspace }} | |
| run: | | |
| Write-Output "=== PRE-CLEANUP DEBUG ===" | |
| Write-Output "Current working directory: $(Get-Location)" | |
| Write-Output "Runner workspace: ${{ runner.workspace }}" | |
| Write-Output "GitHub workspace: ${{ github.workspace }}" | |
| Write-Output "=== CLEANUP ARTIFACTS ===" | |
| # Clean up artifacts from previous runs (self-hosted runners only) | |
| # Clean contents of SuperGenius directory but keep the directory itself | |
| if (Test-Path "SuperGenius") { | |
| Write-Output "Cleaning SuperGenius directory contents..." | |
| Get-ChildItem -Path "SuperGenius" -Force | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue | |
| Write-Output "SuperGenius directory cleaned (kept the directory)" | |
| } | |
| # Delete sibling dependency directories completely | |
| foreach ($dir in @("thirdparty", "zkLLVM")) { | |
| if (Test-Path $dir) { | |
| Write-Output "Removing $dir directory..." | |
| Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue | |
| } | |
| } | |
| Write-Output "=== POST-CLEANUP DEBUG ===" | |
| Write-Output "Runner workspace contents:" | |
| Get-ChildItem -Force | |
| if (Test-Path "SuperGenius") { | |
| Write-Output "SuperGenius directory exists and contains:" | |
| Get-ChildItem -Path "SuperGenius" -Force -ErrorAction SilentlyContinue | |
| } | |
| - name: Checkout SuperGenius repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: "SuperGenius" | |
| submodules: "recursive" | |
| - name: Configure bash on Windows (use Git Bash, not WSL) | |
| if: ${{ runner.environment == 'self-hosted' && matrix.target == 'Windows' }} | |
| run: | | |
| $gitUsrBinPath = "C:\Program Files\Git\usr\bin" | |
| $gitBinPath = "C:\Program Files\Git\bin" | |
| foreach ($p in @($gitBinPath, $gitUsrBinPath)) { | |
| if (Test-Path $p) { | |
| Add-Content -Path $env:GITHUB_PATH -Value $p | |
| $env:PATH = "$p;$env:PATH" | |
| } | |
| } | |
| Write-Output "Git Bash configured for bash shell commands" | |
| $bashLocation = (Get-Command bash.exe -ErrorAction SilentlyContinue).Source | |
| if ($bashLocation) { | |
| Write-Output "Bash location: $bashLocation" | |
| } else { | |
| Write-Output "WARNING: bash.exe not found in PATH" | |
| } | |
| - name: Set build directory | |
| shell: bash | |
| run: | | |
| if [ '${{ matrix.abi }}' ]; 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 | |
| - name: Resolve branch/tag | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ "${{ github.event.inputs.tag }}" ]; then | |
| CURRENT_BRANCH="${{ github.event.inputs.tag }}" | |
| IS_TAG=true | |
| elif ${{ github.event_name == 'pull_request' }}; then | |
| CURRENT_BRANCH=${{ github.event.pull_request.head.ref }} | |
| IS_TAG=false | |
| else | |
| CURRENT_BRANCH=$GITHUB_REF_NAME | |
| IS_TAG=false | |
| fi | |
| echo "Identified current branch/tag as ${CURRENT_BRANCH}" | |
| echo "CURRENT_BRANCH=${CURRENT_BRANCH}" >> $GITHUB_ENV | |
| echo "IS_TAG=${IS_TAG}" >> $GITHUB_ENV | |
| if [ "$IS_TAG" == "true" ]; then | |
| RESOLVED_BRANCH="$CURRENT_BRANCH" | |
| elif [ "$CURRENT_BRANCH" == "main" ]; then | |
| RESOLVED_BRANCH="main" | |
| else | |
| RESOLVED_BRANCH="develop" | |
| fi | |
| echo "RESOLVED_BRANCH=${RESOLVED_BRANCH}" >> $GITHUB_ENV | |
| if [ '${{ matrix.abi }}' ]; then | |
| FILE_NAME=${{ matrix.target }}-${{ matrix.abi }}-${{ matrix.build-type }}.tar.gz | |
| else | |
| FILE_NAME=${{ matrix.target }}-${{ matrix.build-type }}.tar.gz | |
| fi | |
| echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV | |
| - name: Download thirdparty release | |
| working-directory: ${{ github.workspace }} | |
| shell: bash | |
| run: | | |
| mkdir thirdparty && cd thirdparty | |
| if [ "$IS_TAG" == "true" ]; then | |
| tag_name="${RESOLVED_BRANCH}" | |
| elif [ '${{ matrix.abi }}' ]; then | |
| tag_name="${{ matrix.target }}-${{ matrix.abi }}-${RESOLVED_BRANCH}-${{ matrix.build-type }}" | |
| else | |
| tag_name="${{ matrix.target }}-${RESOLVED_BRANCH}-${{ matrix.build-type }}" | |
| fi | |
| gh release download ${tag_name} --repo GeniusVentures/thirdparty -p "${FILE_NAME}" | |
| tar -zxf "${FILE_NAME}" | |
| if [ "${{ matrix.target }}" = "Windows" ]; then | |
| echo "THIRDPARTY_BUILD_DIR=$(pwd -W)/${BUILD_DIRECTORY}" >> $GITHUB_ENV | |
| else | |
| echo "THIRDPARTY_BUILD_DIR=$(pwd)/${BUILD_DIRECTORY}" >> $GITHUB_ENV | |
| fi | |
| - name: Download zkLLVM release | |
| working-directory: ${{ github.workspace }} | |
| shell: bash | |
| run: | | |
| mkdir zkLLVM && cd zkLLVM | |
| if [ "${{ matrix.target }}" = "Windows" ]; then | |
| ZKLLVM_FILE_NAME=${{ matrix.target }}-${{ matrix.build-type }}.tar.gz | |
| ZKLLVM_BUILD_DIR=build/${{ matrix.target }}/${{ matrix.build-type }} | |
| tag_name=$( [ "$IS_TAG" == "true" ] && echo "${RESOLVED_BRANCH}" || echo "${{ matrix.target }}-${RESOLVED_BRANCH}-${{ matrix.build-type }}" ) | |
| elif [ '${{ matrix.abi }}' ]; then | |
| ZKLLVM_FILE_NAME=${{ matrix.target }}-${{ matrix.abi }}-Release.tar.gz | |
| ZKLLVM_BUILD_DIR=build/${{ matrix.target }}/Release/${{ matrix.abi }} | |
| tag_name=$( [ "$IS_TAG" == "true" ] && echo "${RESOLVED_BRANCH}" || echo "${{ matrix.target }}-${{ matrix.abi }}-${RESOLVED_BRANCH}-Release" ) | |
| else | |
| ZKLLVM_FILE_NAME=${{ matrix.target }}-Release.tar.gz | |
| ZKLLVM_BUILD_DIR=build/${{ matrix.target }}/Release | |
| tag_name=$( [ "$IS_TAG" == "true" ] && echo "${RESOLVED_BRANCH}" || echo "${{ matrix.target }}-${RESOLVED_BRANCH}-Release" ) | |
| fi | |
| gh release download ${tag_name} --repo GeniusVentures/zkLLVM -p "${ZKLLVM_FILE_NAME}" | |
| tar --exclude='*bin/assigner' --exclude='*bin/clang-zkllvm' --exclude='*bin/llvm-link-zkllvm' --exclude='*bin/transpiler' -xzf "${ZKLLVM_FILE_NAME}" | |
| if [ "${{ matrix.target }}" = "Windows" ]; then | |
| echo "ZKLLVM_BUILD_DIR=$(pwd -W)/${ZKLLVM_BUILD_DIR}" >> $GITHUB_ENV | |
| else | |
| echo "ZKLLVM_BUILD_DIR=$(pwd)/${ZKLLVM_BUILD_DIR}" >> $GITHUB_ENV | |
| fi | |
| - name: Configure Linux host | |
| if: ${{ runner.os == 'Linux' }} | |
| 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 libsecret-1-dev dbus gnome-keyring -y | |
| echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV | |
| - name: Configure Windows host | |
| if: ${{ runner.os == 'Windows' }} | |
| run: choco install ccache -A | |
| - name: Configure macOS host | |
| if: ${{ runner.os == 'macOS' }} | |
| run: | | |
| brew install ninja bash gnu-tar | |
| # Ensure GNU tar is first in PATH - check both possible Homebrew locations | |
| if [ -d "/opt/homebrew/opt/gnu-tar/libexec/gnubin" ]; then | |
| echo "PATH=/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV | |
| echo "Using GNU tar from /opt/homebrew" | |
| elif [ -d "/usr/local/opt/gnu-tar/libexec/gnubin" ]; then | |
| echo "PATH=/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV | |
| echo "Using GNU tar from /usr/local" | |
| else | |
| echo "WARNING: GNU tar installation not found in expected locations" | |
| echo "Available tar: $(which tar)" | |
| fi | |
| 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: | | |
| # Setup Android SDK | |
| ANDROID_SDK_ROOT="$HOME/android-sdk" | |
| # Download command-line tools if not present | |
| if [ ! -d "$ANDROID_SDK_ROOT/cmdline-tools/latest" ]; then | |
| echo "Downloading Android command-line tools..." | |
| mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" | |
| wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O cmdline-tools.zip | |
| unzip -q cmdline-tools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" | |
| mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" | |
| rm cmdline-tools.zip | |
| else | |
| echo "Android command-line tools already exist" | |
| fi | |
| # Always accept licenses and install/update required SDK components | |
| echo "Installing/updating Android SDK components..." | |
| yes | "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --licenses || true | |
| "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" "platform-tools" "platforms;android-34" "build-tools;34.0.0" | |
| # Set environment variables | |
| echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "$ANDROID_SDK_ROOT/platform-tools" >> $GITHUB_PATH | |
| echo "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin" >> $GITHUB_PATH | |
| # Verify SDK installation | |
| echo "=== Android SDK Setup ===" | |
| echo "ANDROID_HOME: $ANDROID_SDK_ROOT" | |
| echo "SDK contents:" | |
| ls -la "$ANDROID_SDK_ROOT" | |
| # Download and setup Android NDK | |
| NDK_VERSION="r27b" | |
| NDK_DIR="$HOME/android-ndk-$NDK_VERSION" | |
| if [ ! -d "$NDK_DIR" ]; then | |
| echo "Downloading Android NDK..." | |
| wget https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip -O ndk.zip | |
| unzip -o ndk.zip -d $HOME | |
| rm ndk.zip | |
| fi | |
| echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "ANDROID_NDK_HOME=$NDK_DIR" >> $GITHUB_ENV | |
| rustup target add aarch64-linux-android | |
| rustup target add armv7-linux-androideabi | |
| - name: Install bindgen | |
| run: cargo install cbindgen | |
| - name: Add wasm Rust target | |
| run: rustup target add wasm32-unknown-emscripten | |
| - 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=${{env.THIRDPARTY_BUILD_DIR}} -DZKLLVM_BUILD_DIR=${{env.ZKLLVM_BUILD_DIR}} | |
| - name: Configure CMake for Mac | |
| 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_UNIVERSAL -DTHIRDPARTY_BUILD_DIR=${{env.THIRDPARTY_BUILD_DIR}} -DZKLLVM_BUILD_DIR=${{env.ZKLLVM_BUILD_DIR}} | |
| - 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=${{env.THIRDPARTY_BUILD_DIR}} -DZKLLVM_BUILD_DIR=${{env.ZKLLVM_BUILD_DIR}} | |
| - 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=${{env.THIRDPARTY_BUILD_DIR}} -DZKLLVM_BUILD_DIR=${{env.ZKLLVM_BUILD_DIR}} -DSGNS_PRINT_LOGS=ON | |
| - 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=${{env.THIRDPARTY_BUILD_DIR}} -DZKLLVM_BUILD_DIR=${{env.ZKLLVM_BUILD_DIR}} | |
| - name: Build SuperGenius | |
| working-directory: ${{ github.workspace }}/SuperGenius/${{ env.BUILD_DIRECTORY }} | |
| run: cmake --build . --config ${{ matrix.build-type }} -j | |
| - name: Install SuperGenius | |
| working-directory: ${{ github.workspace }}/SuperGenius/${{ env.BUILD_DIRECTORY }} | |
| run: cmake --install . --config ${{ matrix.build-type }} | |
| - name: Compress build artifacts | |
| working-directory: ${{ github.workspace }}/SuperGenius/${{ env.BUILD_DIRECTORY }} | |
| if: github.ref_name == 'main' || github.ref_name == 'develop' || env.IS_TAG == 'true' | |
| shell: bash | |
| run: tar --exclude=.git -czvf ${FILE_NAME} --transform 's|^|${{ env.BUILD_DIRECTORY }}/|' SuperGenius/ | |
| - name: Set release tag | |
| shell: bash | |
| run: | | |
| if ${{ github.event_name == 'workflow_dispatch' }} && [ '${{ github.event.inputs.tag }}' ]; then | |
| RELEASE_TAG="${{ github.event.inputs.tag }}" | |
| IS_TAG_RELEASE="true" | |
| else | |
| if [ '${{ matrix.abi }}' ]; then | |
| RELEASE_TAG="${{ matrix.target }}-${{ matrix.abi }}-${{ github.ref_name }}-${{ matrix.build-type }}" | |
| else | |
| RELEASE_TAG="${{ matrix.target }}-${{ github.ref_name }}-${{ matrix.build-type }}" | |
| fi | |
| IS_TAG_RELEASE="false" | |
| fi | |
| echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV | |
| echo "IS_TAG_RELEASE=$IS_TAG_RELEASE" >> $GITHUB_ENV | |
| - name: Create release tag | |
| if: github.ref_name == 'main' || github.ref_name == 'develop' | |
| working-directory: ${{ github.workspace }}/SuperGenius/${{ env.BUILD_DIRECTORY }} | |
| id: create-release-tag | |
| shell: bash | |
| run: | | |
| echo "Checking if release $RELEASE_TAG exists..." | |
| if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then | |
| if [ "$IS_TAG_RELEASE" == "false" ]; then | |
| echo "Deleting existing release/tag $RELEASE_TAG..." | |
| gh release delete "$RELEASE_TAG" --yes || true | |
| git push origin ":refs/tags/$RELEASE_TAG" || true | |
| git tag -d "$RELEASE_TAG" || true | |
| fi | |
| fi | |
| echo "Creating new tag $RELEASE_TAG..." | |
| git tag -f "$RELEASE_TAG" "${{ github.sha }}" | |
| git push origin "$RELEASE_TAG" --force | |
| echo "Creating GitHub release $RELEASE_TAG..." | |
| gh release create "$RELEASE_TAG" \ | |
| --target "${{ github.sha }}" \ | |
| -t "${{ matrix.target }} ${{ github.ref_name }} ${{ matrix.build-type }} build" \ | |
| -n "Branch: ${{ github.ref_name }} | SHA: ${{ github.sha }}" \ | |
| $( [ "$IS_TAG_RELEASE" = "true" ] && echo "" || echo "--prerelease" ) | |
| - name: Upload file | |
| if: github.ref_name == 'main' || github.ref_name == 'develop' || env.IS_TAG == 'true' | |
| working-directory: ${{ github.workspace }}/SuperGenius/${{ env.BUILD_DIRECTORY }} | |
| shell: bash | |
| run: gh release upload ${{ env.RELEASE_TAG }} ${{ env.FILE_NAME }} --clobber | |
| - name: Run tests (Windows) | |
| working-directory: ${{ github.workspace }}/SuperGenius/${{ env.BUILD_DIRECTORY }} | |
| if: ${{ matrix.build-type == 'Release' && matrix.target == 'Windows' }} | |
| run: ctest . -j -C ${{ matrix.build-type }} | |
| - name: Run tests (Linux) | |
| working-directory: ${{ github.workspace }}/SuperGenius/${{ env.BUILD_DIRECTORY }} | |
| if: ${{ matrix.target == 'Linux' }} | |
| shell: bash | |
| run: | | |
| dbus-run-session -- bash -c '\ | |
| mkdir -p ~/.cache ~/.local/share/keyrings && \ | |
| echo -n "login" > ~/.local/share/keyrings/default && \ | |
| echo "[keyring] | |
| display-name=login | |
| lock-on-idle=false | |
| lock-after=false" > ~/.local/share/keyrings/login.keyring && \ | |
| eval $(printf "\n" | gnome-keyring-daemon --unlock --components=secrets) && \ | |
| ctest . --verbose -j -C ${{ matrix.build-type }}' |