Optimizes RestoreTracker #8160
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Main | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Pre-flight job to activate the cuda infrastructure | |
| prepare-dell: | |
| name: Activate self-host infrastructure | |
| runs-on: [self-hosted, spotter] | |
| steps: | |
| - name: Send Magic Packet | |
| env: | |
| TARGET_IP: 192.168.100.30 | |
| MAC_ADDR: a4:bb:6d:51:d5:d2 | |
| # The container has no ping, emulate it. | |
| run: | | |
| # Mask the IP and potential broadcast to keep logs clean | |
| echo "::add-mask::$MAC_ADDR" | |
| echo "::add-mask::$BROADCAST" | |
| echo "::add-mask::$TARGET_IP" | |
| BROADCAST=$(echo $TARGET_IP | sed 's/\.[0-9]*$/ .255/' | tr -d ' ') | |
| PING="timeout 1 bash -c 'cat < /dev/null > /dev/tcp/$TARGET_IP/22' 2>/dev/null" | |
| # Install tool silently | |
| sudo apt-get update -qq && sudo apt-get install -y -qq wakeonlan > /dev/null | |
| # Check if already awake (using the Bash TCP PING variable) | |
| if eval "$PING"; then | |
| echo "Target machine is already awake. Exiting." | |
| exit 0 | |
| fi | |
| # If offline, send WoL | |
| echo "Machine is offline. Sending WoL..." | |
| wakeonlan -i $BROADCAST $MAC_ADDR > /dev/null | |
| # Wait & Verify Loop (checks every 10s for 4 minutes) | |
| echo "Waiting for response (checking Port 22)..." | |
| for i in {1..24}; do | |
| if eval "$PING"; then | |
| echo "Machine is online and SSH is ready." | |
| exit 0 | |
| fi | |
| sleep 10 | |
| done | |
| echo "Error: Target hardware did not respond within the timeout period." | |
| exit 1 | |
| build: | |
| timeout-minutes: 600 # If some self-host machine is not available | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # --- LINUX: Last 10 Runtimes (12-21) --- | |
| # Using Ubuntu 22.04 for older runtimes, 24.04 for newer ones | |
| - { name: ubu22-gcc10-runtime11, os: ubuntu-22.04, compiler: gcc-10, clang-runtime: '11' } | |
| - { name: ubu22-gcc11-runtime12, os: ubuntu-22.04, compiler: gcc-11, clang-runtime: '12' } | |
| - { name: ubu22-clang13-runtime13, os: ubuntu-22.04, compiler: clang-13, clang-runtime: '13' } | |
| - { name: ubu24-gcc13-runtime14, os: ubuntu-24.04, compiler: gcc-13, clang-runtime: '14' } | |
| - { name: ubu24-clang15-runtime15, os: ubuntu-24.04, compiler: clang-15, clang-runtime: '15' } | |
| - { name: ubu24-gcc14-runtime16, os: ubuntu-24.04, compiler: gcc-14, clang-runtime: '16' } | |
| - { name: ubu24-clang16-runtime17, os: ubuntu-24.04, compiler: clang-16, clang-runtime: '17' } | |
| - { name: ubu24-gcc14-runtime18, os: ubuntu-24.04, compiler: gcc-14, clang-runtime: '18' } | |
| - { name: ubu24-clang17-runtime19, os: ubuntu-24.04, compiler: clang-17, clang-runtime: '19' } | |
| - { name: ubu24-clang19-runtime20, os: ubuntu-24.04, compiler: clang-19, clang-runtime: '20' } | |
| - { name: ubu24-clang20-runtime21, os: ubuntu-24.04, compiler: clang-20, clang-runtime: '21' } | |
| # --- MACOS: Last 5 Runtimes (17-21) --- | |
| # Using macOS ARM (standard) for all; Runtime 17 on Intel for x86 sanity | |
| - { name: osx-intel-runtime17, os: macos-15-intel, compiler: clang, clang-runtime: '17' } | |
| - { name: osx-arm-runtime18, os: macos-26, compiler: clang, clang-runtime: '18' } | |
| - { name: osx-arm-runtime19, os: macos-26, compiler: clang, clang-runtime: '19' } | |
| - { name: osx-arm-runtime20, os: macos-26, compiler: clang, clang-runtime: '20' } | |
| - { name: osx-arm-runtime21, os: macos-26, compiler: clang, clang-runtime: '21' } | |
| # --- WINDOWS: Last 5 Runtimes (17-21) --- | |
| - { name: win-msvc-runtime17, os: windows-2022, compiler: msvc, clang-runtime: '17' } | |
| - { name: win-msvc-runtime18, os: windows-2022, compiler: msvc, clang-runtime: '18' } | |
| - { name: win-msvc-runtime19, os: windows-2022, compiler: msvc, clang-runtime: '19' } | |
| - { name: win-msvc-runtime20, os: windows-2022, compiler: msvc, clang-runtime: '20' } | |
| - { name: win-msvc-runtime21, os: windows-2022, compiler: msvc, clang-runtime: '21' } | |
| # --- CUSTOM: Debug, coverage, benchmarks, static analysis --- | |
| - name: ubu24-clang20-runtime21-debug | |
| os: ubuntu-24.04 | |
| compiler: clang-20 | |
| clang-runtime: '21' | |
| debug_build: true | |
| - name: selfh-ubu22-gcc12-runtime19-analyzers | |
| os: [self-hosted, cuda, heavy] | |
| compiler: gcc-12 | |
| clang-runtime: '19' | |
| coverage: true | |
| cuda: true | |
| extra_cmake_options: '-DCLAD_ENABLE_ENZYME_BACKEND=On -DCLAD_CUDA_TEST_USE_SANITIZER=On' | |
| extra_packages: ' libzstd-dev ' | |
| #clang-format: true | |
| - name: ubu24-gcc13-runtime20-benchmarks | |
| os: ubuntu-24.04 | |
| compiler: gcc-13 | |
| clang-runtime: '20' | |
| extra_cmake_options: '-DCLAD_ENABLE_BENCHMARKS=On -DCLAD_ENABLE_ENZYME_BACKEND=On' | |
| extra_packages: "libomp-20-dev libopenblas-dev" | |
| benchmark: true | |
| - name: ubu22-clang13-runtime13-cuda | |
| os: ubuntu-22.04 | |
| compiler: clang-13 | |
| clang-runtime: '13' | |
| cuda: true | |
| - name: selfh-ubu22-clang16-runtime18-cuda | |
| os: [self-hosted, cuda, heavy] | |
| runs-on: cuda | |
| compiler: clang-16 | |
| extra_cmake_options: '-DCLAD_CUDA_TEST_USE_SANITIZER=On' | |
| clang-runtime: '18' | |
| cuda: true | |
| - name: ubuntu-clang15-runtime16-doc | |
| os: ubuntu-latest | |
| compiler: clang-15 | |
| clang-runtime: '16' | |
| doc_build: true | |
| - name: ubu24-clang16-runtime17-shared-libs | |
| os: ubuntu-24.04 | |
| compiler: clang-16 | |
| extra_cmake_options: '-DBUILD_SHARED_LIBS=On' | |
| clang-runtime: '17' | |
| - name: ubu22-clang16-runtime17-kokkos | |
| os: ubuntu-22.04 | |
| compiler: clang-16 | |
| clang-runtime: '17' | |
| extra_packages: 'libtrilinos-kokkos-dev ninja-build' | |
| extra_cmake_options: '-G Ninja' | |
| - name: ubu24-clang19-runtime20-vg | |
| os: ubuntu-24.04 | |
| compiler: clang-19 | |
| extra_packages: 'valgrind' | |
| extra_cmake_options: '-DCLAD_TEST_USE_VG=On' | |
| clang-runtime: '20' | |
| - name: ubu24-arm-clang16-runtime17-shared-libs | |
| os: ubuntu-24.04-arm | |
| compiler: clang-16 | |
| extra_cmake_options: '-DBUILD_SHARED_LIBS=On' | |
| clang-runtime: '17' | |
| - name: ubu24-arm-clang16-runtime17-kokkos | |
| os: ubuntu-24.04-arm | |
| compiler: clang-16 | |
| clang-runtime: '17' | |
| extra_packages: 'libtrilinos-kokkos-dev ninja-build' | |
| extra_cmake_options: '-G Ninja' | |
| - name: ubu24-arm-clang16-runtime18 | |
| os: ubuntu-24.04-arm | |
| compiler: clang-16 | |
| clang-runtime: '18' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Save PR Info | |
| if: ${{ matrix.coverage == true }} | |
| run: | | |
| mkdir -p ./pr | |
| echo ${{ github.event.number }} > ./pr/NR | |
| echo ${{ github.repository }} > ./pr/REPO | |
| - uses: actions/upload-artifact@v4 | |
| if: ${{ matrix.coverage == true }} | |
| with: | |
| name: pr | |
| path: pr/ | |
| overwrite: true | |
| - uses: nelonoel/branch-name@v1.0.1 | |
| - name: Setup default Build Type on *nux | |
| if: ${{ (matrix.debug_build != true) && (runner.os != 'windows') }} | |
| run: | | |
| echo "BUILD_TYPE=Release" >> $GITHUB_ENV | |
| echo "CLAD_CODE_COVERAGE=0" >> $GITHUB_ENV | |
| - name: Setup default Build Type on *nux (build_debug & asserts) | |
| if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }} | |
| run: | | |
| echo "BUILD_TYPE=Debug" >> $GITHUB_ENV | |
| # Cleanup some space: https://github.com/orgs/community/discussions/25678 | |
| rm -fr /opt/hostedtoolcache | |
| - name: Setup default Build Type on Windows | |
| if: runner.os == 'windows' | |
| run: | | |
| $env:BUILD_TYPE="Release" | |
| $env:CLAD_CODE_COVERAGE="0" | |
| echo "BUILD_TYPE=Release" >> $env:GITHUB_ENV | |
| echo "CLAD_CODE_COVERAGE=0" >> $env:GITHUB_ENV | |
| - name: Compute ncpus (cgroup-aware) | |
| if: runner.os != 'windows' | |
| run: | | |
| if [[ "${{ runner.os }}" == "macOS" ]]; then | |
| ncpus=$(sysctl -n hw.ncpu) | |
| else | |
| ncpus=$(nproc) | |
| if [[ -r /sys/fs/cgroup/cpu.max ]]; then | |
| read -r quota period < /sys/fs/cgroup/cpu.max || true | |
| if [[ "${quota:-max}" != "max" && "${period:-0}" -gt 0 ]]; then | |
| capped=$(( (quota + period - 1) / period )) | |
| if [[ "$capped" -ge 1 && "$capped" -lt "$ncpus" ]]; then | |
| ncpus="$capped" | |
| fi | |
| fi | |
| fi | |
| fi | |
| echo "ncpus=$ncpus" >> $GITHUB_ENV | |
| - name: Setup Ubuntu apt sources | |
| if: runner.os == 'Linux' | |
| run: | | |
| #Bypass the broken regional mirror immediately | |
| sudo sed -i 's|mirror+file:/etc/apt/apt-mirrors.txt|http://archive.ubuntu.com/ubuntu/|g' /etc/apt/sources.list | |
| sudo apt-get update -qq | |
| export ARCHITECHURE=$(uname -m) | |
| if [[ "$ARCHITECHURE" == "x86_64" ]]; then | |
| if ! sudo apt install -y llvm-${{ matrix.clang-runtime }}-dev ; then | |
| curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
| os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`" | |
| echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-${{ matrix.clang-runtime }} main" | sudo tee -a /etc/apt/sources.list | |
| sudo apt update | |
| fi | |
| else | |
| curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/llvm-snapshot.gpg | |
| sudo chmod a+r /etc/apt/keyrings/llvm-snapshot.gpg | |
| echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/"$(. /etc/os-release && echo "$VERSION_CODENAME")"/ llvm-toolchain-"$(. /etc/os-release && echo "$VERSION_CODENAME")" main" | sudo tee /etc/apt/sources.list.d/llvm-snapshot.list > /dev/null | |
| echo "deb-src [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/"$(. /etc/os-release && echo "$VERSION_CODENAME")"/ llvm-toolchain-"$(. /etc/os-release && echo "$VERSION_CODENAME")" main" | sudo tee -a /etc/apt/sources.list.d/llvm-snapshot.list > /dev/null | |
| cat /etc/apt/sources.list.d/llvm-snapshot.list | |
| fi | |
| sudo apt install -y llvm-${{ matrix.clang-runtime }}-dev \ | |
| llvm-${{ matrix.clang-runtime }}-tools \ | |
| clang-${{ matrix.clang-runtime }} \ | |
| libclang-${{ matrix.clang-runtime }}-dev \ | |
| libomp-${{ matrix.clang-runtime }}-dev \ | |
| ${{ matrix.extra_packages }} | |
| - name: Setup compiler on Linux | |
| if: runner.os == 'Linux' | |
| run: | | |
| # https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html | |
| vers="${compiler#*-}" | |
| os_codename="`cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2`" | |
| sudo apt update | |
| if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then | |
| sudo apt install -y gcc-${vers} g++-${vers} | |
| echo "CC=gcc-${vers}" >> $GITHUB_ENV | |
| echo "CXX=g++-${vers}" >> $GITHUB_ENV | |
| else | |
| if ! sudo apt install -y clang-${vers}; then | |
| curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
| echo "deb https://apt.llvm.org/${os_codename}/ llvm-toolchain-${os_codename}-${vers} main" | sudo tee -a /etc/apt/sources.list | |
| sudo apt update | |
| sudo apt install -y clang-${vers} | |
| fi | |
| echo "CC=clang-${vers}" >> $GITHUB_ENV | |
| echo "CXX=clang++-${vers}" >> $GITHUB_ENV | |
| fi | |
| env: | |
| compiler: ${{ matrix.compiler }} | |
| - name: Setup compiler on macOS | |
| if: runner.os == 'macOS' | |
| run: | | |
| if [[ "${{ matrix.compiler }}" == *"clang"* ]]; then | |
| echo "CC=clang" >> $GITHUB_ENV | |
| echo "CXX=clang++" >> $GITHUB_ENV | |
| else | |
| echo "Unsupported compiler - fix YAML file" | |
| fi | |
| - name: Setup compiler on Windows | |
| if: runner.os == 'windows' | |
| run: | | |
| if ( "${{ matrix.compiler }}" -imatch "clang" ) | |
| { | |
| $ver="${{ matrix.compiler }}".split("-")[1] | |
| choco install llvm --version=$ver --no-progress -my | |
| $env:PATH_TO_LLVM_BUILD="$env:ProgramFiles\LLVM" | |
| echo "PATH_TO_LLVM_BUILD=$env:PATH_TO_LLVM_BUILD" | |
| echo "PATH_TO_LLVM_BUILD=$env:PATH_TO_LLVM_BUILD" >> $env:GITHUB_ENV | |
| clang --version | |
| # | |
| $env:CC="clang" | |
| $env:CXX="clang++" | |
| echo "CC=clang" >> $env:GITHUB_ENV | |
| echo "CXX=clang++" >> $env:GITHUB_ENV | |
| } | |
| elseif ( "${{ matrix.compiler }}" -imatch "msvc" ) | |
| { | |
| # MSVC is builtin in container image | |
| } | |
| else | |
| { | |
| echo "Unsupported compiler - fix YAML file" | |
| } | |
| - name: Setup LLVM/Clang on macOS | |
| if: runner.os == 'macOS' | |
| run: | | |
| # llvm <=@11 are deprecated or deleted. | |
| # Install llvm from github releases. | |
| if [[ ${{ matrix.clang-runtime }} -le 11 ]]; then | |
| PATH_TO_LLVM_BUILD=/usr/local/opt/llvm@${{ matrix.clang-runtime }}/ | |
| pushd /usr/local/opt | |
| q="0" | |
| sudo rm -fr /usr/local/clang* | |
| sudo mv clang+llvm-${{ matrix.clang-runtime }}.$q.$w-x86_64-apple-darwin/ llvm@${{ matrix.clang-runtime }}/ | |
| # Use llvm/llvm@10/llvm@6 Filecheck | |
| if [[ ! -f $PATH_TO_LLVM_BUILD/bin/FileCheck ]]; then | |
| if [[ -f /usr/local/opt/llvm/bin/FileCheck ]]; then | |
| sudo ln -s /usr/local/opt/llvm/bin/FileCheck $PATH_TO_LLVM_BUILD/bin/FileCheck | |
| elif [[ -f /usr/local/opt/llvm\@10/bin/FileCheck ]]; then | |
| sudo ln -s /usr/local/opt/llvm\@10/bin/FileCheck $PATH_TO_LLVM_BUILD/bin/FileCheck | |
| elif [[ -f /usr/local/opt/llvm\@6/bin/FileCheck ]]; then | |
| sudo ln -s /usr/local/opt/llvm\@6/bin/FileCheck $PATH_TO_LLVM_BUILD/bin/FileCheck | |
| fi | |
| fi | |
| popd | |
| fi | |
| if [[ ${{ matrix.clang-runtime }} -gt 11 ]]; then | |
| # If the version of clang is in brew then install it. | |
| HAVE_LLVM=$(brew info --json llvm | jq -r '.[].aliases[],.[].versioned_formulae[]' | grep llvm@${{ matrix.clang-runtime }} || true) | |
| if [[ -z "$HAVE_LLVM" ]]; then | |
| brew update | |
| HAVE_LLVM=$(brew info --json llvm | jq -r '.[].aliases[],.[].versioned_formulae[]' | grep llvm@${{ matrix.clang-runtime }} || true) | |
| fi | |
| if [[ -n "$HAVE_LLVM" ]]; then | |
| # || true is a workaround for https://github.com/actions/runner-images/issues/9966 | |
| brew install llvm@${{ matrix.clang-runtime }} || true | |
| PATH_TO_LLVM_BUILD=$(brew --prefix llvm@${{ matrix.clang-runtime }}) | |
| else | |
| # FIXME: Make this generic. Currently this is broken... | |
| sudo curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang-runtime }}.1.0/LLVM-${{ matrix.clang-runtime }}.1.0-macOS-ARM64.tar.xz | sudo xz -d -c | sudo tar -x | |
| if [[ $(uname -p) == "arm" ]]; then | |
| export PATH_TO_LLVM_BUILD=/opt/homebrew/llvm@${{ matrix.clang-runtime }}/ | |
| else | |
| export PATH_TO_LLVM_BUILD=/usr/local/opt/llvm@${{ matrix.clang-runtime }}/ | |
| fi | |
| sudo mv LLVM-${{ matrix.clang-runtime }}.1.0-macOS-ARM64 $PATH_TO_LLVM_BUILD | |
| echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" | |
| ${PATH_TO_LLVM_BUILD}bin/clang --version | |
| fi | |
| else | |
| # Remove the c++ headers that come with the llvm package from homebrew | |
| # allowing clang to work with system's SDK. | |
| sudo rm -fr /usr/local/opt/llvm*/include/c++ | |
| fi | |
| PATH_TO_LLVM_BUILD=$(brew --prefix llvm@${{ matrix.clang-runtime }}) | |
| pip3 install lit # LLVM lit is not part of the llvm releases... | |
| # We need headers in correct place | |
| #FIXME: ln solution fails with error message No such file or directory on osx arm, | |
| #Copying over files as a temporary solution | |
| sudo cp -r -n $(xcrun --show-sdk-path)/usr/include/ /usr/local/include/ | |
| #for file in $(xcrun --show-sdk-path)/usr/include/* | |
| #do | |
| # if [ ! -f /usr/local/include/$(basename $file) ]; then | |
| # echo ${file} | |
| # ln -s ${file} /usr/local/include/$(basename $file) | |
| # fi | |
| #done | |
| # We need PATH_TO_LLVM_BUILD later | |
| echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV | |
| - name: Restore Cache LLVM/Clang runtime build directory (debug_build==true) | |
| if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }} | |
| uses: actions/cache/restore@v4 | |
| id: cache | |
| with: | |
| path: | | |
| llvm-project | |
| key: ${{ matrix.os }}-clang-${{ matrix.clang-runtime }}.x-${{ env.BUILD_TYPE }} | |
| - name: Build LLVM/Cling on Unix if the cache is invalid (debug_build==true) | |
| if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') && (steps.cache.outputs.cache-hit != 'true') }} | |
| run: | | |
| os="${{ matrix.os }}" | |
| git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git | |
| cd llvm-project | |
| # Build | |
| mkdir build | |
| cd build | |
| cmake \ | |
| -DLLVM_ENABLE_PROJECTS="clang" \ | |
| -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \ | |
| -DCMAKE_BUILD_TYPE=`[[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE` \ | |
| -DLLVM_ENABLE_ASSERTIONS=ON \ | |
| -DCLANG_ENABLE_STATIC_ANALYZER=OFF \ | |
| -DCLANG_ENABLE_ARCMT=OFF \ | |
| -DCLANG_ENABLE_FORMAT=OFF \ | |
| -DCLANG_ENABLE_BOOTSTRAP=OFF \ | |
| -DLLVM_ENABLE_TERMINFO=OFF \ | |
| -DCLANG_INCLUDE_TESTS=OFF \ | |
| -DCLANG_INCLUDE_DOCS=OFF \ | |
| -DLLVM_INCLUDE_TESTS=OFF \ | |
| -DLLVM_INCLUDE_DOCS=OFF \ | |
| ../llvm | |
| cmake --build . --target clang FileCheck not llvm-config clang-repl --parallel ${{ env.ncpus }} | |
| cd ../../ | |
| - name: Save Cache LLVM/Clang runtime build directory (debug_build==true) | |
| uses: actions/cache/save@v4 | |
| if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') && (steps.cache.outputs.cache-hit != 'true') }} | |
| with: | |
| path: | | |
| llvm-project | |
| key: ${{ steps.cache.outputs.cache-primary-key }} | |
| - name: Set LLVM/Cling build path on Unix (debug_build==true) | |
| if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }} | |
| run: | | |
| export PATH_TO_LLVM_BUILD="$PWD/llvm-project/build" | |
| echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" | |
| echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV | |
| pip3 install lit # LLVM lit is not part of the llvm releases... | |
| vers="${compiler#*-}" | |
| if [[ ! -f "$PATH_TO_LLVM_BUILD/bin/FileCheck" ]]; then | |
| ln -s /usr/bin/FileCheck-$vers $PATH_TO_LLVM_BUILD/bin/FileCheck | |
| fi | |
| env: | |
| compiler: ${{ matrix.compiler }} | |
| - name: Setup LLVM/Clang on Linux | |
| if: ${{ (runner.os == 'Linux') && (matrix.debug_build != true) }} | |
| run: | | |
| UNIX_DISTRO=$(lsb_release -rs) | |
| PATH_TO_LLVM_BUILD=/usr/lib/llvm-${{ matrix.clang-runtime }}/ | |
| # Add -H to silence 'The directory '/home/..../pip/http' or its parent | |
| # directory is not owned by the current user and the cache has been disabled. | |
| pip3 install lit # LLVM lit is not part of the llvm releases... | |
| # We need PATH_TO_LLVM_BUILD later | |
| echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV | |
| - name: Setup LLVM/Clang on Windows | |
| if: ${{ runner.os == 'windows' }} | |
| run: | | |
| C:\Miniconda\condabin\conda.bat install -y -c conda-forge "clangdev=${{ matrix.clang-runtime }}" | |
| $env:PATH_TO_LLVM_BUILD="$env:CONDA\Library" | |
| pip3 install lit # LLVM lit is not part of the llvm releases... | |
| echo "Runtime LLVM/Clang: $env:PATH_TO_LLVM_BUILD" | |
| echo "PATH_TO_LLVM_BUILD=$env:PATH_TO_LLVM_BUILD" | |
| echo "PATH_TO_LLVM_BUILD=$env:PATH_TO_LLVM_BUILD" >> $env:GITHUB_ENV | |
| - name: Setup CUDA 8 on Linux | |
| if: ${{ matrix.cuda == true && !matrix.os == 'self-hosted'}} | |
| run: | | |
| wget --no-verbose https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run | |
| wget --no-verbose https://developer.nvidia.com/compute/cuda/8.0/Prod2/patches/2/cuda_8.0.61.2_linux-run | |
| sh ./cuda_8.0.61_375.26_linux-run --tar mxvf | |
| sudo cp InstallUtils.pm /usr/lib/x86_64-linux-gnu/perl-base | |
| export $PERL5LIB | |
| sudo sh cuda_8.0.61_375.26_linux-run --override --no-opengl-lib --silent --toolkit --kernel-source-path=/lib/modules/4.15.0-1113-azure/build | |
| sudo sh cuda_8.0.61.2_linux-run --silent --accept-eula | |
| export PATH=/usr/local/cuda-8.0/bin:${PATH} | |
| export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-8.0/lib64 | |
| echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| echo "PATH=$PATH" >> $GITHUB_ENV | |
| - name: Setup code coverage | |
| if: ${{ (matrix.coverage == true) }} | |
| run: | | |
| sudo apt install -y lcov | |
| # Workaround ubuntu lcov-1.15-1 package bug | |
| if sudo apt list lcov --installed | grep "1.15-1" ; then | |
| wget https://launchpad.net/ubuntu/+source/lcov/1.15-2/+build/23784466/+files/lcov_1.15-2_all.deb | |
| sudo apt install -y ./lcov_1.15-2_all.deb | |
| fi | |
| echo "CLAD_CODE_COVERAGE=1" >> $GITHUB_ENV | |
| echo "BUILD_TYPE=Debug" >> $GITHUB_ENV | |
| - name: Display config *nix | |
| if: ${{ runner.os != 'windows' }} | |
| run: | | |
| cmake --version | |
| $CC --version | |
| $CXX --version | |
| xz --version | |
| tar --version | |
| echo "Use Clang/LLVM in $PATH_TO_LLVM_BUILD" | |
| echo "Building clad in `[[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE`" | |
| python3 --version | |
| - name: Display config Windows | |
| if: ${{ runner.os == 'windows' }} | |
| run: | | |
| cmake --version | |
| echo "CC=$env:CC" | |
| if ( "$env:CC" -ne "" ) | |
| { | |
| Start-Process -Wait -FilePath "$env:CC" -Verb RunAs -ArgumentList '--version' | |
| } | |
| echo "CXX=$env:CXX" | |
| if ( "$env:CXX" -ne "" ) | |
| { | |
| Start-Process -Wait -FilePath "$env:CXX" -Verb RunAs -ArgumentList '--version' | |
| } | |
| xz --version | |
| tar --version | |
| echo "Use Clang/LLVM in $env:PATH_TO_LLVM_BUILD" | |
| echo "Building clad in $env:BUILD_TYPE" | |
| python3 --version | |
| - name: Build Clad on *nix | |
| if: ${{ runner.os != 'windows' }} | |
| run: | | |
| rm -rf obj && mkdir obj && cd obj | |
| cmake -DClang_DIR=${{ env.PATH_TO_LLVM_BUILD }} \ | |
| -DLLVM_DIR=${{ env.PATH_TO_LLVM_BUILD }} \ | |
| -DCMAKE_BUILD_TYPE=$([[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE) \ | |
| -DCLAD_CODE_COVERAGE=${{ env.CLAD_CODE_COVERAGE }} \ | |
| -DLLVM_EXTERNAL_LIT="`which lit`" \ | |
| -DLLVM_ENABLE_WERROR=On \ | |
| $GITHUB_WORKSPACE \ | |
| ${{ matrix.extra_cmake_options }} | |
| cmake --build . -- -j${{ env.ncpus }} | |
| - name: Build Clad on Windows | |
| if: ${{ runner.os == 'windows' }} | |
| run: | | |
| mkdir obj | |
| cd obj | |
| if ( "$env:BUILD_TYPE" -eq "" ) | |
| { | |
| $env:BUILD_TYPE="RelWithDebInfo" | |
| } | |
| if ( "$env:CLAD_CODE_COVERAGE" -eq "" ) | |
| { | |
| $env:CLAD_CODE_COVERAGE="0" | |
| } | |
| ((Get-Content -path C:/Miniconda/Library/lib/cmake/llvm/LLVMConfig.cmake -Raw) -replace 'LLVM_ENABLE_DIA_SDK ON','LLVM_ENABLE_DIA_SDK OFF') | Set-Content -Path C:/Miniconda/Library/lib/cmake/llvm/LLVMConfig.cmake | |
| $lit = @(which lit) | |
| cmake -DClang_DIR="$env:PATH_TO_LLVM_BUILD" -DLLVM_DIR="$env:PATH_TO_LLVM_BUILD" -DCMAKE_BUILD_TYPE="$env:BUILD_TYPE" -DCLAD_CODE_COVERAGE="$env:CLAD_CODE_COVERAGE" -DCLAD_BUILD_STATIC_ONLY="ON" -DLLVM_EXTERNAL_LIT="$lit" "$env:GITHUB_WORKSPACE" ${{ matrix.extra_cmake_options }} | |
| cmake --build . --config Release | |
| - name: Test Clad on *nix | |
| if: ${{ runner.os != 'windows' }} | |
| env: | |
| # lit reads LIT_OPTS at startup; without it, lit defaults to | |
| # multiprocessing.cpu_count() which sees the host count and | |
| # ignores cgroup CFS quotas, over-provisioning workers on | |
| # constrained containers (cf. the LLVM build step's cap). | |
| LIT_OPTS: -j${{ env.ncpus }} | |
| run: | | |
| cd obj | |
| # Packages downloaded and unzipped require setting the SDKROOT. | |
| if [[ "runner.os" == "macOS" ]]; then | |
| export SDKROOT=`xcrun --show-sdk-path` | |
| fi | |
| cmake --build . --target check-clad -- -j${{ env.ncpus }} | |
| - name: Test Clad on Windows | |
| if: ${{ runner.os == 'windows' }} | |
| run: | | |
| cd obj | |
| #cmake --build . --target check-clad | |
| - name: Benchmark Clad | |
| if: ${{ matrix.benchmark }} | |
| run: | | |
| baseline_hash=$([[ -z "${{ github.event.pull_request }}" ]] && echo ${{ github.event.before }} || echo ${{ github.event.pull_request.base.sha }}) | |
| current_hash=${{ github.sha }} | |
| cd benchmark | |
| python3 benchmark_compare.py ${baseline_hash} ${current_hash} obj | |
| cd .. | |
| - name: Test build sphinx & doxygen documentation | |
| if: ${{ (matrix.doc_build == true) }} | |
| run: | | |
| sudo apt-get install -y doxygen graphviz | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| mkdir -p obj && cd obj | |
| cmake \ | |
| -DClang_DIR="$PATH_TO_LLVM_BUILD" \ | |
| -DLLVM_DIR="$PATH_TO_LLVM_BUILD" \ | |
| -DCLAD_INCLUDE_DOCS=ON \ | |
| -DCLAD_ENABLE_DOXYGEN=ON \ | |
| -DCLAD_ENABLE_SPHINX=ON \ | |
| -DCMAKE_INSTALL_PREFIX=../inst \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DLLVM_EXTERNAL_LIT="`which lit`" \ | |
| .. | |
| cmake --build . --target sphinx-clad doxygen-clad -- -j${{ env.ncpus }} | |
| - name: Failed job config | |
| if: ${{ failure() && runner.debug && runner.os != 'windows' }} | |
| env: | |
| GITHUB_CONTEXT: ${{ toJson(github) }} | |
| run: | | |
| echo "$GITHUB_CONTEXT" | |
| export | |
| if [[ "runner.os" == "Linux" ]]; then | |
| apt-mark showhold | |
| dpkg-query -L libclang-${{ matrix.clang-runtime }}-dev | |
| dpkg-query -L clang-${{ matrix.clang-runtime }} | |
| dpkg-query -L llvm-${{ matrix.clang-runtime }}-dev | |
| find /usr/lib/llvm-${{ matrix.clang-runtime }}/ | |
| fi | |
| if [[ "runner.os" == "macOS" ]]; then | |
| brew search llvm | |
| find /usr/local/opt/llvm@*/ | |
| fi | |
| pip show lit | |
| cat obj/CMakeCache.txt | |
| cat obj/CMakeFiles/*.log | |
| - name: Setup tmate session | |
| if: ${{ !cancelled() && runner.debug }} | |
| uses: mxschmitt/action-tmate@v3 | |
| # When debugging increase to a suitable value! | |
| timeout-minutes: 30 | |
| - name: Prepare code coverage report | |
| if: ${{ success() && (matrix.coverage == true) }} | |
| run: | | |
| # Create lcov report | |
| # capture coverage info | |
| vers="${CC#*-}" | |
| lcov --directory . --capture --output-file coverage.info --gcov-tool /usr/bin/gcov-${vers} --ignore-errors gcov | |
| # filter out system and extra files. | |
| # To also not include test code in coverage add them with full path to the patterns: '*/tests/*' | |
| lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' \ | |
| "$GITHUB_WORKSPACE"'/test/*' "$GITHUB_WORKSPACE"'/unittests/*' \ | |
| --output-file coverage.info | |
| # output coverage data for debugging (optional) | |
| lcov --list coverage.info | |
| - name: Upload to codecov.io | |
| if: ${{ success() && (matrix.coverage == true) }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.info | |
| fail_ci_if_error: true | |
| verbose: true | |
| token: ${{ secrets.CODECOV_TOKEN }} |