Skip to content

Commit

Permalink
Merge pull request #4435 from ornladios/backport-spack-ci
Browse files Browse the repository at this point in the history
Backport spack ci
  • Loading branch information
vicentebolea authored Jan 7, 2025
2 parents cc79bfc + 74845ef commit a7a94f5
Show file tree
Hide file tree
Showing 27 changed files with 637 additions and 60 deletions.
54 changes: 9 additions & 45 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,16 @@
defaults: &defaults
steps:
- checkout:
path: source
- run:
# https://discuss.circleci.com/t/circle-working-directory-doesnt-expand/17007
name: "Fix CIRCLE_WORKING_DIRECTORY"
command: echo 'CIRCLE_WORKING_DIRECTORY="${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}"' >> $BASH_ENV
- run:
name: CDash
command: bash source/scripts/ci/circle/postCDashStatus.sh
- run:
name: Update
command: bash source/scripts/ci/circle/run.sh update
- run:
name: Configure
command: bash source/scripts/ci/circle/run.sh configure
- run:
name: Build
command: bash source/scripts/ci/circle/run.sh build
- run:
name: Sanitize
command: bash source/scripts/ci/circle/run.sh memcheck

version: 2

jobs:
"fedora-ubsan":
<<: *defaults
docker:
- image: ornladios/adios2:ci-fedora-ubsan
"fedora-asan":
<<: *defaults
docker:
- image: ornladios/adios2:ci-fedora-asan
"fedora-msan":
<<: *defaults
docker:
- image: ornladios/adios2:ci-fedora-msan
"fedora-tsan":
<<: *defaults
"post-cdash-status":
docker:
- image: ornladios/adios2:ci-fedora-tsan
- image: cimg/base:2024.12
steps:
- checkout
- run:
name: CDash
command: ./scripts/ci/circle/post-cdash-status

workflows:
version: 2
sanitizers:
utils:
jobs:
- "fedora-ubsan"
- "fedora-asan"
- "fedora-msan"
- "fedora-tsan"
- "post-cdash-status"
8 changes: 6 additions & 2 deletions .gitlab/config/SpackCIBridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
class SpackCIBridge(object):

def __init__(self, gitlab_repo="", gitlab_host="", gitlab_project="", github_project="",
disable_status_post=True, sync_draft_prs=False,
disable_status_post=True, status_context="", sync_draft_prs=False,
main_branch=None, prereq_checks=[]):
self.gitlab_repo = gitlab_repo
self.github_project = github_project
github_token = os.environ.get('GITHUB_TOKEN')
self.github_repo = "https://{0}@github.com/{1}.git".format(github_token, self.github_project)
self.py_github = Github(github_token)
self.py_gh_repo = self.py_github.get_repo(self.github_project, lazy=True)
self.status_context = status_context

self.merge_msg_regex = re.compile(r"Merge\s+([^\s]+)\s+into\s+([^\s]+)")
self.unmergeable_shas = []
Expand Down Expand Up @@ -561,7 +562,7 @@ def post_pipeline_status(self, open_prs, protected_branches):
print("Rate limit at the end of post_pipeline_status(): {}".format(self.py_github.rate_limiting[0]))

def create_status_for_commit(self, sha, branch, state, target_url, description):
context = "OLCF Ascent (Summit)"
context = self.status_context
commit = self.get_commit(sha)
existing_statuses = commit.get_combined_status()
for status in existing_statuses.statuses:
Expand Down Expand Up @@ -659,6 +660,8 @@ def sync(self):
parser.add_argument("gitlab_project", help="GitLab project (org/repo or user/repo)")
parser.add_argument("--disable-status-post", action="store_true", default=False,
help="Do not post pipeline status to each GitHub PR")
parser.add_argument("--status-context", type=str, default="External Gitlab pipeline",
help="The name of the status in the github status check")
parser.add_argument("--sync-draft-prs", action="store_true", default=False,
help="Copy draft PRs from GitHub to GitLab")
parser.add_argument("--pr-mirror-bucket", default=None,
Expand All @@ -685,6 +688,7 @@ def sync(self):
gitlab_project=args.gitlab_project,
github_project=args.github_project,
disable_status_post=args.disable_status_post,
status_context=args.status_context,
sync_draft_prs=args.sync_draft_prs,
main_branch=args.main_branch,
prereq_checks=args.prereq_check)
Expand Down
5 changes: 5 additions & 0 deletions .gitlab/config/dynamic_pipeline.yml.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
default:
id_tokens:
OLCF_ID_TOKEN:
aud: https://code.olcf.ornl.gov

