Attempt to fix problems associated with caching Vulkan SDK in GitHub actions workflow on Linux #13
Workflow file for this run
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 Code (cache) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| env: | |
| INEXOR_VULKAN_VERSION: "1.3.283.0" | |
| INEXOR_VULKAN_SDK_PATH: "${{ github.workspace }}/vulkan_sdk" | |
| INEXOR_VULKAN_SDK_CHECKSUM_LINUX: "8005e2cf3e89c80cbe1c0d0a259c88248de3257b4fc6fdefb47409edb3e43ecb" | |
| INEXOR_VULKAN_SDK_CHECKSUM_WINDOWS: "811fcb9b43d09248520b2f38ae9a3763fc81df950fdab874f23bd762b07a9b12" | |
| jobs: | |
| build: | |
| name: ${{ matrix.config.name }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { | |
| name: "Ubuntu Clang (Debug)", | |
| compiler: "clang", | |
| cc: "clang-18", | |
| cxx: "clang++-18", | |
| build_type: "Debug" | |
| } | |
| - { | |
| name: "Ubuntu Clang (Release)", | |
| compiler: "clang", | |
| cc: "clang-18", | |
| cxx: "clang++-18", | |
| build_type: "Release" | |
| } | |
| - { | |
| name: "Ubuntu GCC (Debug)", | |
| compiler: "gcc", | |
| cc: "gcc-14", | |
| cxx: "g++-14", | |
| build_type: "Debug" | |
| } | |
| - { | |
| name: "Ubuntu GCC (Release)", | |
| compiler: "gcc", | |
| cc: "gcc-14", | |
| cxx: "g++-14", | |
| build_type: "Release" | |
| } | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update -qq | |
| sudo apt-get install -y \ | |
| gcc-14 \ | |
| g++-14 \ | |
| clang-18 \ | |
| cmake \ | |
| curl \ | |
| git \ | |
| libgl1-mesa-dev \ | |
| libwayland-dev \ | |
| libx11-dev \ | |
| libx11-xcb-dev \ | |
| libxkbcommon-dev \ | |
| libxcb-dri3-dev \ | |
| libxcb-icccm4-dev \ | |
| libxcb-image0-dev \ | |
| libxcb-keysyms1-dev \ | |
| libxcb-randr0-dev \ | |
| libxcb-render-util0-dev \ | |
| libxcb-render0-dev \ | |
| libxcb-shape0-dev \ | |
| libxcb-sync-dev \ | |
| libxcb-util-dev \ | |
| libxcb-xfixes0-dev \ | |
| libxcb-xinerama0-dev \ | |
| libxcb-xkb-dev \ | |
| lld \ | |
| ninja-build \ | |
| pkg-config \ | |
| python3 \ | |
| python3-pip \ | |
| xkb-data \ | |
| xorg-dev | |
| pip3 install --break-system-packages wheel setuptools | |
| # Cache Vulkan SDK to speed up CI | |
| - name: Cache Vulkan SDK | |
| id: cache-vulkan-sdk | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.VULKAN_SDK_DIR }} | |
| key: vulkan-sdk-${{ env.VULKAN_SDK_VERSION }}-${{ runner.os }} | |
| restore-keys: | | |
| vulkan-sdk-${{ env.VULKAN_SDK_VERSION }}- | |
| # Download Vulkan SDK if cache missed | |
| - name: Download Vulkan SDK | |
| if: steps.cache-vulkan-sdk.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p $VULKAN_SDK_DIR | |
| wget -O vulkansdk.tar.xz https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkan-sdk.tar.xz | |
| tar -xJf vulkansdk.tar.xz -C $VULKAN_SDK_DIR --strip-components=1 | |
| - name: Configure CMake | |
| run: | | |
| export CC=${{ matrix.config.cc }} | |
| export CXX=${{ matrix.config.cxx }} | |
| export VULKAN_SDK="${{ env.INEXOR_VULKAN_SDK_PATH }}/${{ env.INEXOR_VULKAN_VERSION }}/x86_64" | |
| export PATH=$VULKAN_SDK/bin:$PATH | |
| export LD_LIBRARY_PATH=$VULKAN_SDK/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} | |
| export VK_LAYER_PATH=$VULKAN_SDK/share/vulkan/explicit_layer.d | |
| cmake . \ | |
| -Bbuild \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ | |
| -DINEXOR_BUILD_BENCHMARKS=OFF \ | |
| -DINEXOR_BUILD_TESTS=OFF \ | |
| -DCMAKE_CXX_FLAGS="-Wall -Wextra" \ | |
| -GNinja \ | |
| ${{ matrix.config.cmake_configure_options }} | |
| - name: Build | |
| run: cmake --build build | |
| - name: Prepare Build Artifacts | |
| run: | | |
| cd build | |
| tar -zcvf "../build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz" * | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz | |
| path: build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz | |
| - name: Prepare Nightly Artifacts | |
| run: | | |
| mkdir artifacts | |
| cp ./build/example/inexor-vulkan-renderer-example artifacts/ | |
| cp -r ./configuration/ artifacts/ | |
| cp -r ./assets/ artifacts | |
| mkdir -p ./artifacts/shaders | |
| cp ./shaders/*.spv ./artifacts/shaders/ | |
| cd artifacts | |
| tar -zcvf "../nightly_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz" * | |
| - name: Upload Nightly Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nightly_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz | |
| path: nightly_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz | |
| retention-days: 7 |