Gitlab CI: Windows Configs (#43967)

Add support for Gitlab CI on Windows

This PR adds the config changes required to configure and execute
Gitlab pipelines running Windows builds on Windows runners using
the existing Gitlab CI infrastructure (and newly added Windows 
infrastructure).

* Adds support for generating child pipelines dispatched to Windows runners
* Refactors the relevant pre-scripts, scripts, and post scripts to be compatible with Windows
* Adds Windows config section describing Windows jobs
* Adds VTK as Windows build stack (to be expanded later)
* Modifies proj to build on Windows
* Refactors Windows rpath symlinking to avoid system libs and externals

---------

Co-authored-by: Ryan Krattiger <ryan.krattiger@kitware.com>
Co-authored-by: Mike VanDenburgh <michael.vandenburgh@kitware.com>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Scott Wittenburg <scott.wittenburg@kitware.com>
This commit is contained in:
John W. Parent
2024-05-16 19:00:02 -04:00
committed by GitHub
parent b894f996c0
commit 81fe460194
16 changed files with 220 additions and 31 deletions

View File

@@ -64,6 +64,11 @@ default:
SPACK_TARGET_PLATFORM: "linux"
SPACK_TARGET_ARCH: "ppc64le"
.win64-msvc2019:
variables:
SPACK_TARGET_PLATFORM: "win64"
SPACK_TARGET_ARCH: "x86_64"
########################################
# Job templates
########################################
@@ -72,6 +77,8 @@ default:
PIPELINE_MIRROR_TEMPLATE: "single-src-protected-mirrors.yaml.in"
# TODO: We can remove this when we drop the "deprecated" stack
PUSH_BUILDCACHE_DEPRECATED: "${PROTECTED_MIRROR_PUSH_DOMAIN}/${CI_COMMIT_REF_NAME}/${SPACK_CI_STACK_NAME}"
SPACK_CI_CONFIG_ROOT: "${CI_PROJECT_DIR}/share/spack/gitlab/cloud_pipelines/configs"
SPACK_CI_SCRIPTS_ROOT: "${CI_PROJECT_DIR}/share/spack/gitlab/cloud_pipelines/scripts"
rules:
- if: $SPACK_CI_DISABLE_STACKS =~ /.+/ && $SPACK_CI_STACK_NAME =~ $SPACK_CI_DISABLE_STACKS
@@ -114,16 +121,8 @@ default:
.generate-common:
stage: generate
script:
- uname -a || true
- grep -E 'vendor|model name' /proc/cpuinfo 2>/dev/null | sort -u || head -n10 /proc/cpuinfo 2>/dev/null || true
- nproc || true
- cat /proc/loadavg || true
- cat /proc/meminfo | grep 'MemTotal\|MemFree' || true
- . "./share/spack/setup-env.sh"
- spack --version
- cd share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME}
- spack env activate --without-view .
- export SPACK_CI_CONFIG_ROOT="${SPACK_ROOT}/share/spack/gitlab/cloud_pipelines/configs"
- spack env activate --without-view share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME}
- spack
--config-scope "${SPACK_CI_CONFIG_ROOT}"
--config-scope "${SPACK_CI_CONFIG_ROOT}/${SPACK_TARGET_PLATFORM}"
@@ -134,29 +133,25 @@ default:
--config-scope "${SPACK_CI_CONFIG_ROOT}"
--config-scope "${SPACK_CI_CONFIG_ROOT}/${SPACK_TARGET_PLATFORM}"
--config-scope "${SPACK_CI_CONFIG_ROOT}/${SPACK_TARGET_PLATFORM}/${SPACK_TARGET_ARCH}"
${CI_STACK_CONFIG_SCOPES}
audit configs
- spack python -c "import os,sys; print(os.path.expandvars(sys.stdin.read()))"
< "${SPACK_CI_CONFIG_ROOT}/${PIPELINE_MIRROR_TEMPLATE}" > "${SPACK_CI_CONFIG_ROOT}/mirrors.yaml"
# Command below needs to be `spack python` due to naming differences accross platforms
- spack python ${SPACK_CI_SCRIPTS_ROOT}/common/expand_vars.py
"${SPACK_CI_CONFIG_ROOT}/${PIPELINE_MIRROR_TEMPLATE}"
"${SPACK_CI_CONFIG_ROOT}/mirrors.yaml"
- spack config add -f "${SPACK_CI_CONFIG_ROOT}/mirrors.yaml"
- mkdir -p "${CI_PROJECT_DIR}/jobs_scratch_dir"
- mkdir "${CI_PROJECT_DIR}/jobs_scratch_dir"
- spack
--config-scope "${SPACK_CI_CONFIG_ROOT}"
--config-scope "${SPACK_CI_CONFIG_ROOT}/${SPACK_TARGET_PLATFORM}"
--config-scope "${SPACK_CI_CONFIG_ROOT}/${SPACK_TARGET_PLATFORM}/${SPACK_TARGET_ARCH}"
${CI_STACK_CONFIG_SCOPES}
config blame > "${CI_PROJECT_DIR}/jobs_scratch_dir/spack.yaml.blame"
- spack -v --color=always
--config-scope "${SPACK_CI_CONFIG_ROOT}"
--config-scope "${SPACK_CI_CONFIG_ROOT}/${SPACK_TARGET_PLATFORM}"
--config-scope "${SPACK_CI_CONFIG_ROOT}/${SPACK_TARGET_PLATFORM}/${SPACK_TARGET_ARCH}"
${CI_STACK_CONFIG_SCOPES}
ci generate --check-index-only
--artifacts-root "${CI_PROJECT_DIR}/jobs_scratch_dir"
--output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
after_script:
- cat /proc/loadavg || true
- cat /proc/meminfo | grep 'MemTotal\|MemFree' || true
artifacts:
paths:
- "${CI_PROJECT_DIR}/jobs_scratch_dir"
@@ -179,6 +174,16 @@ default:
# Generate without tags for cases using external runners
.generate-base:
extends: [ ".base-job", ".generate-common" ]
before_script:
- uname -a || true
- grep -E 'vendor|model name' /proc/cpuinfo 2>/dev/null | sort -u || head -n10 /proc/cpuinfo 2>/dev/null || true
- nproc || true
- cat /proc/loadavg || true
- cat /proc/meminfo | grep 'MemTotal\|MemFree' || true
- . "./share/spack/setup-env.sh"
after_script:
- cat /proc/loadavg || true
- cat /proc/meminfo | grep 'MemTotal\|MemFree' || true
.generate-x86_64:
extends: [ ".generate-base" ]
@@ -196,6 +201,25 @@ default:
extends: [ ".generate-base" ]
tags: ["spack", "public", "medium", "neoverse_v2"]
.generate-win64:
extends: [ ".base-job", ".generate-common" ]
before_script:
- $ErrorActionOld=$ErrorActionPreference
- $ErrorActionPreference="SilentlyContinue"
- python -c"import psutil;print(psutil.getloadavg())"
- (Get-WmiObject Win32_PhysicalMemory | measure-object Capacity -sum).sum/1kb
- $ErrorActionPreference=$ErrorActionOld
- . .\share\spack\setup-env.ps1
after_script:
- $ErrorActionOld=$ErrorActionPreference
- $ErrorActionPreference="SilentlyContinue"
- python -c"import psutil;print(psutil.getloadavg())"
- (Get-WmiObject Win32_PhysicalMemory | measure-object Capacity -sum).sum/1kb
- $ErrorActionPreference=$ErrorActionOld
tags: ["spack", "public", "medium", "x86_64-win"]
image: "ghcr.io/johnwparent/windows-server21h2:sha-c749cf3"
.generate-deprecated:
extends: [ ".base-job" ]
stage: generate
@@ -859,6 +883,15 @@ aws-pcluster-build-neoverse_v1:
- echo $PATH
- module avail
- module list
- uname -a || true
- grep -E 'vendor|model name' /proc/cpuinfo 2>/dev/null | sort -u || head -n10 /proc/cpuinfo 2>/dev/null || true
- nproc || true
- cat /proc/loadavg || true
- cat /proc/meminfo | grep 'MemTotal\|MemFree' || true
- . "./share/spack/setup-env.sh"
after_script:
- cat /proc/loadavg || true
- cat /proc/meminfo | grep 'MemTotal\|MemFree' || true
.generate-cray-rhel:
tags: [ "cray-rhel-zen4", "public" ]
@@ -912,3 +945,25 @@ e4s-cray-sles-build:
needs:
- artifacts: True
job: e4s-cray-sles-generate
#######################################
# Windows Visualization Tools
#######################################
.windows-vis:
extends: [".win64-msvc2019"]
variables:
SPACK_CI_STACK_NAME: windows-vis
windows-vis-generate:
extends: [ ".generate-win64", ".windows-vis" ]
windows-vis-build:
extends: [ ".build", ".windows-vis"]
trigger:
include:
- artifact: jobs_scratch_dir/cloud-ci-pipeline.yml
job: windows-vis-generate
strategy: depend
needs:
- artifacts: True
job: windows-vis-generate