child_pipeline_{branch}:
variables:
DOWNSTREAM_COMMIT_SHA: '{commit}'
Expand Down
17 changes: 12 additions & 5 deletions .gitlab/gitlab-ci-frontier.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Ad-hoc build that runs in the ECP Hardware, concretely in OLCF Frontier.

default:
id_tokens:
OLCF_ID_TOKEN:
aud: https://code.olcf.ornl.gov

stages:
- pre
- setup
Expand Down Expand Up @@ -90,11 +95,13 @@ stages:
LD_LIBRARY_PATH: "$Kokkos_DIR/lib64/:$LD_LIBRARY_PATH"
# Order matters
JOB_MODULES: >-
DefApps
Core/24.00
lfs-wrapper
hsi
PrgEnv-gnu
gcc-native/12
craype-accel-amd-gfx90a
rocm/5.4.3
rocm/5.7.1
cmake
git
ninja
Expand All @@ -104,10 +111,10 @@ stages:
setup:frontier-kokkos-hip:
variables:
KOKKOS_VER: 3.7.01
KOKKOS_VER: 4.4.01
KOKKOS_OPTS: >-
-DCMAKE_INSTALL_PREFIX:PATH=$Kokkos_DIR
-DCMAKE_CXX_COMPILER:FILEPATH=/opt/rocm-5.4.3/hip/bin/hipcc
-DCMAKE_CXX_COMPILER:FILEPATH=/opt/rocm-5.7.1/hip/bin/hipcc
-DKokkos_ARCH_VEGA90A:BOOL=ON
-DKokkos_ENABLE_HIP:BOOL=ON
-DKokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE:BOOL=OFF
Expand Down Expand Up @@ -137,7 +144,7 @@ build:frontier-kokkos-hip:
variables:
# Order matters
JOB_MODULES: >-
DefApps
Core/24.00
PrgEnv-cray
cmake
git
Expand Down
130 changes: 130 additions & 0 deletions .gitlab/gitlab-ci-spack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# This file is used to define the GitLab CI/CD pipeline for the ADIOS2 project.
default:
interruptible: true
tags:
- medium
- uo
- public
- x86_64

# This file is used to define the GitLab CI/CD pipeline for the ADIOS2 project.
.common-sanitizer:
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
when: on_success
- when: never
variables:
GITLAB_SITE: "UO CI (gitlab.spack.io)"
CI_BIN_DIR: "$CI_PROJECT_DIR/build"

.common-build:
extends:
- .common-sanitizer
stage: build
script:
- bash scripts/ci/gitlab-ci/run.sh update
- bash scripts/ci/gitlab-ci/run.sh configure
- bash scripts/ci/gitlab-ci/run.sh build
artifacts:
expire_in: 1 hours
when: always
paths:
- $CI_BIN_DIR/bin/
- $CI_BIN_DIR/lib/
- $CI_BIN_DIR/lib64/
- $CI_BIN_DIR/thirdparty/**/lib64/
- $CI_BIN_DIR/testing/
- $CI_BIN_DIR/source/**/*.h
- $CI_BIN_DIR/source/**/*.in
- $CI_BIN_DIR/adios2_reorganize_wrapper

# CTest and CMake install files.
- $CI_BIN_DIR/CMakeCache.txt
- $CI_BIN_DIR/**/*.cmake
- $CI_BIN_DIR/Testing/

# CDash files.
- $CI_BIN_DIR/DartConfiguration.tcl

.common-test:
extends:
- .common-sanitizer
stage: test
script:
- bash scripts/ci/gitlab-ci/run.sh memcheck

#===============================================================================

build:uo-sanitizer-asan:
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-asan-20241205
extends: [.common-build]

build:uo-sanitizer-msan:
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-msan-20241205
extends: [.common-build]

build:uo-sanitizer-tsan:
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-tsan-20241205
extends: [.common-build]

build:uo-sanitizer-ubsan:
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-ubsan-20241205
extends: [.common-build]

