forked from NOAA-EMC/global-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
123 lines (110 loc) · 4.98 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
123 lines (110 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# ==========================================================================
# Main GitLab CI Configuration for the global-workflow Project
# ==========================================================================
#
# This is the primary CI/CD configuration file that orchestrates the GitLab CI
# testing framework for the global-workflow project. It defines pipeline stages
# and includes specialized configuration files for different testing aspects.
#
# The pipeline architecture supports:
# 1. Multiple host environments (hera, gaeac6, etc.)
# 2. Two primary testing modes:
# - PR validation via standard test cases
# - CTest-based tests triggered via GitHub API
#
# Included files:
# - .gitlab-ci-ctests.yml: Handles CMake/CTest-based testing framework
# - .gitlab-ci-cases.yml: Defines templates for standard experiment cases
# - .gitlab-ci-hosts.yml: Contains host-specific configurations and test matrices
# that can be extended to support additional hosts
#
# The host configuration in .gitlab-ci-hosts.yml is designed to be easily
# extended with new computing platforms and allows per-host specification
# of which test cases to run.
stages:
- build
- setup_tests
- run_tests
- finalize
variables:
PIPELINE_TYPE: pr_cases # Default to PR Cases if not overwritten by GitLab Scheduled Pipelines
RUN_ON_MACHINES: all # Default to all machines (overwritten by triggers)
# Set GFS_CI_RUN_TYPE=nightly in the GitLab Scheuled Pipelines
# to run the nightly against the develop branch
GFS_CI_RUN_TYPE: pr_cases # default value (overwritten by GitLab Scheuled Pipelines)
GW_REPO_URL: https://github.com/NOAA-EMC/global-workflow.git
# Using CI_PIPELINE_ID guarantees uniqueness per pipeline (also used for pslot tags)
WORKSPACE_ID: ${GFS_CI_RUN_TYPE}_${CI_COMMIT_SHORT_SHA}_${CI_PIPELINE_ID}
# Define a base path that will be used for initial cloning
GIT_CLONE_PATH: ${CI_BUILDS_DIR}/${WORKSPACE_ID}/global-workflow
GIT_DEPTH: 10
RUNNER_SCRIPT_TIMEOUT: 8h
RUNNER_AFTER_SCRIPT_TIMEOUT: 8h
PR_NUMBER: 0 # PR number is set by GitHub Actions
# when the pipeline is triggered from a PR
# Include specialized pipeline configuration files
include:
- local: 'dev/ci/gitlab-ci-ctests.yml' # CTest framework configuration
- local: 'dev/ci/gitlab-ci-cases.yml' # Standard test pr case templates
- local: 'dev/ci/gitlab-ci-hosts.yml' # Host configurations, modality logic, and test lists
.base_config:
variables:
GIT_STRATEGY: none
before_script:
- |
export GW_RUN_PATH="${CI_BUILDS_DIR}/${WORKSPACE_ID}"
export GW_HOMEgfs="${GIT_CLONE_PATH}" # This is set by GitLab for initial clone
export RUNTESTS_DIR="${GW_RUN_PATH}/RUNTESTS"
PR_NUMBER=${PR_NUMBER:-0}
if [[ "${PIPELINE_TYPE}" == "ctests" ]]; then
GFS_CI_RUN_TYPE="ctests"
WORKSPACE_ID="${GFS_CI_RUN_TYPE}_${CI_COMMIT_SHORT_SHA}_${CI_PIPELINE_ID}"
fi
# Create a date-based directory name for successful nightly runs
# on success of nightly pipelines will have the final directory name
# (GFS_CI_RUN_TYPE)_(SHORT_SHA)_(MMDDYY) such as nightly_affeae_061025
# all other pipelines will have the CI_PIPELINE_ID appended instead
# (GFS_CI_RUN_TYPE)_(SHORT_SHA)_(CI_PIPELINE_ID) such as pr_cases_affeae_2345
export DATE="$(date +'%m%d%y')"
export WORKSPACE_DATE="${GFS_CI_RUN_TYPE}_${CI_COMMIT_SHORT_SHA}_${DATE}"
echo "WORKSPACE_ID: ${WORKSPACE_ID}"
echo "WORKSPACE_DATE: ${WORKSPACE_DATE}"
echo "GW_RUN_PATH: ${GW_RUN_PATH}"
echo "GIT_CLONE_PATH: ${GIT_CLONE_PATH}"
echo "GW_HOMEgfs: ${GW_HOMEgfs}"
echo "PIPELINE_TYPE: ${PIPELINE_TYPE}"
echo "RUN_ON_MACHINES: ${RUN_ON_MACHINES}"
# Make sure GW_HOMEgfs is properly set and the directory exists
if [ ! -d "${GW_HOMEgfs}" ]; then
echo "ERROR: GW_HOMEgfs directory does not exist: ${GW_HOMEgfs}"
exit 1
fi
# Common build template for all modalities
.build_template:
extends: .base_config
variables:
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
GIT_SSL_NO_VERIFY: "true" # Address potential certificate verification issues
stage: build
script:
- |
echo "Setting up build environment for ${machine}"
echo "Using build directory ${GW_HOMEgfs}"
git submodule status
# When GFS_CI_RUN_TYPE is set to "nightly", we use the develop branch
# It should be set when configuring the scheculed nightly pipeline
if [[ ${GFS_CI_RUN_TYPE} == "pr_cases" && ${PR_NUMBER} != 0 ]]; then
echo "pipeline is set to checkout PR_NUMBER=${PR_NUMBER} from ${GW_REPO_URL}"
git remote add github "${GW_REPO_URL}"
git fetch github
gh pr checkout "${PR_NUMBER}"
fi
dev/ci/scripts/utils/ci_utils.sh build
build_status=$?
if [[ ${build_status} -ne 0 ]]; then
echo "Build failed with exit code ${build_status}"
exit 1
fi
sorc/link_workflow.sh
mkdir -p ${RUNTESTS_DIR}