From ef3495f74f9c35684a2596c1019b08f1787a0376 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 22 Apr 2024 18:11:11 -0400 Subject: [PATCH 1/3] ci: Factor out scripts to add cmake to job environment --- .gitlab/ci/cmake-env.ps1 | 5 +++++ .gitlab/ci/cmake-env.sh | 3 +++ .gitlab/os-linux.yml | 4 +--- .gitlab/os-macos.yml | 4 +--- .gitlab/os-windows.yml | 6 +----- 5 files changed, 11 insertions(+), 11 deletions(-) create mode 100755 .gitlab/ci/cmake-env.ps1 create mode 100644 .gitlab/ci/cmake-env.sh diff --git a/.gitlab/ci/cmake-env.ps1 b/.gitlab/ci/cmake-env.ps1 new file mode 100755 index 0000000000..505fa44631 --- /dev/null +++ b/.gitlab/ci/cmake-env.ps1 @@ -0,0 +1,5 @@ +$pwdpath = $pwd.Path +& "$pwsh" -File ".gitlab/ci/cmake.ps1" +Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\cmake\bin;$env:PATH" +cmake --version +$cmake = "cmake" diff --git a/.gitlab/ci/cmake-env.sh b/.gitlab/ci/cmake-env.sh new file mode 100644 index 0000000000..686a78f379 --- /dev/null +++ b/.gitlab/ci/cmake-env.sh @@ -0,0 +1,3 @@ +.gitlab/ci/cmake.sh +export PATH="$PWD/.gitlab/cmake/bin:$PATH" +cmake --version diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index dc32016f08..11b478002b 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -511,11 +511,9 @@ .before_script_linux: &before_script_linux - source .gitlab/ci/env.sh - - .gitlab/ci/cmake.sh - - export PATH=$PWD/.gitlab/cmake/bin:$PATH + - source .gitlab/ci/cmake-env.sh - .gitlab/ci/ninja.sh - export PATH=$PWD/.gitlab:$PATH - - cmake --version - ninja --version .cmake_prep_source_linux: diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 23c68d5d33..5d148e01d0 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -175,11 +175,9 @@ .before_script_macos: &before_script_macos - source .gitlab/ci/env.sh - - .gitlab/ci/cmake.sh - - export PATH=$PWD/.gitlab/cmake/bin:$PATH + - source .gitlab/ci/cmake-env.sh - .gitlab/ci/ninja.sh - export PATH=$PWD/.gitlab:$PATH - - cmake --version - ninja --version # Download Qt - cmake -P .gitlab/ci/download_qt.cmake diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 3cd6e56347..a0e22bf714 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -386,12 +386,8 @@ .before_script_windows: &before_script_windows - . .gitlab/ci/env.ps1 - - $pwdpath = $pwd.Path - - (& "$pwsh" -File ".gitlab/ci/cmake.ps1") - - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\cmake\bin;$env:PATH" - - $cmake = "cmake" + - . .gitlab/ci/cmake-env.ps1 - . .gitlab/ci/ninja-env.ps1 - - cmake --version - . .gitlab/ci/qt-env.ps1 - . .gitlab/ci/python-env.ps1 From b0f7aebc774a7d83fb197fc3431e99f2e8215480 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 22 Apr 2024 18:17:28 -0400 Subject: [PATCH 2/3] ci: Factor out scripts to add ninja to job environment --- .gitlab/ci/ninja-env.sh | 3 +++ .gitlab/os-linux.yml | 4 +--- .gitlab/os-macos.yml | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 .gitlab/ci/ninja-env.sh diff --git a/.gitlab/ci/ninja-env.sh b/.gitlab/ci/ninja-env.sh new file mode 100644 index 0000000000..744b9f3271 --- /dev/null +++ b/.gitlab/ci/ninja-env.sh @@ -0,0 +1,3 @@ +.gitlab/ci/ninja.sh +export PATH=$PWD/.gitlab:$PATH +ninja --version diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 11b478002b..274b62eda6 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -512,9 +512,7 @@ .before_script_linux: &before_script_linux - source .gitlab/ci/env.sh - source .gitlab/ci/cmake-env.sh - - .gitlab/ci/ninja.sh - - export PATH=$PWD/.gitlab:$PATH - - ninja --version + - source .gitlab/ci/ninja-env.sh .cmake_prep_source_linux: stage: prep diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 5d148e01d0..894d6242cf 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -176,9 +176,7 @@ .before_script_macos: &before_script_macos - source .gitlab/ci/env.sh - source .gitlab/ci/cmake-env.sh - - .gitlab/ci/ninja.sh - - export PATH=$PWD/.gitlab:$PATH - - ninja --version + - source .gitlab/ci/ninja-env.sh # Download Qt - cmake -P .gitlab/ci/download_qt.cmake - export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH} From bf973c41e53adbe21a415c8855dbf4c9fc990c90 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 22 Apr 2024 18:20:47 -0400 Subject: [PATCH 3/3] ci: Factor out scripts to add sccache to job environment --- .gitlab/ci/sccache-env.ps1 | 1 + .gitlab/ci/sccache-env.sh | 2 ++ .gitlab/os-linux.yml | 3 +-- .gitlab/os-windows.yml | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100755 .gitlab/ci/sccache-env.ps1 create mode 100644 .gitlab/ci/sccache-env.sh diff --git a/.gitlab/ci/sccache-env.ps1 b/.gitlab/ci/sccache-env.ps1 new file mode 100755 index 0000000000..66dc6ebb31 --- /dev/null +++ b/.gitlab/ci/sccache-env.ps1 @@ -0,0 +1 @@ +Set-Item -Force -Path "env:PATH" -Value "$env:PATH;$env:SCCACHE_PATH" diff --git a/.gitlab/ci/sccache-env.sh b/.gitlab/ci/sccache-env.sh new file mode 100644 index 0000000000..4b170a47d9 --- /dev/null +++ b/.gitlab/ci/sccache-env.sh @@ -0,0 +1,2 @@ +.gitlab/ci/sccache.sh +export PATH="$PWD/.gitlab:$PATH" diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 274b62eda6..03778c2305 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -587,8 +587,7 @@ - mkdir -p build/ - cp Utilities/Release/linux/$CMAKE_ARCH/cache.txt build/CMakeCache.txt # Make sccache available. - - .gitlab/ci/sccache.sh - - export PATH=$PWD/.gitlab:$PATH + - source .gitlab/ci/sccache-env.sh # Append sccache settings to the cache. - echo "CMAKE_C_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt - echo "CMAKE_CXX_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index a0e22bf714..1372136f94 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -400,7 +400,7 @@ script: - *before_script_windows - - Set-Item -Force -Path "env:PATH" -Value "$env:PATH;$env:SCCACHE_PATH" + - . .gitlab/ci/sccache-env.ps1 - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1 - sccache --start-server - sccache --show-stats