It is inefficient to download Wine and build `widl` at each run of the `build-mac` job. And while for `widl` itself that's not a big deal, in the future I'd like to build MoltenVK on the CI, so we don't depend on the version available on the CI runner, which would make each CI run quite heavier.
So I came up with an `image` CI job that, similarly to Linux, collect together the required dependencies for running the pipeline. macOS doens't support a real Docker image, so this "image" is just a `.tar.gz` file hosted in the GitLab package registry.
There is a little problem with that: in GitLab uploading a new file in the package registry doesn't overwrite a file with the same name already available, even if the latest file is returned anyway. So the old versions basically pile up and have to be manually remove every now and then. Hopefully the environment is only seldom recreated, so the storage usage is not a concern.
As usual, pipelines for MRs that change the pipeline image itself are bound to fail. A demo pipeline is https://gitlab.winehq.org/giomasce/vkd3d/-/pipelines/20433.
-- v2: ci: Prepare the macOS build environment in a dedicated CI job.
From: Giovanni Mascellani gmascellani@codeweavers.com
--- gitlab/README | 2 +- gitlab/build.yml | 6 +++--- gitlab/image.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gitlab/README b/gitlab/README index 310912be2..3b5203233 100644 --- a/gitlab/README +++ b/gitlab/README @@ -5,7 +5,7 @@ vkd3d testing scripts These scripts are used by the GitLab CI feature to automatically run the vkd3d tests on each merge request.
-The CI target build-image, in the file image.yml, builds a Docker +The CI target image-linux, in the file image.yml, builds a Docker image based on Debian bookworm with all the packages required for testing, and uploads it to the GitLab container registry. The Docker script is in the file image.docker. diff --git a/gitlab/build.yml b/gitlab/build.yml index 9a19316b5..b87ab9695 100644 --- a/gitlab/build.yml +++ b/gitlab/build.yml @@ -5,7 +5,7 @@ image: $CI_REGISTRY/wine/vkd3d:debian-bookworm interruptible: true needs: - - job: build-image + - job: image-linux optional: true dependencies: [] script: @@ -68,7 +68,7 @@ build-crosstest: image: $CI_REGISTRY/wine/vkd3d:debian-bookworm interruptible: true needs: - - job: build-image + - job: image-linux optional: true dependencies: [] script: @@ -94,7 +94,7 @@ build-crosstest: image: $CI_REGISTRY/wine/vkd3d:debian-bookworm interruptible: true needs: - - job: build-image + - job: image-linux optional: true dependencies: [] script: diff --git a/gitlab/image.yml b/gitlab/image.yml index 45a87770b..cda71df6d 100644 --- a/gitlab/image.yml +++ b/gitlab/image.yml @@ -1,4 +1,4 @@ -build-image: +image-linux: stage: image rules: - if: $CI_PIPELINE_SOURCE == 'push' && $CI_PROJECT_PATH == "wine/vkd3d" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
From: Giovanni Mascellani gmascellani@codeweavers.com
--- gitlab/build.yml | 15 ++++++--------- gitlab/image.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/gitlab/build.yml b/gitlab/build.yml index b87ab9695..af68e9ef4 100644 --- a/gitlab/build.yml +++ b/gitlab/build.yml @@ -130,7 +130,9 @@ build-mac: exit_codes: - 2 interruptible: true - needs: [] + needs: + - job: image-mac + optional: true dependencies: [] tags: - mac @@ -147,14 +149,9 @@ build-mac: - 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 --branch wine-3.21 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" + - curl -o image.zip https://gitlab.winehq.org/api/v4/projects/wine%2Fvkd3d/jobs/artifacts/master... + - unzip image.zip + - export PATH="$PWD/image/bin:$PATH" - git rebase $CI_MERGE_REQUEST_DIFF_BASE_SHA --exec ./gitlab/build-mac - if [ -f build_failed ] ; then exit 1 ; fi - if [ -f tests_failed ] ; then exit 2 ; fi diff --git a/gitlab/image.yml b/gitlab/image.yml index cda71df6d..c93ea0d66 100644 --- a/gitlab/image.yml +++ b/gitlab/image.yml @@ -18,3 +18,32 @@ image-linux: - 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" + +image-mac: + 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 + interruptible: true + tags: + - mac + script: + - mkdir image + - cd image + - mkdir bin + - export PATH="/usr/local/opt/bison/bin:/usr/local/opt/flex/bin:$PATH" + - git clone --depth 1 --branch wine-3.21 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 ../.. + - cp wine/build/tools/widl/widl bin + - rm -fr wine + - cd .. + artifacts: + paths: + - image