Skip to content

Commit 497d1c3

Browse files
authored
Merge pull request #2460 from DARMA-tasking/2454-ci-fix-spack-build-azure-and-migrate-it-to-bake-github
#2454: Add `spack-package` build to bake file
2 parents d3c2c08 + b800e85 commit 497d1c3

File tree

4 files changed

+56
-16
lines changed

4 files changed

+56
-16
lines changed

.github/workflows/build-docker-images.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ jobs:
4343
with:
4444
path: docker-output/build/ccache
4545
key: ${{ matrix.target }}-${{ github.ref }}-${{ github.sha }}
46-
restore-keys: ${{ matrix.target }}-${{ github.ref }}
46+
restore-keys: |
47+
${{ matrix.target }}-${{ github.ref }}
48+
${{ matrix.target }}-
4749
4850
- name: Login to DockerHub
4951
uses: docker/login-action@v3
@@ -61,3 +63,5 @@ jobs:
6163
targets: ${{ matrix.target }}
6264
files: docker-bake.hcl
6365
push: ${{ github.ref == 'refs/heads/develop' }}
66+
env:
67+
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}

ci/docker/vt.dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ FROM --platform=${ARCH} ${BASE} AS build
99
ARG BUILD_SHARED_LIBS
1010
ARG CMAKE_BUILD_TYPE
1111
ARG CMAKE_CXX_STANDARD
12+
ARG GIT_BRANCH
1213
ARG VT_ASAN_ENABLED
1314
ARG VT_BUILD_TRACE_ONLY
1415
ARG VT_CI_BUILD
@@ -31,6 +32,7 @@ ARG VT_PERF_ENABLED
3132
ARG VT_POOL_ENABLED
3233
ARG VT_PRODUCTION_BUILD_ENABLED
3334
ARG VT_RDMA_TESTS_ENABLED
35+
ARG VT_TEST_SPACK
3436
ARG VT_TESTS_NUM_NODES
3537
ARG VT_TRACE_ENABLED
3638
ARG VT_TRACE_RUNTIME_ENABLED
@@ -49,7 +51,14 @@ if [ -d vt/docker-output/build/ccache ]; then
4951
fi
5052
EOF
5153

54+
ENV GIT_BRANCH=${GIT_BRANCH}
55+
5256
RUN --mount=target=/vt,rw \
53-
/vt/ci/build_cpp.sh /vt /build && \
54-
/vt/ci/test_cpp.sh /vt /build && \
55-
/vt/ci/build_vt_sample.sh /vt /build
57+
if [ "${VT_TEST_SPACK}" = "1" ]; then \
58+
apt update -y -q && apt install -y -q libssl-dev unzip && \
59+
/vt/ci/test_spack_package.sh; \
60+
else \
61+
/vt/ci/build_cpp.sh /vt /build && \
62+
/vt/ci/test_cpp.sh /vt /build && \
63+
/vt/ci/build_vt_sample.sh /vt /build; \
64+
fi

ci/test_spack_package.sh

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env bash
22

3+
set -exo pipefail
4+
35
cur_path=$(pwd)
4-
spack_path="$cur_path/spack"
56
vt_spack_package="$cur_path/spack-package"
67

7-
git clone https://github.com/spack/spack.git
8-
git clone https://github.com/DARMA-tasking/spack-package.git
8+
git clone --branch v0.23.1 --depth=2 https://github.com/spack/spack.git
9+
. spack/share/spack/setup-env.sh
910

10-
cd "$spack_path" || exit 1
11-
git checkout v0.16.3
12-
cd "$cur_path" || exit 1
11+
git clone -b master https://github.com/DARMA-tasking/spack-package.git
12+
python3 spack-package/ci/add_vt_branch.py "${GIT_BRANCH}"
1313

1414
declare -A variables_map
1515
variables_map["lb_enabled"]="${VT_LB_ENABLED:-0}"
1616
variables_map["trace_enabled"]="${VT_TRACE_ENABLED:-0}"
17-
variables_map["trace_only"]="${VT_BUILD_TRACE_ONLY:-0}"
17+
variables_map["trace_only"]="${VT_BUILD_TRACE_ONLY:-1}"
1818
variables_map["doxygen_enabled"]="${VT_DOXYGEN_ENABLED:-0}"
1919
variables_map["mimalloc_enabled"]="${VT_MIMALLOC_ENABLED:-0}"
2020
variables_map["asan_enabled"]="${VT_ASAN_ENABLED:-0}"
@@ -26,6 +26,7 @@ variables_map["diagnostics_enabled"]="${VT_DIAGNOSTICS_ENABLED:-0}"
2626
variables_map["diagnostics_runtime_enabled"]="${VT_DIAGNOSTICS_RUNTIME_ENABLED:-0}"
2727
variables_map["unity_build_enabled"]="${VT_UNITY_BUILD_ENABLED:-0}"
2828
variables_map["fcontext_enabled"]="${VT_FCONTEXT_ENABLED:-0}"
29+
variables_map["kokkos"]="${VT_KOKKOS_ENABLED:-0}"
2930

