diff --git a/.github/workflows/asciidoctor-ghpages.yml b/.github/workflows/asciidoctor-ghpages.yml index f2e65c6..ae6341e 100644 --- a/.github/workflows/asciidoctor-ghpages.yml +++ b/.github/workflows/asciidoctor-ghpages.yml @@ -12,7 +12,7 @@ env: jobs: configure: name: Configure Github Pages Publishing - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: &runner ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 outputs: enable_publish: ${{ steps.check.outputs.isfork == 'NO' }} steps: @@ -30,7 +30,7 @@ jobs: build: needs: configure name: Build Documentation - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner steps: - name: Checkout source uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -71,7 +71,7 @@ jobs: - name: Build documentation run: | - test $(cmake --build build -v -t docs | grep -c ERROR) == 0 + test "$(cmake --build build -v -t docs | grep -c ERROR)" == 0 touch ./build/docs/.nojekyll ls -la ./build/docs @@ -95,7 +95,7 @@ jobs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner steps: - name: Deploy to github pages id: deployment diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index dc3092b..5914d62 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -26,7 +26,7 @@ concurrency: jobs: build_and_test_24: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: &runner ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 strategy: fail-fast: false matrix: @@ -112,20 +112,21 @@ jobs: stdlib: libc++ steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: &checkout actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - name: Install build tools run: | if [[ "${{matrix.compiler}}" == "clang" ]]; then - export DISTRO=$(lsb_release -cs) + DISTRO=$(lsb_release -cs) wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y deb https://apt.llvm.org/$DISTRO/ llvm-toolchain-$DISTRO-${{matrix.version}} main + sudo add-apt-repository -y deb "https://apt.llvm.org/$DISTRO/" "llvm-toolchain-$DISTRO-${{matrix.version}}" main sudo apt update && sudo apt install -y ninja-build clang-${{matrix.version}} libc++-${{matrix.version}}-dev libc++abi-${{matrix.version}}-dev else sudo apt update && sudo apt install -y ninja-build gcc-${{matrix.version}} g++-${{matrix.version}} fi - - name: Restore CPM cache + - &restore_cpm_cache + name: Restore CPM cache env: cache-name: cpm-cache-0 id: cpm-cache-restore @@ -142,7 +143,8 @@ jobs: CXX: ${{matrix.toolchain_root}}/bin/${{matrix.cxx}} run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}} -DCMAKE_CXX_FLAGS_INIT=${{matrix.cxx_flags}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache + - &save_cpm_cache + name: Save CPM cache env: cache-name: cpm-cache-0 if: steps.cpm-cache-restore.outputs.cache-hit != 'true' @@ -151,62 +153,54 @@ jobs: path: ~/cpm-cache key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - - name: Install python test requirements + - &python_test_reqs + name: Install python test requirements run: | python3 -m venv ${{github.workspace}}/test_venv source ${{github.workspace}}/test_venv/bin/activate pip install -r ${{github.workspace}}/requirements.txt - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + echo "${{github.workspace}}/test_venv/bin" >> "$GITHUB_PATH" - name: Build Unit Tests run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -v -t build_unit_tests - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -j $(nproc) -C ${{matrix.build_type}} + run: ctest --output-on-failure -j -C ${{matrix.build_type}} quality_checks_pass: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner steps: - name: Checkout target branch - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + uses: *checkout with: ref: ${{github.base_ref}} - name: Extract target branch SHA - run: echo "branch=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + run: echo "branch=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" id: target_branch - name: Checkout PR branch - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + uses: *checkout - name: Setup python venv run: | python3 -m venv ${{github.workspace}}/test_venv source ${{github.workspace}}/test_venv/bin/activate - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + echo "${{github.workspace}}/test_venv/bin" >> "$GITHUB_PATH" - name: Install build tools run: | - export DISTRO=$(lsb_release -cs) + DISTRO=$(lsb_release -cs) wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y deb https://apt.llvm.org/$DISTRO/ llvm-toolchain-$DISTRO-${{env.DEFAULT_LLVM_VERSION}} main + sudo add-apt-repository -y deb "https://apt.llvm.org/$DISTRO/" "llvm-toolchain-$DISTRO-${{env.DEFAULT_LLVM_VERSION}}" main sudo apt update && sudo apt install -y ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}} - name: Install cmake-format run: | pip install cmakelang pyyaml - - name: Restore CPM cache - env: - cache-name: cpm-cache-0 - id: cpm-cache-restore - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - restore-keys: | - ${{runner.os}}-${{env.cache-name}}- + - *restore_cpm_cache - name: Configure CMake env: @@ -215,20 +209,13 @@ jobs: PR_TARGET_BRANCH: ${{ steps.target_branch.outputs.branch }} run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache - env: - cache-name: cpm-cache-0 - if: steps.cpm-cache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} + - *save_cpm_cache - name: Run quality checks run: cmake --build ${{github.workspace}}/build -t ci-quality sanitize: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner strategy: fail-fast: false matrix: @@ -245,29 +232,20 @@ jobs: toolchain_root: "/usr" steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: *checkout - name: Install build tools run: | if [[ "${{matrix.compiler}}" == "clang" ]]; then - export DISTRO=$(lsb_release -cs) + DISTRO=$(lsb_release -cs) wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y deb https://apt.llvm.org/$DISTRO/ llvm-toolchain-$DISTRO-${{env.DEFAULT_LLVM_VERSION}} main + sudo add-apt-repository -y deb "https://apt.llvm.org/$DISTRO/" "llvm-toolchain-$DISTRO-${{env.DEFAULT_LLVM_VERSION}}" main sudo apt update && sudo apt install -y ninja-build clang-${{env.DEFAULT_LLVM_VERSION}} else sudo apt update && sudo apt install -y ninja-build ${{matrix.cc}} ${{matrix.cxx}} fi - - name: Restore CPM cache - env: - cache-name: cpm-cache-0 - id: cpm-cache-restore - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - restore-keys: | - ${{runner.os}}-${{env.cache-name}}- + - *restore_cpm_cache - name: Configure CMake env: @@ -276,21 +254,9 @@ jobs: SANITIZERS: ${{matrix.sanitizer}} run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache - env: - cache-name: cpm-cache-0 - if: steps.cpm-cache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} + - *save_cpm_cache - - name: Install python test requirements - run: | - python3 -m venv ${{github.workspace}}/test_venv - source ${{github.workspace}}/test_venv/bin/activate - pip install -r ${{github.workspace}}/requirements.txt - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + - *python_test_reqs # https://github.com/actions/runner-images/issues/9524 - name: Fix kernel mmap rnd bits @@ -303,24 +269,15 @@ jobs: run: cmake --build ${{github.workspace}}/build -t unit_tests valgrind: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: *checkout - name: Install build tools run: | sudo apt update && sudo apt install -y gcc-${{env.DEFAULT_GCC_VERSION}} g++-${{env.DEFAULT_GCC_VERSION}} ninja-build valgrind python3-venv python3-pip - - name: Restore CPM cache - env: - cache-name: cpm-cache-0 - id: cpm-cache-restore - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - restore-keys: | - ${{runner.os}}-${{env.cache-name}}- + - *restore_cpm_cache - name: Configure CMake env: @@ -328,21 +285,9 @@ jobs: CXX: "/usr/bin/g++-${{env.DEFAULT_GCC_VERSION}}" run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache - env: - cache-name: cpm-cache-0 - if: steps.cpm-cache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} + - *save_cpm_cache - - name: Install python test requirements - run: | - python3 -m venv ${{github.workspace}}/test_venv - source ${{github.workspace}}/test_venv/bin/activate - pip install -r ${{github.workspace}}/requirements.txt - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + - *python_test_reqs - name: Build Unit Tests run: cmake --build ${{github.workspace}}/build -t build_unit_tests @@ -350,46 +295,46 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build run: | - ctest --output-on-failure -j $(nproc) -E EXPECT_FAIL -T memcheck + ctest --output-on-failure -j -E EXPECT_FAIL -T memcheck LOGFILE=$(ls ./Testing/Temporary/LastDynamicAnalysis_*.log) FAILSIZE=$(du -c ./Testing/Temporary/MemoryChecker.* | tail -1 | cut -f1) - echo "
" >> $GITHUB_STEP_SUMMARY + { echo "
"; + echo ""; } >> "$GITHUB_STEP_SUMMARY" - echo "" >> $GITHUB_STEP_SUMMARY - if [ $FAILSIZE != "0" ]; then - echo "Failing tests:" | tee -a $GITHUB_STEP_SUMMARY + if [ "$FAILSIZE" != "0" ]; then + echo "Failing tests:" | tee -a "$GITHUB_STEP_SUMMARY" else - echo "No failing tests" >> $GITHUB_STEP_SUMMARY + echo "No failing tests" >> "$GITHUB_STEP_SUMMARY" fi - echo "" >> $GITHUB_STEP_SUMMARY + echo "" >> "$GITHUB_STEP_SUMMARY" for f in ./Testing/Temporary/MemoryChecker.* do - if [ -s $f ]; then - FILENAME=$(cd $(dirname $f) && pwd)/$(basename $f) - TEST_COMMAND=$(grep $FILENAME $LOGFILE) - echo "" | tee -a $GITHUB_STEP_SUMMARY + if [ -s "$f" ]; then + FILENAME=$(realpath "$f") + TEST_COMMAND=$(grep "$FILENAME" "$LOGFILE") + echo "" | tee -a "$GITHUB_STEP_SUMMARY" echo "========================================" - echo $TEST_COMMAND | tee -a $GITHUB_STEP_SUMMARY + echo "$TEST_COMMAND" | tee -a "$GITHUB_STEP_SUMMARY" echo "--------------------" - cat $f + cat "$f" fi done - echo "
" >> $GITHUB_STEP_SUMMARY - test $FAILSIZE = "0" + echo "
" >> "$GITHUB_STEP_SUMMARY" + test "$FAILSIZE" = "0" mutate: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: *checkout - name: Install build tools run: | - export DISTRO=$(lsb_release -cs) + DISTRO=$(lsb_release -cs) wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y deb https://apt.llvm.org/$DISTRO/ llvm-toolchain-$DISTRO-${{env.MULL_LLVM_MAJOR_VERSION}} main + sudo add-apt-repository -y deb "https://apt.llvm.org/$DISTRO/" "llvm-toolchain-$DISTRO-${{env.MULL_LLVM_MAJOR_VERSION}}" main sudo apt update && sudo apt install -y ninja-build clang-${{env.MULL_LLVM_MAJOR_VERSION}} - name: Install mull @@ -400,16 +345,7 @@ jobs: wget -O "$MULL_DEB" https://github.com/mull-project/mull/releases/download/${{env.MULL_VERSION}}/${{env.mull-pkg}} sudo dpkg -i "$MULL_DEB" - - name: Restore CPM cache - env: - cache-name: cpm-cache-0 - id: cpm-cache-restore - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} - restore-keys: | - ${{runner.os}}-${{env.cache-name}}- + - *restore_cpm_cache - name: Configure CMake env: @@ -417,27 +353,15 @@ jobs: CXX: "/usr/lib/llvm-${{env.MULL_LLVM_MAJOR_VERSION}}/bin/clang++" run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{env.DEFAULT_CXX_STANDARD}} -DCPM_SOURCE_CACHE=~/cpm-cache - - name: Save CPM cache - env: - cache-name: cpm-cache-0 - if: steps.cpm-cache-restore.outputs.cache-hit != 'true' - uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ~/cpm-cache - key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }} + - *save_cpm_cache - - name: Install python test requirements - run: | - python3 -m venv ${{github.workspace}}/test_venv - source ${{github.workspace}}/test_venv/bin/activate - pip install -r ${{github.workspace}}/requirements.txt - echo "${{github.workspace}}/test_venv/bin" >> $GITHUB_PATH + - *python_test_reqs - name: Build and run mull tests run: cmake --build build -t mull_tests merge_ok: - runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04 + runs-on: *runner needs: [build_and_test_24, mutate, quality_checks_pass, sanitize, valgrind] if: ${{ !cancelled() }} steps: