With this pipeline vkd3d automatically gets built on Linux (in an image based on Debian unstable), both in 32 and 64 bit mode. Both builds are tested with radv and llvmpipe. A number of caveats apply, though: * A number of tests currently fail in llvmpipe, so the llvmpipe jobs are marked as allowed to fail. Ideally we'll eventually fix our bugs and mark the llvmpipe ones in the tests, so that the CI tests completely pass and possible problems in the Vulkan driver are recorded at a better granularity (this is the reason why GitLab says that the pipeline is passed with warnings: the warnings are that there are jobs that failed, even if they were allowed to fail). * ~~The runners provided by the GitLab instance don't have a GPU available, so I configured my own computer (equipped with an AMD Radeon RX 5700 RX) to provide a runner with access to the GPU. This setup is not currently satisfying: for me, because I use that computer for other things and I don't like having random code submitted to it (it is theoretically sandboxed, but sandboxes are not always bullet-proof, especially if they have access to a GPU); for the users, because my computer might be unavailable at any time. I'll work on a better solution. For the time being I intend the runner to only accept jobs from the master branch; once a better solution is implemented I'd like to run the pipeline for MRs too.~~ **Fixed**, now there is a shared worker with an AMD GPU available. * While the `Dockerfile` and related assets do not necessarily need to be available in this repository, given that the CI accesses the binary image from the Docker hub anyway, I think it's still valuable to have them, so others can improve them (and for sure improvement opportunities are nowhere near missing). However, other ways to make them available can be found, if for some reason it is not liked to have them in this repository (they are not pretty!). * ~~One of the reason they are not pretty is that I have a custom hack to compile `widl` from the Wine sources without compiling (or installing from the distribution) the whole of Wine, in the interest of keeping the Docker image small (well, small-ish: Vulkan drivers, compilers and X libraries are not small anyway).~~ **A better solution was implemented** * ~~Again on the subject of the Docker image, I am currently putting the binary image in my own namespace on the Docker hub. Using the GitLab container registry in the namespace of the Wine project would probably be better, so that I am not a bottleneck in the future.~~ **Done** * ~~Even if we discount all the points above, this MR cannot be merged yet, because my runner is currently configured for my namespace only. I guess I need the intervention of a GitLab admin to fix that. However, I think there's already material enough for valuable feedback.~~ **Fixed too**
-- v5: ci: Introduce a CI pipeline for GitLab.
From: Giovanni Mascellani gmascellani@codeweavers.com
Commit b7402ddbbecdfaa81daa657fbb5d37661f401434 from wine is required, which was first released with 3.21, not 3.20. --- README | 4 ++-- configure.ac | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/README b/README index 465d5f915..4989f9e9a 100644 --- a/README +++ b/README @@ -15,8 +15,8 @@ Vkd3d generates some of its headers from IDL files. If you are using the release tarballs, then these headers are pre-generated and are included. If you are building from git, then they will be generated at build-time using widl. By default, vkd3d will use the widl found in `PATH'. If widl is not -available or is not recent (>= 3.20), then you can build Wine with `make -tools/widl' to avoid building all of Wine. You can then point vkd3d's +available or is not recent (>= 3.21), then you can build Wine with `make +tools/widl/widl' to avoid building all of Wine. You can then point vkd3d's configure at that widl binary with `WIDL="/path/to/widl"'.
For release builds, you may want to define NDEBUG. If you do not need debug log diff --git a/configure.ac b/configure.ac index b58c2f4d2..213ab22ee 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ AC_PROG_CC AM_PROG_CC_C_O AC_PROG_SED AC_PROG_MKDIR_P -VKD3D_PROG_WIDL(3, 20) +VKD3D_PROG_WIDL(3, 21) AS_IF([test "x$WIDL" = "xno"], [AC_MSG_WARN([widl is required to build header files.])])
AC_CHECK_PROGS([FLEX], [flex], [none])
From: Giovanni Mascellani gmascellani@codeweavers.com
--- .gitlab-ci.yml | 113 +++++++++++++++++++++++++++++++++++++++ gitlab/MoltenVK_icd.json | 8 +++ gitlab/build-linux | 19 +++++++ gitlab/build-mac | 19 +++++++ gitlab/image.docker | 36 +++++++++++++ 5 files changed, 195 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 gitlab/MoltenVK_icd.json create mode 100755 gitlab/build-linux create mode 100755 gitlab/build-mac create mode 100644 gitlab/image.docker
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..655d21b93 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,113 @@ +stages: + - image + - build + - test + +build-image: + stage: image + rules: + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_PROJECT_PATH == "wine/vkd3d" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + changes: + - .gitlab-ci.yml + - gitlab/image.docker + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + variables: + IMAGE_SOURCE: "gitlab.winehq.org:443/wine/dependency_proxy/containers/debian:bookworm" + IMAGE_LOCAL: "$CI_REGISTRY_IMAGE:debian-bookworm" + DOCKER_FILE: "$CI_PROJECT_DIR/gitlab/image.docker" + script: + - mkdir -p /kaniko/.docker + - echo "{"auths":{"$CI_REGISTRY":{"auth":"$(printf "%s:%s" "$CI_REGISTRY_USER" "$CI_REGISTRY_PASSWORD" | base64 | tr -d '\n')"},"$CI_DEPENDENCY_PROXY_SERVER":{"auth":"$(printf "%s:%s" "$CI_DEPENDENCY_PROXY_USER" "$CI_DEPENDENCY_PROXY_PASSWORD" | base64 | tr -d '\n')"}}}" > /kaniko/.docker/config.json + - sed -i "1iFROM $IMAGE_SOURCE" "$DOCKER_FILE" + - /kaniko/executor --context "$CI_PROJECT_DIR" --dockerfile "$DOCKER_FILE" --destination "$IMAGE_LOCAL" + +.test: + stage: test + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + image: $CI_REGISTRY/wine/vkd3d:debian-bookworm + interruptible: true + needs: + - job: build-image + optional: true + dependencies: [] + script: + - git config --global --add safe.directory $CI_PROJECT_DIR + - git clean -fdx + - git reset --hard + - rm -fr .git/rebase-merge + - mkdir artifacts + - cat /proc/cpuinfo > artifacts/cpuinfo.txt + - cat /proc/meminfo > artifacts/meminfo.txt + - vulkaninfo > artifacts/vulkaninfo.txt + - git rebase $CI_MERGE_REQUEST_DIFF_BASE_SHA --exec ./gitlab/build-linux + - if [ -f pipeline_failed ] ; then exit 1 ; fi + artifacts: + when: always + expire_in: 1 day + paths: + - artifacts + +test-linux-64-amd: + extends: .test + tags: + - amd-gpu + variables: + VK_LOADER_DRIVERS_SELECT: 'radeon_*' + +test-linux-64-llvmpipe: + extends: .test + allow_failure: true + variables: + VK_LOADER_DRIVERS_SELECT: 'lvp_*' + +test-linux-32-amd: + extends: .test + tags: + - amd-gpu + variables: + VK_LOADER_DRIVERS_SELECT: 'radeon_*' + CC: 'gcc -m32' + +test-linux-32-llvmpipe: + extends: .test + allow_failure: true + variables: + VK_LOADER_DRIVERS_SELECT: 'lvp_*' + CC: 'gcc -m32' + +test-mac: + stage: test + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + allow_failure: true + interruptible: true + needs: [] + dependencies: [] + tags: + - mac + script: + # We use a custom ICD which is not marked as a portability driver, + # so that test programs are not confused. + - export VK_DRIVER_FILES="$PWD/gitlab/MoltenVK_icd.json" + - mkdir artifacts + - system_profiler SPSoftwareDataType SPHardwareDataType > artifacts/systeminfo.txt + - vulkaninfo > artifacts/vulkaninfo.txt + - export PATH="/usr/local/opt/bison/bin:/usr/local/opt/flex/bin:$PATH" + - git clone --depth 1 https://gitlab.winehq.org/wine/wine.git + - cd wine + - mkdir build + - cd build + - ../configure --enable-win64 --without-x --without-freetype + - make tools/widl/widl + - cd ../.. + - export PATH="$PWD/wine/build/tools/widl:$PATH" + - git rebase $CI_MERGE_REQUEST_DIFF_BASE_SHA --exec ./gitlab/build-mac + - if [ -f pipeline_failed ] ; then exit 1 ; fi + artifacts: + when: always + expire_in: 1 day + paths: + - artifacts diff --git a/gitlab/MoltenVK_icd.json b/gitlab/MoltenVK_icd.json new file mode 100644 index 000000000..7a35ed6e9 --- /dev/null +++ b/gitlab/MoltenVK_icd.json @@ -0,0 +1,8 @@ +{ + "file_format_version": "1.0.0", + "ICD": { + "library_path": "/usr/local/opt/molten-vk/lib/libMoltenVK.dylib", + "api_version": "1.2.0", + "is_portability_driver": false + } +} diff --git a/gitlab/build-linux b/gitlab/build-linux new file mode 100755 index 000000000..941e01b5c --- /dev/null +++ b/gitlab/build-linux @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "Building $(git log -1)" +echo "---" + +COMMIT=$(git rev-parse --short HEAD) + +set -Eeuxo pipefail + +./autogen.sh +rm -fr build +mkdir build +cd build +../configure --enable-demos && make -j$(nproc) && make -j$(nproc) crosstest && make -j$(nproc) check || touch ../pipeline_failed + +mkdir -p ../artifacts/$COMMIT +rsync -Rr doc/* tests/*.log tests/*/*.log tests/*.exe ../artifacts/$COMMIT + +git reset --hard diff --git a/gitlab/build-mac b/gitlab/build-mac new file mode 100755 index 000000000..2940eb4dd --- /dev/null +++ b/gitlab/build-mac @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "Building $(git log -1)" +echo "---" + +COMMIT=$(git rev-parse --short HEAD) + +set -Eeuxo pipefail + +./autogen.sh +rm -fr build +mkdir build +cd build +../configure && make && make crosstest && make check || touch ../pipeline_failed + +mkdir -p ../artifacts/$COMMIT +rsync -Rr tests/*.log tests/*/*.log tests/*.exe ../artifacts/$COMMIT + +git reset --hard diff --git a/gitlab/image.docker b/gitlab/image.docker new file mode 100644 index 000000000..684cf1a93 --- /dev/null +++ b/gitlab/image.docker @@ -0,0 +1,36 @@ +WORKDIR /tmp + +RUN export DEBIAN_FRONTEND=noninteractive; \ + echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \ + echo 'path-exclude=/usr/share/locale/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \ + echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \ + echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf && \ + echo '#!/bin/sh' > /usr/sbin/policy-rc.d && \ + echo 'exit 101' >> /usr/sbin/policy-rc.d && \ + chmod +x /usr/sbin/policy-rc.d && \ + dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get install -y eatmydata && \ + eatmydata apt-get dist-upgrade -y && \ + eatmydata apt-get install -y build-essential pkg-config gcc-multilib gcc-mingw-w64 \ + autoconf automake libtool flex bison \ + git ca-certificates rsync \ + doxygen doxygen-latex graphviz \ + mesa-vulkan-drivers mesa-vulkan-drivers:i386 \ + vulkan-tools spirv-headers \ + libvulkan-dev libvulkan-dev:i386 \ + libncurses-dev libncurses-dev:i386 \ + libxcb1-dev libxcb1-dev:i386 \ + libxcb-util-dev libxcb-util-dev:i386 \ + libxcb-icccm4-dev libxcb-icccm4-dev:i386 \ + libxcb-keysyms1-dev libxcb-keysyms1-dev:i386 && \ + git clone --depth 1 --branch wine-3.21 https://gitlab.winehq.org/wine/wine.git && \ + cd wine && \ + mkdir build && \ + cd build && \ + ../configure --without-x --without-freetype && \ + make tools/widl/widl && \ + cp tools/widl/widl /usr/local/bin && \ + cd ../.. && \ + rm -rf wine && \ + apt-get clean
The latest revision should bring in a number of improvements: * I dropped `VKD3D_VULKAN_DEVICE_FILTER`, because it seems that `VK_LOADER_DRIVERS_SELECT` is a better solution, already offered by the Vulkan loader. * I moved image generation in the pipeline itself, in a way similar to Wine. This unfortunately means that this specific MR completely fails the pipeline, because the image is regenerated only once the MR is accepted. You can see an example of what the pipeline should look like in the end here: https://gitlab.winehq.org/giomasce/vkd3d/-/pipelines/12708. * The pipeline is now executed on all the commits of a MR; the generated files are stored for each individual commit in the artifacts archive. * I added a job for compiling and testing on macOS (though not on Apple Silicon, as we don't have such a runner available right now; once we have it it shouldn't be hard to add it too; same thing for an NVIDIA or Intel GPU on Linux). * The GitLab CI code should now be a little more DRY and idiomatic.
Seems fine to me.
This merge request was approved by Henri Verbeet.