3031
cmd_vars=()
3132
for flag in "${!variables_map[@]}"
@@ -40,16 +41,27 @@ do
4041
done
4142

4243
install_cmd=$(printf " %s" "${cmd_vars[@]}")
43-
install_cmd="$spack_path/bin/spack install darma-vt@develop build_type=Release ${install_cmd:1}"
44+
install_cmd="spack install darma-vt@${GIT_BRANCH} build_type=Release ${install_cmd:1} ^[email protected]"
45+
46+
mkdir -p ~/.spack
47+
cat >> ~/.spack/packages.yaml <<'EOF'
48+
packages:
49+
openmpi:
50+
externals:
51+
52+
prefix: /usr/local
53+
EOF
54+
55+
spack clean --all
56+
spack repo add "$vt_spack_package"
57+
spack external find
4458

45-
"$spack_path"/bin/spack repo add "$vt_spack_package"
46-
"$spack_path"/bin/spack external find
4759
$install_cmd
4860

4961
git clone https://github.com/DARMA-tasking/vt-sample-project
5062
mkdir -p vt-sample-project/build
5163
cd vt-sample-project/build || exit 1
52-
vt_DIR=$("$spack_path"/bin/spack location --install-dir darma-vt)
64+
vt_DIR=$(spack location --install-dir darma-vt)
5365
export vt_DIR
5466
cmake -G "${CMAKE_GENERATOR:-Ninja}" \
5567
-DCMAKE_BUILD_TYPE=Release \

docker-bake.hcl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ variable "REPO" {
22
default = "lifflander1/vt"
33
}
44

5+
variable "GIT_BRANCH" {}
6+
57
function "arch" {
68
params = [item]
79
result = lookup(item, "arch", "amd64")
@@ -122,6 +124,11 @@ function "vt_rdma_tests" {
122124
result = lookup(item, "vt_rdma_tests", "")
123125
}
124126

127+
function "vt_test_spack" {
128+
params = [item]
129+
result = lookup(item, "vt_test_spack", "0")
130+
}
131+
125132
function "vt_tests_num_nodes" {
126133
params = [item]
127134
result = lookup(item, "vt_tests_num_nodes", "")
@@ -196,12 +203,13 @@ target "vt-build" {
196203
}
197204

198205
target "vt-build-all" {
199-
name = "vt-build-${replace(item.image, ".", "-")}"
206+
name = "vt-build-${replace(item.image, ".", "-")}${vt_test_spack(item) == 1 ? "-spack" : ""}"
200207
inherits = ["vt-build"]
201208
tags = ["${REPO}:vt-${item.image}"]
202209

203210
args = {
204211
ARCH = arch(item)
212+
GIT_BRANCH = "${GIT_BRANCH}"
205213
IMAGE = "wf-${item.image}"
206214
REPO = REPO
207215
BUILD_SHARED_LIBS = vt_build_shared_libs(item)
@@ -227,6 +235,7 @@ target "vt-build-all" {
227235
VT_POOL_ENABLED = vt_pool(item)
228236
VT_PRODUCTION_BUILD_ENABLED = vt_production_build(item)
229237
VT_RDMA_TESTS_ENABLED = vt_rdma_tests(item)
238+
VT_TEST_SPACK = vt_test_spack(item)
230239
VT_TESTS_NUM_NODES = vt_tests_num_nodes(item)
231240
VT_TRACE_ENABLED = vt_trace(item)
232241
VT_TRACE_RUNTIME_ENABLED = vt_trace_runtime(item)
@@ -266,6 +275,12 @@ target "vt-build-all" {
266275
vt_lb = 0
267276
vt_tests_num_nodes = 4
268277
},
278+
{
279+
image = "amd64-ubuntu-20.04-gcc-10-openmpi-cpp"
280+
vt_lb = 1
281+
vt_trace_only = 1
282+
vt_test_spack = 1
283+
},
269284
{
270285
image = "amd64-ubuntu-20.04-gcc-9-cpp"
271286
},

0 commit comments

Comments
 (0)