Skip to content

⬆️ 👷 Update workflows to ubuntu-24.04 #236

⬆️ 👷 Update workflows to ubuntu-24.04

⬆️ 👷 Update workflows to ubuntu-24.04 #236

Workflow file for this run

name: Usage Test
permissions: read-all
on:
workflow_dispatch:
merge_group:
push:
branches:
- 'main'
- 'dev'
- 'cmake-**'
pull_request:
branches:
- 'main'
- 'dev'
- 'cmake-**'
env:
DEBIAN_FRONTEND: noninteractive
CMAKE_GENERATOR: Ninja
TARGET_LLVM_VERSION: 18
MULL_LLVM_VERSION: 17
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- name: Install build tools
run: |
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{env.TARGET_LLVM_VERSION}}
sudo apt update && sudo apt install -y pipx ninja-build clang-tidy-${{env.TARGET_LLVM_VERSION}} clang-format-${{env.TARGET_LLVM_VERSION}}
- name: Setup Node.js
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: 20
- name: Install Mermaid
run: |
sudo npm install -g @mermaid-js/[email protected]
- name: Install asciidoctor
run: |
sudo apt install -y asciidoctor
sudo gem install asciidoctor asciidoctor-diagram rouge
- name: Install cmake-format
run: |
pipx install cmakelang
pipx inject cmakelang pyyaml
- name: Install python quality tools
run: |
pipx install pytest
pipx inject pytest pytest-forked
pipx inject pytest hypothesis
pipx install mypy
pipx install black
echo "/opt/pipx_bin" >> $GITHUB_PATH
- name: Checkout target branch
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
ref: ${{github.base_ref}}
- name: Extract target branch SHA
run: echo "branch=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
id: target_branch
- name: Checkout PR branch
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure cmake for lib
env:
CC: "/usr/lib/llvm-${{env.TARGET_LLVM_VERSION}}/bin/clang"
CXX: "/usr/lib/llvm-${{env.TARGET_LLVM_VERSION}}/bin/clang++"
PR_TARGET_BRANCH: ${{ steps.target_branch.outputs.branch }}
working-directory: ${{github.workspace}}/test/library
run: cmake -Bbuild -DCPM_SOURCE_CACHE=~/cpm-cache
- name: Check lib quality
working-directory: ${{github.workspace}}/test/library
run: cmake --build build -t ci-quality
- name: Build lib docs
working-directory: ${{github.workspace}}/test/library
run: cmake --build build -t docs
- name: Configure cmake for app
env:
CC: "/usr/lib/llvm-${{env.TARGET_LLVM_VERSION}}/bin/clang"
CXX: "/usr/lib/llvm-${{env.TARGET_LLVM_VERSION}}/bin/clang++"
PR_TARGET_BRANCH: ${{ steps.target_branch.outputs.branch }}
working-directory: ${{github.workspace}}/test/application
run: cmake -Bbuild -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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Build app and run tests
working-directory: ${{github.workspace}}/test/application
run: |
cmake --build build -t build_unit_tests
ctest --output-on-failure --test-dir build
- name: Run benchmarks
working-directory: ${{github.workspace}}/test/application
run: |
cmake --build build -t benchmarks
- name: Run recipe tests
working-directory: ${{github.workspace}}/test/application
run: |
cmake --build build -t recipe_tests
- name: Generate coverage report
working-directory: ${{github.workspace}}/test/application
run: |
cmake --build build -t cpp_coverage_report
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Coverage report:</summary>" >> $GITHUB_STEP_SUMMARY
cat ./build/coverage_report.txt >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Check app quality
working-directory: ${{github.workspace}}/test/application
run: cmake --build build -t ci-quality
- name: Verify app setup
working-directory: ${{github.workspace}}/test
run: ./verify_links.sh
sanitize:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
strategy:
fail-fast: false
matrix:
sanitizer: [undefined, address]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Install build tools
run: |
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{env.TARGET_LLVM_VERSION}}
sudo apt install -y ninja-build clang-tidy-${{env.TARGET_LLVM_VERSION}} clang-format-${{env.TARGET_LLVM_VERSION}}
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure cmake for app
env:
CC: "/usr/lib/llvm-${{env.TARGET_LLVM_VERSION}}/bin/clang"
CXX: "/usr/lib/llvm-${{env.TARGET_LLVM_VERSION}}/bin/clang++"
SANITIZERS: ${{matrix.sanitizer}}
working-directory: ${{github.workspace}}/test/application
run: cmake -Bbuild -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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
# https://github.com/actions/runner-images/issues/9524
- name: Fix kernel mmap rnd bits
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
# high-entropy ASLR in much newer kernels that GitHub runners are
# using leading to random crashes: https://reviews.llvm.org/D148280
run: sudo sysctl vm.mmap_rnd_bits=28
- name: Build app and run tests
working-directory: ${{github.workspace}}/test/application
run: cmake --build build -t cpp_tests
mutate:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
steps:
- name: Install build tools
run: |
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{env.MULL_LLVM_VERSION}}
sudo apt install -y ninja-build
- name: Install mull
env:
MULL_VERSION: 0.23.0
run: |
wget https://github.com/mull-project/mull/releases/download/${{env.MULL_VERSION}}/Mull-${{env.MULL_LLVM_VERSION}}-${{env.MULL_VERSION}}-LLVM-${{env.MULL_LLVM_VERSION}}.0-ubuntu-24.04.deb
sudo dpkg -i Mull-${{env.MULL_LLVM_VERSION}}-${{env.MULL_VERSION}}-LLVM-${{env.MULL_LLVM_VERSION}}.0-ubuntu-24.04.deb
- name: Checkout PR branch
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Restore CPM cache
env:
cache-name: cpm-cache-0
id: cpm-cache-restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{runner.os}}-${{env.cache-name}}-
- name: Configure cmake for app
env:
CC: "/usr/lib/llvm-${{env.MULL_LLVM_VERSION}}/bin/clang"
CXX: "/usr/lib/llvm-${{env.MULL_LLVM_VERSION}}/bin/clang++"
working-directory: ${{github.workspace}}/test/application
run: cmake -Bbuild -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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/cpm-cache
key: ${{runner.os}}-${{env.cache-name}}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
- name: Build app and run mull tests
working-directory: ${{github.workspace}}/test/application
run: |
cmake --build build -t mull_tests
merge_ok:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-24.04
needs: [test, sanitize, mutate]
if: ${{ !cancelled() }}
steps:
- name: Enable merge
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
run: exit 1