View File

@@ -0,0 +1,18 @@
ci:
pipeline-gen:
- build-job:
after_script::
- Write-Output "Done"
before_script::
- fsutil 8dot3name set C:\ 0
- . .\share\spack\setup-env.ps1
- If (Test-Path -path C:\\key\intermediate_ci_signing_key.gpg) { spack.ps1 gpg trust C:\\key\intermediate_ci_signing_key.gpg }
- If (Test-Path -path C:\\key\spack_public_key.gpg) { spack.ps1 gpg trust C:\\key\spack_public_key.gpg }
script::
- spack.ps1 env activate --without-view ${SPACK_CONCRETE_ENV_DIR}
- spack.ps1 config add "config:install_tree:projections:${SPACK_JOB_SPEC_PKG_NAME}:'morepadding/{hash}'"
- mkdir ${SPACK_ARTIFACTS_ROOT}/user_data
- spack.ps1 --backtrace ci rebuild | Tee-Object -FilePath "${env:SPACK_ARTIFACTS_ROOT}/user_data/pipeline_out.txt" 2>&1 | Tee-Object -FilePath "${env:SPACK_ARTIFACTS_ROOT}/user_data/pipeline_err.txt"
image: "ghcr.io/johnwparent/windows-server21h2:sha-c749cf3"

View File

@@ -0,0 +1,10 @@
config:
build_stage::
- 'C:/spack stage'
install_tree:
root: "C:/spack install"
# Path lengths on windows doesn't support much padding
padded_length: 0
# Reduce the projections to only including the hash to avoid path length issues
projections:
all: '{hash}'

View File

@@ -0,0 +1,25 @@
packages:
all:
target: [x86_64]
tbb:
require: "intel-tbb"
cmake:
externals:
- spec: cmake@3.28.0-msvc1
prefix: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake"
buildable: False
ninja:
externals:
- spec: ninja@1.11.0
prefix: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja"
buildable: False
wgl:
externals:
- spec: wgl@10.0.22621 plat=x64
prefix: "C:\\Program Files (x86)\\Windows Kits\\10"
buildable: False
win-sdk:
externals:
- spec: win-sdk@10.0.22621 plat=x64
prefix: "C:\\Program Files (x86)\\Windows Kits\\10"
buildable: False

View File

@@ -0,0 +1,4 @@
ci:
pipeline-gen:
- build-job:
tags: [x86_64-win]

View File

@@ -0,0 +1,3 @@
packages:
all:
target: [x86_64]

View File

@@ -0,0 +1,10 @@
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("input", type=argparse.FileType("r"))
parser.add_argument("out", type=argparse.FileType("w"))
args = parser.parse_args()
args.out.write(os.path.expandvars(args.input.read()))

View File

@@ -0,0 +1,12 @@
# Windows Visualization Stack
# maintainers:
# - John Parent (@johnwparent)
# - Ryan Krattiger (@kwryankrattiger)
spack:
view: false
specs:
- vtk
cdash:
build-group: Windows Visualization (Kitware)