test:uo-sanitizer-asan:
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-asan-20241205
extends: [.common-test]
needs: [build:uo-sanitizer-asan]

test:uo-sanitizer-msan:
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-msan-20241205
extends: [.common-test]
needs: [build:uo-sanitizer-msan]

test:uo-sanitizer-tsan:
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-tsan-20241205
extends: [.common-test]
needs: [build:uo-sanitizer-tsan]

test:uo-sanitizer-ubsan:
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-ubsan-20241205
extends: [.common-test]
needs: [build:uo-sanitizer-ubsan]

deploy:sync-ornl:
environment: ornl
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: on_success
- when: never
image: ornladios/adios2:sync-20241206-b
script: >
.gitlab/config/SpackCIBridge.py
ornladios/ADIOS2
git@code.ornl.gov:ecpcitest/adios2.git
https://code.ornl.gov/
ecpcitest/adios2
--prereq-check=format
--prereq-check=git_checks
--disable-status-post
dependencies: []
needs: []

deploy:sync-spack:
environment: spackio
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: on_success
- when: never
image: ornladios/adios2:sync-20241206-b
script: >
.gitlab/config/SpackCIBridge.py
ornladios/ADIOS2
git@ssh.gitlab.spack.io:adios2/adios2.git
https://gitlab.spack.io/
adios2/ADIOS2
--prereq-check=format
--prereq-check=git_checks
--status-context="Frank CI (sanitizers)"
dependencies: []
needs: []
45 changes: 45 additions & 0 deletions scripts/ci/circle/post-cdash-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

set -eo pipefail

readonly API_BASE="https://api.github.com/repos/ornladios/adios2"
readonly USER=${STATUS_ROBOT_NAME}
readonly TOKEN=${STATUS_ROBOT_KEY}
readonly COMMIT=${CIRCLE_SHA1}
readonly CDASH_STATUS_CONTEXT="cdash"

#==============================================================================

function build_status_body() {
cat <<EOF
{
"state": "success",
"target_url": "https://open.cdash.org/index.php?compare1=61&filtercount=1&field1=revision&project=ADIOS&showfilters=0&limit=100&value1=${COMMIT}&showfeed=0",
"description": "Build and test results available on CDash",
"context": "${CDASH_STATUS_CONTEXT}"
}
EOF
}

#==============================================================================

statuses=$(curl -q -s \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"${API_BASE}/commits/${COMMIT}/statuses" |\
jq -r '[.[].context] | @json')

if jq -re 'all(. != "dash")' <<<"${statuses}"; then
echo "Need to post a status for context ${CDASH_STATUS_CONTEXT}"

postBody="$(build_status_body)"
postUrl="${API_BASE}/statuses/${COMMIT}"

curl -X POST -q -s \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d "${postBody}" "${postUrl}"
fi
1 change: 1 addition & 0 deletions scripts/ci/cmake/adios-asan.supp
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ leak:ps_make_timer_name_
leak:ibv_get_device_list
leak:add_transport_to_cm
leak:INT_CMadd_delayed_task
leak:__vasprintf_internal
5 changes: 5 additions & 0 deletions scripts/ci/cmake/ci-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ if(NOT CTEST_BUILD_FLAGS)
set(CTEST_BUILD_FLAGS "-j${N2CPUS}")
endif()
endif()

if(NOT PARALLEL_LEVEL IN_LIST CTEST_TEST_ARGS)
list(APPEND CTEST_TEST_ARGS PARALLEL_LEVEL ${N2CPUS})
endif()

if(NOT PARALLEL_LEVEL IN_LIST CTEST_MEMCHECK_ARGS)
list(APPEND CTEST_MEMCHECK_ARGS PARALLEL_LEVEL ${N2CPUS})
endif()

if(NOT dashboard_model)
set(dashboard_model Experimental)
endif()
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/cmake/ci-el7-spack.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Client maintainer: chuck.atkins@kitware.com
# Client maintainer: vicente.bolea@kitware.com

include(ProcessorCount)
ProcessorCount(NCPUS)
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/cmake/ci-el7.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Client maintainer: chuck.atkins@kitware.com
# Client maintainer: vicente.bolea@kitware.com

set(ENV{CC} gcc)
set(ENV{CXX} g++)
Expand Down
Loading

0 comments on commit a7a94f5

Please sign in to comment.