vulkan-renderer icon indicating copy to clipboard operation
vulkan-renderer copied to clipboard

Use a Docker image to speed up Continuous Integration (GitHub workflows)

Open IAmNotHanni opened this issue 6 months ago • 2 comments

Is your feature request related to a problem?

Every time we run the CI, it has to install the apt packages and it has to download the latest Vulkan SDK. This is not optimal, because it takes quite some time. We should use a Docker image to speed up the CI.

Description

Use a docker image like

# Use a minimal base
FROM ubuntu:22.04

# Install required tools
RUN apt update && \
    DEBIAN_FRONTEND=noninteractive apt install -y \
      clang-15 clang-tidy-15 cmake git curl parallel \
      libc++-15-dev libc++abi-15-dev

# Download and extract Vulkan SDK
RUN curl -LS -o vulkansdk.tar.xz https://sdk.lunarg.com/sdk/download/1.4.309.0/linux/vulkansdk-linux-x86_64-1.4.309.0.tar.xz && \
    mkdir -p /opt/vulkan && \
    tar xf vulkansdk.tar.xz -C /opt/vulkan && \
    rm vulkansdk.tar.xz

# Set environment variables
ENV VULKAN_SDK=/opt/vulkan/1.4.309.0/x86_64
ENV PATH=$VULKAN_SDK/bin:$PATH
ENV LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
ENV VK_ICD_FILENAMES=$VULKAN_SDK/etc/vulkan/icd.d
ENV VK_LAYER_PATH=$VULKAN_SDK/etc/vulkan/layer.d

We can then use the image like:

jobs:
  clang-tidy:
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/your-org/my-repo/clang-tidy-ci:latest
      credentials:
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - uses: actions/checkout@v4
      - name: Configure with CMake
        run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
      - name: Run clang-tidy
        run: |
          find src include \
            -path '*/_deps/*' -prune -o \
            -path '*/build/*' -prune -o \
            \( -name '*.cpp' -o -name '*.hpp' \) -print0 |
            parallel -0 clang-tidy -p build {} |
            tee output || true

Alternatives

If we don't use a Docker image, CI will take longer. We still can cache the Vulkan SDK download though.

Affected Code

The GitHub workflows for Continuous Integration (CI).

Operating System

No response

Additional Context

No response

IAmNotHanni avatar May 08 '25 23:05 IAmNotHanni

https://www.youtube.com/watch?v=RgZyX-e6W9E

IAmNotHanni avatar May 09 '25 00:05 IAmNotHanni

In this first attempt, I honestly got further than I expected. Docker is really easy to use and it seems to drastically decrease the time required to run the CI. It also makes CI runs more reproducible.

IAmNotHanni avatar May 09 '25 01:05 IAmNotHanni

I will close this ticket because I think the current solution is already more than good enough. There is a lot of additional work related to maintaining an extra docker image instead of just using GitHub's solution.

IAmNotHanni avatar Sep 25 '25 15:09 IAmNotHanni