Skip to content

Commit

Permalink
Overhaul CDash integration with CI (#2118)
Browse files Browse the repository at this point in the history
#2095 switched our CI provider from CircleCI to GitHub Actions, but
broke our integration with CDash.

The checkout action provided by GitHub runs workflows triggered by the
`pull_request` event against a [merge
commit](actions/checkout#426) instead of the
PR's head ref. This causes issues with the CDash integration since the
git hash CDash receives does not match the most recent hash on the pull
request. I was not able to resolve the callback issue, but the changes
in this PR improve the CDash build name being submitted, and assign runs
to appropriate build groups.

I plan to take another look at this issue at a future point to restore
our CDash callback.
  • Loading branch information
williamjallen committed Apr 2, 2024
1 parent c376786 commit db8f55a
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 62 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- "releases/*"
pull_request:
merge_group:
workflow_dispatch:
Expand All @@ -23,6 +24,7 @@ jobs:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build images
shell: bash
run: |
docker compose \
-f docker/docker-compose.yml \
Expand All @@ -34,8 +36,17 @@ jobs:
- name: Run Tests
run: |
source .github/workflows/commands.bash
cdash_run_and_submit_${{matrix.database}}_ctest
if [ "${{github.event_name}}" == "pull_request" ]; then
BUILD_GROUP="Pull Requests";
elif [[ "${GITHUB_REF}" =~ "/master" ]] ; then
BUILD_GROUP="Master";
elif [[ "${GITHUB_REF}" =~ "releases/" ]] ; then
BUILD_GROUP="Release";
else
BUILD_GROUP="Experimental";
fi
echo "Submitting to build group: ${BUILD_GROUP}"
bash .github/workflows/submit.sh ${{matrix.database}} "${BUILD_GROUP}"
build-images:
runs-on: ubuntu-latest
Expand Down
46 changes: 0 additions & 46 deletions .github/workflows/commands.bash

This file was deleted.

12 changes: 10 additions & 2 deletions .github/workflows/ctest_driver_script.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
set(CTEST_SITE "${SITENAME}")
set(CTEST_BUILD_NAME "${BUILDNAME}")

cmake_host_system_information(RESULT DISTRIB_ID QUERY DISTRIB_ID)
cmake_host_system_information(RESULT DISTRIB_VERSION_ID QUERY DISTRIB_VERSION_ID)
set(CTEST_BUILD_NAME "${DISTRIB_ID}-${DISTRIB_VERSION_ID}-${DATABASE}")
message(STATUS "${CTEST_BUILD_NAME}")

set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_SOURCE_DIRECTORY "/cdash")
set(CTEST_BINARY_DIRECTORY "/cdash/_build")
Expand All @@ -23,7 +28,10 @@ configure_file(
COPYONLY
)

ctest_start(Continuous)
if (NOT SUBMIT_TYPE)
set(SUBMIT_TYPE Experimental)
endif()
ctest_start(GROUP "${SUBMIT_TYPE}" Continuous)
ctest_update()
ctest_submit(PARTS Update)
ctest_configure(OPTIONS "${cfg_options}")
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/submit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

ctest_driver="/cdash/.github/workflows/ctest_driver_script.cmake"

database="$1"

if [ "$database" != "mysql" ] && [ "$database" != "postgres" ]; then
echo "Database type required: mysql or postgres"
exit 1;
fi

submit_type="$2"
submit_type="${submit_type:-Experimental}"

site="${SITENAME:-$(hostname)}"

echo "site=$site"
echo "database=$database"
echo "ctest_driver=$ctest_driver"
echo "submit_type=$submit_type"

# Suppress any uncommitted changes left after the image build
docker exec cdash bash -c "cd /cdash && /usr/bin/git checkout ."

docker exec cdash bash -c "\
ctest \
-VV \
-j 4 \
--schedule-random \
-DSITENAME=\"${site}\" \
-DDATABASE=\"${database}\" \
-DSUBMIT_TYPE=\"${submit_type}\" \
-S \"${ctest_driver}\" \
"
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)
project(CDash)
include(CTest)
configure_file(
Expand Down
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,14 @@ RUN if [ "$DEVELOPMENT_BUILD" = '1' ]; then \
--noplugins \
--setopt=install_weak_deps=0 \
php-xdebug \
cmake\
rsync; \
rsync \
#> A horrible hack to get a newer version of CMake. As of the time of this
#> writing, Red Hat UBI uses CMake 3.20, while our scripts require CMake>=3.22.
#> This should be replaced with a more acceptable solution at a future point
#> in time, whenever Red Had updates the default version of CMake.
python-pip && \
pip install cmake --upgrade && \
dnf remove -y python-pip; \
fi

# certs, timezone, accounts
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/coveragedriver.ctest.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)


# Settings:
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/ctestdriver.ctest.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)


# Settings:
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/sameImage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)
project(SameImage)
include(CTest)

Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/sameImage/test.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)

# Settings:
set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest")
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/simple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)
project(Simple)
include(CTest)

Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/simple/test.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)

# Settings:
set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest")
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/simple2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)
project(Simple2)
include(CTest)

Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/simple2/simple.ctest.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)

# Settings:
set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest")
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/tests/ctest/simple2/test.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22)

# Settings:
set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest")
Expand Down

0 comments on commit db8f55a

Please sign in to comment.