Merge pull request #30 from IOleg-crypto/opengl #5
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: Deploy SDK | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: deploy-sdk-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CI: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| DOTNET_NOLOGO: true | |
| jobs: | |
| build: | |
| name: Build SDK (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux | |
| preset: linux-clang | |
| - os: windows-latest | |
| platform: windows | |
| preset: windows-clang | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| fetch-depth: 1 | |
| - name: Write submodule SHA manifest | |
| run: git submodule status | tee submodule-shas.txt | |
| - name: Cache submodules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .git/modules | |
| thirdparty | |
| key: submodules-${{ runner.os }}-${{ hashFiles('submodule-shas.txt') }} | |
| restore-keys: | | |
| submodules-${{ runner.os }}- | |
| - name: Init submodules | |
| run: git submodule update --init --recursive --depth 1 | |
| - name: Get CMake and Ninja | |
| uses: lukka/get-cmake@latest | |
| - name: Setup Compiler Cache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| variant: ${{ matrix.os == 'windows-latest' && 'sccache' || 'ccache' }} | |
| key: ${{ runner.os }}-deploy-${{ matrix.preset }} | |
| max-size: 5G | |
| - name: Get current version/date | |
| id: info | |
| shell: bash | |
| run: | | |
| echo "date=$(date +'%d.%m.%y')" >> $GITHUB_OUTPUT | |
| TAG_VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=${TAG_VERSION:-manual}" >> $GITHUB_OUTPUT | |
| - name: Setup environment | |
| id: build-env | |
| shell: bash | |
| run: | | |
| mkdir -p build/${{ matrix.preset }} | |
| mkdir -p package/bin | |
| echo "package-dir=$(pwd)/package" >> $GITHUB_OUTPUT | |
| - name: Setup Mold Linker | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: rui314/setup-mold@v1 | |
| - name: Install dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| # xorg-dev covers the full X11 dev header/lib set GLFW's find_package(X11) needs. | |
| # Wayland is force-disabled for Linux in cmake/external/glfw.cmake, so no | |
| # libwayland-dev / libegl here. | |
| sudo apt-get install -y build-essential cmake ninja-build ccache \ | |
| xorg-dev \ | |
| libgl1-mesa-dev libglu1-mesa-dev libasound2-dev \ | |
| libxkbcommon-dev \ | |
| pkg-config libgtk-3-dev libdrm-dev libgbm-dev \ | |
| xvfb libxkbcommon-x11-0 clang lld | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install jinja2 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 9.0.x | |
| 10.0.x | |
| - name: Setup MSYS2 | |
| if: matrix.os == 'windows-latest' | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: false | |
| install: >- | |
| mingw-w64-x86_64-clang lld | |
| - name: Configure CMake | |
| run: | | |
| set -euo pipefail | |
| PYTHON_EXE=$(python -c "import sys; print(sys.executable)") | |
| launcher="sccache" | |
| if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
| launcher="ccache" | |
| fi | |
| cmake --preset ${{ matrix.preset }} \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=$launcher \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=$launcher \ | |
| -DCMAKE_INSTALL_PREFIX="${{ steps.build-env.outputs.package-dir }}" \ | |
| -DPython_EXECUTABLE="${PYTHON_EXE}" \ | |
| -DPython3_EXECUTABLE="${PYTHON_EXE}" \ | |
| -DCH_CI=ON \ | |
| -DENABLE_UNITY_BUILD=OFF \ | |
| -DENABLE_PCH=OFF \ | |
| -DBUILD_TESTS=OFF | |
| - name: Build binaries | |
| run: | | |
| set -euo pipefail | |
| cmake --build --preset ${{ matrix.preset }} \ | |
| --target ChainedEditor ChainedRuntime \ | |
| --parallel $(nproc 2>/dev/null || echo 8) \ | |
| 2>&1 | tee "build/${{ matrix.preset }}/build.log" | |
| - name: Install to package directory | |
| shell: bash | |
| run: | | |
| cmake --install build/${{ matrix.preset }} \ | |
| --component Runtime | |
| - name: Package SDK | |
| shell: bash | |
| run: | | |
| cd "${{ steps.build-env.outputs.package-dir }}" | |
| PACKAGE_NAME="ChainedEngine-SDK-v${{ steps.info.outputs.version }}-${{ steps.info.outputs.date }}-${{ matrix.platform }}" | |
| echo "Creating SDK package: $PACKAGE_NAME" | |
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
| powershell -Command " | |
| Compress-Archive -Path '*' -DestinationPath '${{ steps.build-env.outputs.package-dir }}/$PACKAGE_NAME.zip' -Force | |
| " | |
| echo "p-file=$PACKAGE_NAME.zip" >> $GITHUB_ENV | |
| else | |
| tar -czf "$PACKAGE_NAME.tar.gz" . | |
| echo "p-file=$PACKAGE_NAME.tar.gz" >> $GITHUB_ENV | |
| fi | |
| - name: Upload SDK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: SDK-${{ matrix.platform }} | |
| path: ${{ steps.build-env.outputs.package-dir }}/${{ env.p-file }} | |
| retention-days: 30 | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get release info | |
| id: info | |
| run: | | |
| echo "date=$(date +'%d.%m.%y')" >> $GITHUB_OUTPUT | |
| TAG_VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=${TAG_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Download all SDK artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-assets | |
| pattern: SDK-* | |
| merge-multiple: true | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "Chained Engine SDK v${{ steps.info.outputs.version }}" | |
| tag_name: "release-v${{ steps.info.outputs.version }}-${{ steps.info.outputs.date }}" | |
| files: release-assets/* | |
| body: | | |
| ### Chained Engine SDK | |
| - **Version**: v${{ steps.info.outputs.version }} | |
| - **Build Date**: ${{ steps.info.outputs.date }} | |
| - **Platforms**: Linux (clang), Windows (clang) | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |