commit 5dcc5f3fa05d23c461cee921807c7a30e42a74af Author: SubQ Date: Sun Dec 6 07:09:50 2026 +0300 Add MinGW/UCRT, LLVM-MinGW and Vulkan CI images diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..2019475 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,77 @@ +# Builds every image in images/ and pushes it to the Gitea container registry +# as git.faumaray.com/void/ci-images:. Pull requests build without +# pushing; a push to main publishes the tags the runner labels use. +name: Build CI images + +on: + push: + branches: [main] + paths: + - "images/**" + - ".gitea/workflows/build.yml" + pull_request: + paths: + - "images/**" + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + image: + - vulkan + - windows-gcc + - windows-clang + steps: + - uses: actions/checkout@v4 + + - name: Resolve the registry and image name + id: image + shell: bash + run: | + set -euo pipefail + server=${GITHUB_SERVER_URL#http://} + server=${server#https://} + server=${server%%/*} + repo=${GITHUB_REPOSITORY,,} + printf 'registry=%s\n' "$server" >>"$GITHUB_OUTPUT" + printf 'ref=%s/%s:%s\n' "$server" "$repo" "${{ matrix.image }}" >>"$GITHUB_OUTPUT" + + - name: Log in to the Gitea container registry + if: github.event_name != 'pull_request' + shell: bash + run: | + set -euo pipefail + printf '%s' "${{ github.token }}" | + docker login "${{ steps.image.outputs.registry }}" \ + -u "${{ github.actor }}" --password-stdin + + - name: Build + shell: bash + run: | + set -euo pipefail + docker build --pull \ + --tag "${{ steps.image.outputs.ref }}" \ + "images/${{ matrix.image }}" + + - name: Smoke test Vulkan (software driver) + if: matrix.image == 'vulkan' + shell: bash + run: | + set -euo pipefail + docker run --rm "${{ steps.image.outputs.ref }}" bash -lc ' + icd=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -n1) + xvfb-run -a env VK_DRIVER_FILES="$icd" vulkaninfo --summary' + + - name: Push + if: github.event_name != 'pull_request' + shell: bash + run: | + set -euo pipefail + docker push "${{ steps.image.outputs.ref }}" diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4a2fc8 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +# Void CI Images + +Container images used by the Void Gitea Actions runners. They are built by +`.gitea/workflows/build.yml` and pushed to the Gitea container registry: + + git.faumaray.com/void/ci-images: + +| Tag | Purpose | Base | +| --- | --- | --- | +| `vulkan` | Build and test Vulkan code on the AMD GPU or the lavapipe software driver | Arch Linux | +| `windows-gcc` | Cross-build Windows x86_64 binaries with MinGW-w64 GCC (UCRT) and run them under Wine | Arch Linux | +| `windows-clang` | The same Windows workflow with the LLVM-MinGW clang toolchain | `mstorsjo/llvm-mingw` | + +## Dependencies baked in + +The C++ toolchain the Void research projects (Engine, Build-System, Library) +use is already installed: + +- GCC 16 (C++26 with `-freflection`), CMake 4, Ninja, `pkg-config`, ccache +- Boost, OpenSSL, SQLite, libsodium, libarchive, FreeType, GLFW, GoogleTest +- Vulkan headers, loader, validation layers, tools, glslang, shaderc, Slang +- Mesa with RADV (AMD hardware) and lavapipe (software Vulkan) +- Wine for running Windows tests + +`windows-gcc` additionally carries the `mingw-w64-toolchain` group +(`x86_64-w64-mingw32-gcc/g++`, binutils, CRT, winpthreads) and an initialised +64-bit Wine prefix. `windows-clang` carries the LLVM-MinGW toolchain (clang, +lld, compiler-rt, libc++, UCRT) from the upstream image. + +### UCRT + +`mingw-w64` 14 made UCRT the default (`--with-default-msvcrt` defaults to +`ucrt`), so Arch's `mingw-w64-gcc` 16.2 and LLVM-MinGW both target the UCRT. +The resulting binaries expect `ucrtbase.dll`, which Wine 11 and Windows 10+ +provide. + +Arch Linux ships only the core MinGW toolchain. Additional Windows libraries +are left to each project (CMake `FetchContent`, vcpkg or conan); the Vulkan +headers are copied into the MinGW sysroot because they are platform-independent. + +## Using the images + +Add a label to the runner in `modules/dev/gitea-runner.nix`: + +```nix +"vulkan:docker://git.faumaray.com/void/ci-images:vulkan" +``` + +and select it from a workflow with `runs-on: vulkan`. + +Both Windows images set `WINEPATH` to the MinGW runtime directory, so +`libstdc++`/`libc++` DLLs resolve under Wine; `-static` linking works too. + +The Vulkan image needs the host render node. The runner already sets +`container.options`; add `--device=/dev/dri` there (the desktop host has an AMD +GPU). Without a GPU, request the software driver explicitly: + +```sh +VK_DRIVER_FILES=/usr/share/vulkan/icd.d/lvp_icd.json vulkaninfo --summary +``` + +## Adding an image + +1. Add `images//Dockerfile`. +2. Add `` to the matrix in `.gitea/workflows/build.yml`. +3. Add the matching label in `gitea-runner.nix`. diff --git a/images/vulkan/Dockerfile b/images/vulkan/Dockerfile new file mode 100644 index 0000000..05eab1e --- /dev/null +++ b/images/vulkan/Dockerfile @@ -0,0 +1,46 @@ +# Portable Vulkan test image for the Void research projects. +# +# Hardware GPU: pass the host render node through the runner +# container.options = "--device=/dev/dri" +# and Mesa's RADV driver (vulkan-radeon) uses it. Without a GPU, Mesa's +# lavapipe software driver (vulkan-swrast) still runs the tests: +# VK_DRIVER_FILES=/usr/share/vulkan/icd.d/lvp_icd.json +# +# Arch Linux is the base because it packages GCC 16 (C++26 reflection), +# CMake 4, the Vulkan SDK pieces and every Void dependency in one repository. +FROM archlinux:base-devel + +LABEL org.opencontainers.image.title="Void CI Vulkan" \ + org.opencontainers.image.description="GCC 16, CMake 4, Vulkan SDK + Mesa (RADV/lavapipe) and the Void C++ dependencies" \ + org.opencontainers.image.source="https://git.faumaray.com/Void/CI-Images" + +ENV LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 \ + CMAKE_GENERATOR=Ninja \ + CCACHE_DIR=/var/cache/ccache \ + WINEDEBUG=-all \ + WINEDLLOVERRIDES=mscoree,mshtml= + +RUN pacman -Syu --noconfirm --needed \ + base-devel gcc cmake ninja git pkgconf python ccache \ + vulkan-headers vulkan-icd-loader vulkan-validation-layers vulkan-tools \ + mesa vulkan-radeon vulkan-swrast vulkan-mesa-layers \ + glslang shaderc shader-slang \ + glfw gtest boost openssl sqlite libsodium libarchive freetype2 \ + libx11 libxcb libxcursor libxrandr libxi libxinerama libxkbcommon \ + wayland wayland-protocols \ + wine zip unzip jq curl ca-certificates xorg-server-xvfb \ + && pacman -Scc --noconfirm + +RUN git config --system --add safe.directory '*' \ + && useradd --create-home --shell /bin/bash builder \ + && mkdir -p /var/cache/ccache \ + && chown builder:builder /var/cache/ccache + +USER builder +WORKDIR /home/builder + +# Warm a 64-bit Wine prefix so Windows cross tests do not initialise it per job. +RUN wineboot --init >/dev/null 2>&1 || true; wineserver -w || true + +CMD ["/bin/bash"] diff --git a/images/windows-clang/Dockerfile b/images/windows-clang/Dockerfile new file mode 100644 index 0000000..ab9f2d6 --- /dev/null +++ b/images/windows-clang/Dockerfile @@ -0,0 +1,37 @@ +# LLVM-MinGW clang for Windows x86_64 (UCRT), plus CMake, Ninja and Wine. +# +# The upstream mstorsjo/llvm-mingw image is Ubuntu 24.04 with a complete +# LLVM-MinGW toolchain in /opt/llvm-mingw (clang, lld, compiler-rt, libc++ and +# the mingw-w64 runtime, DEFAULT_CRT=ucrt). Arch's GCC image covers the GCC +# side; this one is the clang side. +FROM mstorsjo/llvm-mingw:latest + +LABEL org.opencontainers.image.title="Void CI Windows Clang" \ + org.opencontainers.image.description="LLVM-MinGW clang cross toolchain, CMake, Ninja and Wine" \ + org.opencontainers.image.source="https://git.faumaray.com/Void/CI-Images" + +ENV DEBIAN_FRONTEND=noninteractive \ + CMAKE_GENERATOR=Ninja \ + WINEPREFIX=/root/.wine \ + WINEARCH=win64 \ + WINEDEBUG=-all \ + WINEDLLOVERRIDES=mscoree,mshtml= \ + WINEPATH=Z:/opt/llvm-mingw/x86_64-w64-mingw32/bin + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + cmake ninja-build pkg-config git ca-certificates \ + libvulkan-dev vulkan-tools mesa-vulkan-drivers \ + wine xvfb \ + zip unzip jq curl \ + && rm -rf /var/lib/apt/lists/* + +# The Vulkan headers are OS-independent; make them visible to LLVM-MinGW. +RUN mkdir -p /opt/llvm-mingw/x86_64-w64-mingw32/include \ + && cp -a /usr/include/vulkan /opt/llvm-mingw/x86_64-w64-mingw32/include/ \ + && git config --system --add safe.directory '*' + +# Initialise the Wine prefix once, at build time, not in every job. +RUN wineboot --init >/dev/null 2>&1 || true; wineserver -w || true + +CMD ["/bin/bash"] diff --git a/images/windows-gcc/Dockerfile b/images/windows-gcc/Dockerfile new file mode 100644 index 0000000..86bf89d --- /dev/null +++ b/images/windows-gcc/Dockerfile @@ -0,0 +1,56 @@ +# MinGW-w64 GCC for Windows x86_64 (UCRT) on Arch Linux, plus Wine. +# +# mingw-w64 14 made UCRT the default (mingw-w64-crt/configure.ac: +# --with-default-msvcrt defaults to ucrt), so x86_64-w64-mingw32-g++ here +# produces UCRT binaries. Arch packages mingw-w64-gcc 16.2, the same GCC major +# the Void projects use natively. +# +# Wine runs the resulting tests. Vulkan under Wine maps to the host Vulkan +# driver, so the Mesa/RADV/lavapipe packages are installed too. +# +# Arch ships only the core MinGW toolchain. Extra Windows libraries belong to +# the project (CMake FetchContent, vcpkg or conan); the Vulkan headers are +# copied into the MinGW sysroot because they are platform-independent. +FROM archlinux:base-devel + +LABEL org.opencontainers.image.title="Void CI Windows GCC" \ + org.opencontainers.image.description="MinGW-w64 GCC 16 (UCRT) cross toolchain, CMake, Ninja and Wine" \ + org.opencontainers.image.source="https://git.faumaray.com/Void/CI-Images" + +ENV LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 \ + CMAKE_GENERATOR=Ninja \ + MINGW_TRIPLET=x86_64-w64-mingw32 \ + WINEPREFIX=/home/builder/.wine \ + WINEARCH=win64 \ + WINEDEBUG=-all \ + WINEDLLOVERRIDES=mscoree,mshtml= \ + WINEPATH=Z:/usr/x86_64-w64-mingw32/bin + +RUN pacman -Syu --noconfirm --needed \ + base-devel gcc cmake ninja git pkgconf python zip unzip \ + mingw-w64-toolchain \ + vulkan-headers vulkan-icd-loader vulkan-tools \ + mesa vulkan-radeon vulkan-swrast \ + wine xorg-server-xvfb \ + jq curl ca-certificates \ + && pacman -Scc --noconfirm + +# Optional packages: not every one is in the Arch repositories. +RUN for pkg in nsis wine-mono wine-gecko; do \ + pacman -S --noconfirm --needed "$pkg" || true; \ + done \ + && pacman -Scc --noconfirm + +# The Vulkan headers are OS-independent; make them visible to the MinGW compiler. +RUN cp -a /usr/include/vulkan /usr/x86_64-w64-mingw32/include/ \ + && git config --system --add safe.directory '*' \ + && useradd --create-home --shell /bin/bash builder + +USER builder +WORKDIR /home/builder + +# Initialise the Wine prefix once, at build time, not in every job. +RUN wineboot --init >/dev/null 2>&1 || true; wineserver -w || true + +CMD ["/bin/bash"]