From 3da281c468ab6fdc52f248f77e209766ca88ab71 Mon Sep 17 00:00:00 2001 From: Bruno Date: Fri, 3 Jan 2025 10:26:19 -0300 Subject: [PATCH] gitlab-ci, build/windows: Move Windows jobs to 'matrix' This facilitate maintenance work and further vcpkg integration. --- .gitlab-ci.yml | 173 ++++++------------- build/windows/1_build-deps-msys2.ps1 | 8 +- build/windows/2_build-gimp-msys2.ps1 | 12 +- build/windows/2_bundle-gimp-uni_base.sh | 12 +- build/windows/installer/3_dist-gimp-inno.ps1 | 14 +- build/windows/store/3_dist-gimp-winsdk.ps1 | 6 +- 6 files changed, 74 insertions(+), 151 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5da6affeae..847faa8de3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,17 +72,13 @@ workflow: variables: CCACHE_BASEDIR: "$CI_PROJECT_DIR" CCACHE_DIR: "$CI_PROJECT_DIR/_ccache" - CC: "ccache clang" - CXX: "ccache clang++" - CC_LD: lld - CXX_LD: lld cache: - key: ${CI_JOB_NAME}${VARIANT} + key: ${CI_JOB_NAME_SLUG}${VARIANT} paths: - _ccache/ # Common artifacts behavior artifacts: - name: "${CI_JOB_NAME}${VARIANT}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" + name: "${CI_JOB_NAME_SLUG}${VARIANT}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" when: always variables: @@ -114,6 +110,11 @@ stages: tags: - $RUNNER image: $CI_REGISTRY_IMAGE:build-debian-latest-${RUNNER} + variables: + CC: "ccache clang" + CXX: "ccache clang++" + CC_LD: lld + CXX_LD: lld before_script: - export GIMP_PREFIX="${CI_PROJECT_DIR}/_install-${RUNNER}" - echo -e "\e[0Ksection_start:`date +%s`:environ[collapsed=true]\r\e[0KPreparing build environment" @@ -514,45 +515,41 @@ gimp-win-x64-cross: expire_in: 2 days ## WINDOWS pipelines (native MSYS2) ## -## Since our build pipelines are split (for good reasons) into deps and gimp jobs, -## 'matrix' isn't useful yet: https://gitlab.com/gitlab-org/gitlab/-/issues/396845 .win: extends: .default rules: - - if: '$CI_MERGE_REQUEST_LABELS =~ /.*5. Windows Installer.*/ && $CI_MERGE_REQUEST_LABELS =~ /.*5. Microsoft Store.*/' + - if: ($CI_MERGE_REQUEST_LABELS =~ /.*5. Windows Installer.*/ && $CI_MERGE_REQUEST_LABELS =~ /.*5. Microsoft Store.*/) || ($GIMP_CI_WIN_INSTALLER != null && $GIMP_CI_MS_STORE != null) interruptible: true variables: INSTALLER_OPTION: '-Dwindows-installer=true' STORE_OPTION: '-Dms-store=true' - - if: '$CI_MERGE_REQUEST_LABELS =~ /.*5. Windows Installer.*/' + - if: $CI_MERGE_REQUEST_LABELS =~ /.*5. Windows Installer.*/ || $GIMP_CI_WIN_INSTALLER != null interruptible: true variables: INSTALLER_OPTION: '-Dwindows-installer=true' - - if: '$CI_MERGE_REQUEST_LABELS =~ /.*5. Microsoft Store.*/ && $CI_JOB_NAME =~ /.*64.*/' + - if: ($CI_MERGE_REQUEST_LABELS =~ /.*5. Microsoft Store.*/ || $GIMP_CI_MS_STORE != null) && $CI_JOB_NAME !~ /.*86.*/ && $CI_JOB_NAME !~ /.*installer.*/ interruptible: true variables: STORE_OPTION: '-Dms-store=true' - - if: '$GIMP_CI_WIN_INSTALLER != null && $GIMP_CI_MS_STORE != null' - variables: - INSTALLER_OPTION: '-Dwindows-installer=true' - STORE_OPTION: '-Dms-store=true' - - if: '$GIMP_CI_WIN_INSTALLER != null' - variables: - INSTALLER_OPTION: '-Dwindows-installer=true' - - if: '$GIMP_CI_MS_STORE != null && $CI_JOB_NAME =~ /.*64.*/' - variables: - STORE_OPTION: '-Dms-store=true' - <<: *CI_RELEASE variables: INSTALLER_OPTION: '-Dwindows-installer=true' STORE_OPTION: '-Dms-store=true' + parallel: + matrix: + - RUNNER: windows-aarch64 + MSYSTEM_PREFIX: clangarm64 + - RUNNER: win32-ps + MSYSTEM_PREFIX: clang64 + tags: + - $RUNNER before_script: # MSYS2 config - $MSYS2_PREFIX = 'C:/msys64' - $env:Path = "$MSYS2_PREFIX/$MSYSTEM_PREFIX/bin;$MSYS2_PREFIX/usr/bin;" + $env:Path # Build-time vars # FIXME:'gimpenv' have buggy code about Windows paths. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/12284 - - $GIMP_PREFIX = "$PWD\_install".Replace('\', '/') + - $GIMP_PREFIX = "$PWD\_install-$MSYSTEM_PREFIX".Replace('\', '/') - Write-Output "$([char]27)[0Ksection_start:$(Get-Date -UFormat %s -Millisecond 0):win_environ[collapsed=true]$([char]13)$([char]27)[0KPreparing build environment" - $env:Path = $env:Path + ";$GIMP_PREFIX/bin" - $env:PKG_CONFIG_PATH = "$MSYS2_PREFIX/$MSYSTEM_PREFIX/lib/pkgconfig;$MSYS2_PREFIX/$MSYSTEM_PREFIX/share/pkgconfig;$GIMP_PREFIX/lib/pkgconfig" @@ -560,21 +557,10 @@ gimp-win-x64-cross: - $env:GI_TYPELIB_PATH = "$MSYS2_PREFIX/$MSYSTEM_PREFIX/lib/girepository-1.0;$GIMP_PREFIX/lib/girepository-1.0" - Write-Output "$([char]27)[0Ksection_end:$(Get-Date -UFormat %s -Millisecond 0):win_environ$([char]13)$([char]27)[0K" -## WINDOWS Aarch64 CI (native MSYS2) ## -.win-a64: +deps-win: extends: .win rules: - !reference [.win, rules] - - if: '$GIMP_CI_MSYS2_WIN_AARCH64 != null' - tags: - - windows-aarch64 - variables: - MSYSTEM_PREFIX: clangarm64 - -deps-win-a64: - extends: .win-a64 - rules: - - !reference [.win-a64, rules] needs: [] stage: dependencies variables: @@ -583,16 +569,16 @@ deps-win-a64: - build/windows/1_build-deps-msys2.ps1 artifacts: paths: - - _install/ - - babl/_build/meson-logs/meson-log.txt - - gegl/_build/meson-logs/meson-log.txt + - _install-$MSYSTEM_PREFIX/ + - babl/_build-$MSYSTEM_PREFIX/meson-logs/meson-log.txt + - gegl/_build-$MSYSTEM_PREFIX/meson-logs/meson-log.txt expire_in: 2 hours -gimp-win-a64: - extends: .win-a64 +gimp-win: + extends: .win rules: - - !reference [.win-a64, rules] - needs: ["deps-win-a64"] + - !reference [.win, rules] + needs: ["deps-win"] stage: gimp variables: GIT_SUBMODULE_STRATEGY: recursive @@ -601,106 +587,49 @@ gimp-win-a64: - build/windows/2_build-gimp-msys2.ps1 artifacts: paths: - - gimp-a64/ - - _build/meson-logs/meson-log.txt - - _build/done-dll.list + - gimp-$MSYSTEM_PREFIX/ + - _build-$MSYSTEM_PREFIX/meson-logs/meson-log.txt + - _build-$MSYSTEM_PREFIX/done-dll.list # Needed by dist-installer-weekly and dist-store-weekly - - _build/config.h - - _build/build/windows/installer/ - - _build/build/windows/store/ + - _build-$MSYSTEM_PREFIX/config.h + - _build-$MSYSTEM_PREFIX/build/windows/installer/ + - _build-$MSYSTEM_PREFIX/build/windows/store/ expire_in: 2 days -## WINDOWS x86_64 CI (native MSYS2) ## - -.win-x64: - extends: .win - rules: - - !reference [.win, rules] - - if: '$GIMP_CI_MSYS2_WIN64 != null' - tags: - - win32-ps - variables: - MSYSTEM_PREFIX: clang64 - -deps-win-x64: - extends: .win-x64 - rules: - - !reference [.win-x64, rules] - needs: [] - stage: dependencies - variables: - CCACHE_MAXSIZE: 0.25G - script: - - build/windows/1_build-deps-msys2.ps1 - artifacts: - paths: - - _install/ - expire_in: 2 hours - -gimp-win-x64: - extends: .win-x64 - rules: - - !reference [.win-x64, rules] - needs: ["deps-win-x64"] - stage: gimp - variables: - GIT_SUBMODULE_STRATEGY: recursive - CCACHE_MAXSIZE: 0.75G - script: - - build/windows/2_build-gimp-msys2.ps1 - artifacts: - paths: - - gimp-x64/ - - _build/done-dll.list - expire_in: 2 days - -## WINDOWS x86 CI (native MSYS2) ## - +## WINDOWS x86 legacy CI (native MSYS2) ## .win-x86: extends: .win rules: - !reference [.win, rules] - if: '$GIMP_CI_MSYS2_WIN32 != null' - tags: - - win32-ps - variables: - MSYSTEM_PREFIX: mingw32 - MINGW_PACKAGE_PREFIX: mingw-w64-i686 - CC: cc - CXX: c++ - CC_LD: bfd - CXX_LD: bfd + parallel: + matrix: + - RUNNER: win32-ps + MSYSTEM_PREFIX: mingw32 deps-win-x86: extends: .win-x86 rules: - !reference [.win-x86, rules] needs: [] - stage: dependencies + stage: !reference [deps-win, stage] + variables: !reference [deps-win, variables] script: - - build/windows/1_build-deps-msys2.ps1 - artifacts: - paths: - - _install/ - expire_in: 2 hours + - !reference [deps-win, script] + artifacts: !reference [deps-win, artifacts] gimp-win-x86: extends: .win-x86 rules: - !reference [.win-x86, rules] needs: ["deps-win-x86"] - stage: gimp - variables: - GIT_SUBMODULE_STRATEGY: recursive + stage: !reference [gimp-win, stage] + variables: !reference [gimp-win, variables] script: - - build/windows/2_build-gimp-msys2.ps1 + - !reference [gimp-win, script] # We split 32-bit DWARF symbols here because LLVM-objcopy do NOT support them - - bash build/windows/installer/3_dist-gimp-inno_sym.sh gimp-x86 - artifacts: - paths: - - gimp-x86/ - - _build/done-dll.list - expire_in: 2 days + - bash build/windows/installer/3_dist-gimp-inno_sym.sh gimp-$MSYSTEM_PREFIX + artifacts: !reference [gimp-win, artifacts] ## Analysis ## @@ -908,10 +837,10 @@ dist-flatpak-weekly: expire_in: 8 days dist-installer-weekly: - extends: .win + extends: .default rules: - !reference [.win, rules] - needs: ["gimp-win-a64", "gimp-win-x64", "gimp-win-x86"] + needs: ["gimp-win", "gimp-win-x86"] stage: distribution tags: - windows-aarch64 @@ -926,13 +855,13 @@ dist-installer-weekly: expire_in: 8 days dist-store-weekly: - extends: .win + extends: .default rules: - if: '$CI_MERGE_REQUEST_LABELS =~ /.*5. Microsoft Store.*/' interruptible: true - if: '$GIMP_CI_MS_STORE != null' - <<: *CI_RELEASE - needs: ["gimp-win-a64", "gimp-win-x64"] + needs: ["gimp-win"] stage: distribution tags: - win32-ps diff --git a/build/windows/1_build-deps-msys2.ps1 b/build/windows/1_build-deps-msys2.ps1 index 68cdae4bf3..bf380b9717 100644 --- a/build/windows/1_build-deps-msys2.ps1 +++ b/build/windows/1_build-deps-msys2.ps1 @@ -26,6 +26,8 @@ $MSYS2_PREFIX = 'C:/msys64' if ($MSYSTEM_PREFIX -eq 'mingw32') { Write-Host '(WARNING): 32-bit builds will be dropped in a future release. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/10922' -ForegroundColor Yellow + $MSYSTEM_PREFIX = 'mingw32' + $MINGW_PACKAGE_PREFIX = 'mingw-w64-i686' } elseif ((Get-WmiObject -Class Win32_ComputerSystem).SystemType -like 'ARM64*') { @@ -90,11 +92,11 @@ function self_build ([string]$dep, [string]$option1, [string]$option2) git pull ## Configure and/or build - if (-not (Test-Path _build\build.ninja -Type Leaf)) + if (-not (Test-Path _build-$MSYSTEM_PREFIX\build.ninja -Type Leaf)) { - meson setup _build -Dprefix="$GIMP_PREFIX" $option1 $option2 + meson setup _build-$MSYSTEM_PREFIX -Dprefix="$GIMP_PREFIX" $option1 $option2 } - Set-Location _build + Set-Location _build-$MSYSTEM_PREFIX ninja ninja install if ("$LASTEXITCODE" -gt '0' -or "$?" -eq 'False') diff --git a/build/windows/2_build-gimp-msys2.ps1 b/build/windows/2_build-gimp-msys2.ps1 index bdfacf3c5f..4b5b9ee9b1 100644 --- a/build/windows/2_build-gimp-msys2.ps1 +++ b/build/windows/2_build-gimp-msys2.ps1 @@ -23,7 +23,7 @@ if (-not $GITLAB_CI) # Install the required (pre-built) packages for babl, GEGL and GIMP (again) -Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS2_PREFIX =' -Context 0,15) -replace '> ','') +Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS2_PREFIX =' -Context 0,17) -replace '> ','') if ($GITLAB_CI) { @@ -46,15 +46,15 @@ if (-not $GITLAB_CI) # Build GIMP Write-Output "$([char]27)[0Ksection_start:$(Get-Date -UFormat %s -Millisecond 0):gimp_build[collapsed=true]$([char]13)$([char]27)[0KBuilding GIMP" -if (-not (Test-Path _build\build.ninja -Type Leaf)) +if (-not (Test-Path _build-$MSYSTEM_PREFIX\build.ninja -Type Leaf)) { #FIXME: g-ir-doc is broken. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/11200 #There is no GJS for Windows. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/5891 - meson setup _build -Dprefix="$GIMP_PREFIX" -Djavascript=disabled ` - -Ddirectx-sdk-dir="$MSYS2_PREFIX/$MSYSTEM_PREFIX" -Denable-default-bin=enabled ` - -Dbuild-id='org.gimp.GIMP_official' $INSTALLER_OPTION $STORE_OPTION $NON_RELOCATABLE_OPTION + meson setup _build-$MSYSTEM_PREFIX -Dprefix="$GIMP_PREFIX" -Djavascript=disabled ` + -Ddirectx-sdk-dir="$MSYS2_PREFIX/$MSYSTEM_PREFIX" -Denable-default-bin=enabled ` + -Dbuild-id='org.gimp.GIMP_official' $INSTALLER_OPTION $STORE_OPTION $NON_RELOCATABLE_OPTION } -Set-Location _build +Set-Location _build-$MSYSTEM_PREFIX ninja ccache --show-stats Write-Output "$([char]27)[0Ksection_end:$(Get-Date -UFormat %s -Millisecond 0):gimp_build$([char]13)$([char]27)[0K" diff --git a/build/windows/2_bundle-gimp-uni_base.sh b/build/windows/2_bundle-gimp-uni_base.sh index 2a9f947f3f..def67fdf63 100644 --- a/build/windows/2_bundle-gimp-uni_base.sh +++ b/build/windows/2_bundle-gimp-uni_base.sh @@ -39,17 +39,9 @@ if [ "$CROSSROAD_PLATFORM" ]; then export MSYS_PREFIX="$CROSSROAD_PREFIX/../msys2" fi ## Bundle dir: we make a "perfect" bundle separated from GIMP_PREFIX -#NOTE: The bundling script need to set ARTIFACTS_SUFFIX to our dist scripts +#NOTE: The bundling script need to set $MSYSTEM_PREFIX to our dist scripts #fallback code be able to identify what arch they are distributing -#https://github.com/msys2/MSYS2-packages/issues/4960 -if [[ "$MSYS_PREFIX" =~ "clangarm64" ]]; then - export ARTIFACTS_SUFFIX="a64" -elif [[ "$MSYS_PREFIX" =~ "clang64" ]] || [ "$CROSSROAD_PLATFORM" = "w64" ]; then - export ARTIFACTS_SUFFIX="x64" -else # [ "$MSYS_PREFIX" =~ "mingw32" ]; - export ARTIFACTS_SUFFIX="x86" -fi -export GIMP_DISTRIB="$GIMP_SOURCE/gimp-${ARTIFACTS_SUFFIX}" +export GIMP_DISTRIB="$GIMP_SOURCE/gimp-$MSYSTEM_PREFIX" bundle () { diff --git a/build/windows/installer/3_dist-gimp-inno.ps1 b/build/windows/installer/3_dist-gimp-inno.ps1 index 906c68b9ea..cccf86ccdd 100644 --- a/build/windows/installer/3_dist-gimp-inno.ps1 +++ b/build/windows/installer/3_dist-gimp-inno.ps1 @@ -3,17 +3,17 @@ # Parameters param ($revision = "$GIMP_CI_WIN_INSTALLER", $GIMP_BASE = "$PWD", - $BUILD_DIR = "$GIMP_BASE\_build", - $GIMP32 = 'gimp-x86', - $GIMP64 = 'gimp-x64', - $GIMPA64 = 'gimp-a64') + $BUILD_DIR = (Get-ChildItem $GIMP_BASE\_build* | Select-Object -First 1), + $GIMP32 = 'gimp-mingw32', + $GIMP64 = 'gimp-clang64', + $GIMPA64 = 'gimp-clangarm64') $ErrorActionPreference = 'Stop' $PSNativeCommandUseErrorActionPreference = $true # This script needs a bit of MSYS2 to work -Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS2_PREFIX =' -Context 0,15) -replace '> ','') +Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS2_PREFIX =' -Context 0,17) -replace '> ','') # 1. GET INNO @@ -202,10 +202,10 @@ foreach ($bundle in $supported_archs) Set-Content "$bundle\share\gimp\*\gimp-release" ## Split .debug symbols - if ("$bundle" -eq 'gimp-x86') + if ("$bundle" -eq "$GIMP32") { #We do not split 32-bit DWARF symbols here (they were in gimp-win-x86 job) - Write-Output "(INFO): skipping (already done) gimp-x86 .debug extracting" + Write-Output "(INFO): skipping (already done) $GIMP32 .debug extracting" } else { diff --git a/build/windows/store/3_dist-gimp-winsdk.ps1 b/build/windows/store/3_dist-gimp-winsdk.ps1 index 4230ff31a9..731684152d 100644 --- a/build/windows/store/3_dist-gimp-winsdk.ps1 +++ b/build/windows/store/3_dist-gimp-winsdk.ps1 @@ -3,9 +3,9 @@ # Parameters param ($revision = "$GIMP_CI_MS_STORE", $wack = 'Non-WACK', - $build_dir = '_build', - $a64_bundle = 'gimp-a64', - $x64_bundle = 'gimp-x64') + $build_dir = (Get-ChildItem _build* | Select-Object -First 1), + $a64_bundle = 'gimp-clangarm64', + $x64_bundle = 'gimp-clang64') $ErrorActionPreference = 'Stop' $PSNativeCommandUseErrorActionPreference = $true