ci: Introduce a CI pipeline for GitLab.

This commit is contained in:
Giovanni Mascellani 2023-07-05 14:43:25 +02:00 committed by Alexandre Julliard
parent c39c5b3907
commit 4a3ad750e0
Notes: Alexandre Julliard 2023-08-29 22:15:58 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/271
5 changed files with 115 additions and 0 deletions

7
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,7 @@
stages:
- image
- build
include:
- local: "/gitlab/image.yml"
- local: "/gitlab/build.yml"

19
gitlab/build-linux Executable file
View File

@ -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 || touch ../pipeline_failed
mkdir -p ../artifacts/$COMMIT
rsync -Rr doc/* tests/*.exe ../artifacts/$COMMIT
git reset --hard

29
gitlab/build.yml Normal file
View File

@ -0,0 +1,29 @@
.build:
stage: build
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
build:
extends: .build

40
gitlab/image.docker Normal file
View File

@ -0,0 +1,40 @@
# FROM line will be added dynamically
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 dist-upgrade -y && \
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 && \
useradd -m gitlab
USER gitlab

20
gitlab/image.yml Normal file
View File

@ -0,0 +1,20 @@
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.yml
- gitlab/image.docker
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
IMAGE_SOURCE: "$CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX/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"