Browse Source

ci: Factor out scripts to add cmake to job environment

Brad King 1 year ago
parent
commit
ef3495f74f
5 changed files with 11 additions and 11 deletions
  1. 5 0
      .gitlab/ci/cmake-env.ps1
  2. 3 0
      .gitlab/ci/cmake-env.sh
  3. 1 3
      .gitlab/os-linux.yml
  4. 1 3
      .gitlab/os-macos.yml
  5. 1 5
      .gitlab/os-windows.yml

+ 5 - 0
.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"

+ 3 - 0
.gitlab/ci/cmake-env.sh

@@ -0,0 +1,3 @@
+.gitlab/ci/cmake.sh
+export PATH="$PWD/.gitlab/cmake/bin:$PATH"
+cmake --version

+ 1 - 3
.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:

+ 1 - 3
.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

+ 1 - 5
.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