Skip to content

Overhaul of the integration test suite #1090

Overhaul of the integration test suite

Overhaul of the integration test suite #1090

Workflow file for this run

# Copyright (C) 2022 Roberto Rossini (roberros@uio.no)
# SPDX-License-Identifier: MIT
name: Run clang-tidy
on:
push:
branches: [main]
paths:
- ".github/workflows/run-clang-tidy.yml"
- "cmake/**"
- "examples/**"
- "src/**"
- "test/units/**"
- ".clang-tidy"
- "CMakeLists.txt"
- "conanfile.py"
tags:
- "v*.*.*"
pull_request:
paths:
- ".github/workflows/run-clang-tidy.yml"
- "cmake/**"
- "examples/**"
- "src/**"
- "test/units/**"
- ".clang-tidy"
- "CMakeLists.txt"
- "conanfile.py"
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
CCACHE_DIR: "/opt/ccache-cache"
CCACHE_NOCOMPRESS: "1"
CCACHE_MAXSIZE: "4G"
CONAN_HOME: "/opt/conan/"
HICTK_CI: "1"
jobs:
run-clang-tidy:
runs-on: ubuntu-latest
container:
image: ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-18
options: "--user=root"
steps:
- uses: actions/checkout@v4
- name: Fix permissions
run: |
chown -R $(id -u):$(id -g) $PWD
- name: Print clang-tidy version
run: clang-tidy --version
- name: Generate cache key
id: cache-key
run: |
conanfile_hash="${{ hashFiles('conanfile.py') }}"
# This can be used by to always update a cache entry (useful e.g. for ccache)
current_date="$(date '+%s')"
ccache_key_prefix="clang-tidy-ccache-$conanfile_hash"
echo "conan-key=clang-tidy-$conanfile_hash" | tee -a "$GITHUB_OUTPUT"
echo "ccache-key=${ccache_key_prefix}-${current_date}" | tee -a "$GITHUB_OUTPUT"
echo "ccache-restore-key=$ccache_key_prefix" | tee -a "$GITHUB_OUTPUT"
- name: Restore Conan cache
id: cache-conan
uses: actions/cache/restore@v4
with:
key: ${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
- name: Clean Conan cache (pre-build)
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan cache clean "*" --build
conan cache clean "*" --download
conan cache clean "*" --source
conan remove --confirm "*"
- name: Copy Conan settings
run: |
if [ ! -f "$CONAN_HOME/settings.yml" ]; then
cp "/root/.conan2/settings.yml" "$CONAN_HOME"
fi
- name: Install build dependencies
run: |
conan install . \
--build=missing \
-pr:b="$CONAN_DEFAULT_PROFILE_PATH" \
-pr:h="$CONAN_DEFAULT_PROFILE_PATH" \
-s build_type=Debug \
-s compiler.libcxx=libstdc++11 \
-s compiler.cppstd=17 \
--output-folder=build
- name: Clean Conan cache (post-build)
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan cache clean "*" --build
conan cache clean "*" --download
conan cache clean "*" --source
- name: Save Conan cache
uses: actions/cache/save@v4
if: steps.cache-conan.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
env:
ZSTD_CLEVEL: 19
- name: Configure project
run: |
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_PREFIX_PATH="$PWD/build" \
-DENABLE_DEVELOPER_MODE=ON \
-DOPT_ENABLE_SANITIZER_ADDRESS=OFF \
-DOPT_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR=OFF \
-DOPT_ENABLE_CLANG_TIDY=ON \
-DHICTK_BUILD_EXAMPLES=ON \
-DHICTK_ENABLE_TESTING=ON \
-DHICTK_DOWNLOAD_TEST_DATASET=OFF \
-DHICTK_ENABLE_GIT_VERSION_TRACKING=OFF \
-S . \
-B build
- name: Restore Ccache folder
id: cache-ccache
uses: actions/cache/restore@v4
with:
key: ${{ steps.cache-key.outputs.ccache-restore-key }}
path: /tmp/ccache-cache.tar.zst
- name: Extract Ccache folder
if: steps.cache-ccache.outputs.cache-hit == 'true'
run: |
mkdir -p "$CCACHE_DIR"
tar -xf /tmp/ccache-cache.tar.zst -C "$CCACHE_DIR"
rm /tmp/ccache-cache.tar.zst
- name: Build project
run: cmake --build build -j $(nproc)
- name: Print Ccache statistics (pre-cleanup)
run: ccache -s
- name: Cleanup Ccache folder
run: ccache --evict-older-than=14400s # 4h
- name: Print Ccache statistics (post-cleanup)
run: ccache -s
- name: Archive Ccache folder
run: |
tar -cf - -C "$CCACHE_DIR" "$CCACHE_DIR" |
zstd -T0 -8 --long -v -o /tmp/ccache-cache.tar.zst
- name: Save Ccache folder
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-key.outputs.ccache-key }}
path: /tmp/ccache-cache.tar.zst
env:
ZSTD_CLEVEL: 1
clang-tidy-status-check:
name: Status Check (clang-tidy)
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- run-clang-tidy
steps:
- name: Collect job results
if: needs.run-clang-tidy.result != 'success'
run: exit 1