diff --git a/.github/docker/ubuntu-20.04.Dockerfile b/.github/docker/ubuntu-20.04.Dockerfile index a6a45a8c1..5958824a3 100644 --- a/.github/docker/ubuntu-20.04.Dockerfile +++ b/.github/docker/ubuntu-20.04.Dockerfile @@ -1,10 +1,10 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based -# environment for building the Unified Memory Framework project. +# environment for building the Unified Memory Framework project. # # Pull base image ("20.04") @@ -23,13 +23,13 @@ ARG BASE_DEPS="\ git" # UMF's dependencies -ARG UMF_DEPS="\ - libhwloc-dev \ - libtbb-dev" +# libhwloc-dev is required # Dependencies for tests (optional) ARG TEST_DEPS="\ - libnuma-dev" + libnuma-dev \ + libtbb-dev\ + valgrind" # Miscellaneous for our builds/CI (optional) ARG MISC_DEPS="\ @@ -38,24 +38,35 @@ ARG MISC_DEPS="\ g++-7 \ python3-pip \ sudo \ - whois" + whois \ + lcov" + +# Hwloc installation dependencies +ARG HWLOC_DEPS="\ + dos2unix \ + libtool" + +# Copy hwloc +COPY .github/scripts/install_hwloc.sh /opt/umf/install_hwloc.sh # Update and install required packages RUN apt-get update \ && apt-get install -y --no-install-recommends \ ${BASE_DEPS} \ - ${UMF_DEPS} \ ${TEST_DEPS} \ ${MISC_DEPS} \ + ${HWLOC_DEPS} \ + && /opt/umf/install_hwloc.sh \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean all # Prepare a dir (accessible by anyone) -RUN mkdir --mode 777 /opt/umf/ +RUN mkdir -p --mode 777 /opt/umf/ # Additional dependencies (installed via pip) +# It's actively used and tested only on selected distros. Be aware +# they may not work, because pip packages list differ from OS to OS. COPY third_party/requirements.txt /opt/umf/requirements.txt -RUN pip3 install --no-cache-dir -r /opt/umf/requirements.txt # Add a new (non-root) 'test_user' ENV USER test_user diff --git a/.github/docker/ubuntu-22.04.Dockerfile b/.github/docker/ubuntu-22.04.Dockerfile index 75c71c526..8d63d2347 100644 --- a/.github/docker/ubuntu-22.04.Dockerfile +++ b/.github/docker/ubuntu-22.04.Dockerfile @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -24,12 +24,13 @@ ARG BASE_DEPS="\ # UMF's dependencies ARG UMF_DEPS="\ - libhwloc-dev \ - libtbb-dev" + libhwloc-dev" # Dependencies for tests (optional) ARG TEST_DEPS="\ - libnuma-dev" + libnuma-dev \ + libtbb-dev\ + valgrind" # Miscellaneous for our builds/CI (optional) ARG MISC_DEPS="\ @@ -37,20 +38,21 @@ ARG MISC_DEPS="\ clang \ python3-pip \ sudo \ - whois" + whois \ + lcov" # Update and install required packages RUN apt-get update \ && apt-get install -y --no-install-recommends \ ${BASE_DEPS} \ - ${UMF_DEPS} \ ${TEST_DEPS} \ ${MISC_DEPS} \ + ${UMF_DEPS} \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean all # Prepare a dir (accessible by anyone) -RUN mkdir --mode 777 /opt/umf/ +RUN mkdir -p --mode 777 /opt/umf/ # Additional dependencies (installed via pip) COPY third_party/requirements.txt /opt/umf/requirements.txt diff --git a/.github/docker/ubuntu-24.04.Dockerfile b/.github/docker/ubuntu-24.04.Dockerfile new file mode 100644 index 000000000..cd45cc52c --- /dev/null +++ b/.github/docker/ubuntu-24.04.Dockerfile @@ -0,0 +1,65 @@ +# Copyright (C) 2025 Intel Corporation +# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# +# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based +# environment for building the Unified Memory Framework project. +# + +# Pull base image ("24.04") +FROM registry.hub.docker.com/library/ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 + +# Set environment variables +ENV OS ubuntu +ENV OS_VER 24.04 +ENV NOTTY 1 +ENV DEBIAN_FRONTEND noninteractive + +# Base development packages +ARG BASE_DEPS="\ + build-essential \ + cmake \ + git" + +# UMF's dependencies +ARG UMF_DEPS="\ + libhwloc-dev" + +# Dependencies for tests (optional) +ARG TEST_DEPS="\ + libnuma-dev \ + libtbb-dev\ + valgrind" + +# Miscellaneous for our builds/CI (optional) +ARG MISC_DEPS="\ + automake \ + clang \ + python3-pip \ + sudo \ + whois \ + lcov" + +# Update and install required packages +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ${BASE_DEPS} \ + ${TEST_DEPS} \ + ${MISC_DEPS} \ + ${UMF_DEPS} \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get clean all + +# Prepare a dir (accessible by anyone) +RUN mkdir -p --mode 777 /opt/umf/ + +# Additional dependencies (installed via pip) +COPY third_party/requirements.txt /opt/umf/requirements.txt +RUN pip3 install --no-cache-dir --break-system-packages -r /opt/umf/requirements.txt + +# Add a new (non-root) 'test_user' +ENV USER test_user +ENV USERPASS pass +RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})" +USER test_user diff --git a/.github/workflows/pr_push.yml b/.github/workflows/pr_push.yml index cfc4a04b9..9633c5402 100644 --- a/.github/workflows/pr_push.yml +++ b/.github/workflows/pr_push.yml @@ -14,50 +14,87 @@ concurrency: permissions: contents: read + packages: read jobs: CodeChecks: uses: ./.github/workflows/reusable_checks.yml DocsBuild: uses: ./.github/workflows/reusable_docs_build.yml + DetectChanges: + runs-on: ubuntu-latest + outputs: + changed_files: ${{ steps.changed-files.outputs.all_changed_files }} + steps: + - name: Checkout code + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45.0.3 + + - name: List all changed files + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}" + BuildDockers: + if: ${{ contains(join(needs.DetectChanges.outputs.changed_files, ' '), '.github/docker/') }} + needs: [DetectChanges] + permissions: + contents: read + packages: write + secrets: inherit + uses: ./.github/workflows/reusable_dockers_build.yml FastBuild: - name: Fast builds - needs: [CodeChecks, DocsBuild] + if: always() && (needs.BuildDockers.result == 'skipped' || needs.BuildDockers.result == 'success') + needs: [CodeChecks, DocsBuild, BuildDockers] uses: ./.github/workflows/reusable_fast.yml Build: name: Basic builds + if: always() && (needs.FastBuild.result == 'success') needs: [FastBuild] uses: ./.github/workflows/reusable_basic.yml DevDax: + if: always() && (needs.FastBuild.result == 'success') needs: [FastBuild] uses: ./.github/workflows/reusable_dax.yml MultiNuma: + if: always() && (needs.FastBuild.result == 'success') needs: [FastBuild] uses: ./.github/workflows/reusable_multi_numa.yml L0: + if: always() && (needs.Build.result == 'success') needs: [Build] uses: ./.github/workflows/reusable_gpu.yml with: name: "LEVEL_ZERO" shared_lib: "['ON']" CUDA: + if: always() && (needs.Build.result == 'success') needs: [Build] uses: ./.github/workflows/reusable_gpu.yml with: name: "CUDA" shared_lib: "['ON']" Sanitizers: + if: always() && (needs.FastBuild.result == 'success') needs: [FastBuild] uses: ./.github/workflows/reusable_sanitizers.yml QEMU: + if: always() && (needs.FastBuild.result == 'success') needs: [FastBuild] uses: ./.github/workflows/reusable_qemu.yml with: short_run: true ProxyLib: + if: always() && (needs.Build.result == 'success') needs: [Build] uses: ./.github/workflows/reusable_proxy_lib.yml Valgrind: + if: always() && (needs.Build.result == 'success') needs: [Build] uses: ./.github/workflows/reusable_valgrind.yml Coverage: @@ -70,16 +107,18 @@ jobs: trigger: "${{github.event_name}}" Coverage_partial: # partial coverage (on forks) - if: github.repository != 'oneapi-src/unified-memory-framework' + if: github.repository != 'oneapi-src/unified-memory-framework' && always() && (needs.Build.result == 'success') needs: [Build, QEMU, ProxyLib] uses: ./.github/workflows/reusable_coverage.yml CodeQL: + if: always() && (needs.Build.result == 'success') needs: [Build] permissions: contents: read security-events: write uses: ./.github/workflows/reusable_codeql.yml Trivy: + if: always() && (needs.Build.result == 'success') needs: [Build] permissions: contents: read diff --git a/.github/workflows/reusable_basic.yml b/.github/workflows/reusable_basic.yml index 7170ec418..9be558818 100644 --- a/.github/workflows/reusable_basic.yml +++ b/.github/workflows/reusable_basic.yml @@ -5,6 +5,7 @@ on: workflow_call permissions: contents: read + packages: read env: BUILD_DIR : "${{github.workspace}}/build" @@ -15,9 +16,15 @@ env: jobs: ubuntu-build: name: Ubuntu + runs-on: ubuntu-latest + container: + image: ghcr.io/bb-ur/umf-ubuntu-${{ matrix.ubuntu_ver }}:latest + options: --user root --privileged + volumes: + - ${{ github.workspace }}:${{ github.workspace }} strategy: matrix: - os: ['ubuntu-20.04', 'ubuntu-22.04'] + ubuntu_ver: ['20.04', '22.04'] build_type: [Debug, Release] compiler: [{c: gcc, cxx: g++}] shared_library: ['OFF'] @@ -27,7 +34,7 @@ jobs: disable_hwloc: ['OFF'] link_hwloc_statically: ['OFF'] include: - - os: 'ubuntu-20.04' + - ubuntu_ver: 20.04 build_type: Release compiler: {c: gcc-7, cxx: g++-7} shared_library: 'OFF' @@ -36,7 +43,7 @@ jobs: install_tbb: 'ON' disable_hwloc: 'OFF' link_hwloc_statically: 'OFF' - - os: 'ubuntu-22.04' + - ubuntu_ver: 22.04 build_type: Release compiler: {c: clang, cxx: clang++} shared_library: 'OFF' @@ -45,7 +52,7 @@ jobs: install_tbb: 'ON' disable_hwloc: 'OFF' link_hwloc_statically: 'OFF' - - os: 'ubuntu-22.04' + - ubuntu_ver: 22.04 build_type: Release compiler: {c: gcc, cxx: g++} shared_library: 'ON' @@ -54,7 +61,7 @@ jobs: install_tbb: 'ON' disable_hwloc: 'OFF' link_hwloc_statically: 'OFF' - - os: 'ubuntu-24.04' + - ubuntu_ver: 24.04 build_type: Debug compiler: {c: gcc, cxx: g++} shared_library: 'ON' @@ -64,7 +71,7 @@ jobs: disable_hwloc: 'OFF' link_hwloc_statically: 'OFF' # test level_zero_provider='OFF' and cuda_provider='OFF' - - os: 'ubuntu-22.04' + - ubuntu_ver: 22.04 build_type: Release compiler: {c: gcc, cxx: g++} shared_library: 'OFF' @@ -74,7 +81,7 @@ jobs: disable_hwloc: 'OFF' link_hwloc_statically: 'OFF' # test icx compiler - - os: 'ubuntu-22.04' + - ubuntu_ver: 22.04 build_type: Release compiler: {c: icx, cxx: icpx} shared_library: 'ON' @@ -84,7 +91,7 @@ jobs: disable_hwloc: 'OFF' link_hwloc_statically: 'OFF' # test without installing TBB - - os: 'ubuntu-22.04' + - ubuntu_ver: 22.04 build_type: Release compiler: {c: gcc, cxx: g++} shared_library: 'ON' @@ -93,7 +100,7 @@ jobs: install_tbb: 'OFF' disable_hwloc: 'OFF' link_hwloc_statically: 'OFF' - - os: 'ubuntu-22.04' + - ubuntu_ver: 22.04 build_type: Debug compiler: {c: gcc, cxx: g++} shared_library: 'ON' @@ -102,7 +109,7 @@ jobs: install_tbb: 'ON' disable_hwloc: 'ON' link_hwloc_statically: 'OFF' - - os: 'ubuntu-22.04' + - ubuntu_ver: 22.04 build_type: Release compiler: {c: gcc, cxx: g++} shared_library: 'ON' @@ -111,45 +118,25 @@ jobs: install_tbb: 'ON' disable_hwloc: 'OFF' link_hwloc_statically: 'ON' - runs-on: ${{matrix.os}} - steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 - - name: Install apt packages - run: | - sudo apt-get update - sudo apt-get install -y clang cmake libnuma-dev lcov - - - name: Install TBB apt package - if: matrix.install_tbb == 'ON' - run: | - sudo apt-get install -y libtbb-dev - - name: Install oneAPI basekit if: matrix.compiler.cxx == 'icpx' run: | + sudo apt-get update sudo apt-get install -y gpg-agent wget wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list sudo apt-get update sudo apt-get install -y intel-oneapi-ippcp-devel intel-oneapi-ipp-devel intel-oneapi-common-oneapi-vars intel-oneapi-compiler-dpcpp-cpp - - name: Install g++-7 - if: matrix.compiler.cxx == 'g++-7' - run: sudo apt-get install -y ${{matrix.compiler.cxx}} - - name: Install libhwloc run: .github/scripts/install_hwloc.sh - - name: Get UMF version - run: | - VERSION=$(git describe --tags --abbrev=0 | grep -oP '\d+\.\d+\.\d+') - echo "UMF_VERSION=$VERSION" >> $GITHUB_ENV - - name: Configure build run: > ${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh &&' || ''}} @@ -181,11 +168,11 @@ jobs: ${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh' || true }} LD_LIBRARY_PATH="${{env.BUILD_DIR}}/lib/:${LD_LIBRARY_PATH}" ctest --output-on-failure - - name: Check coverage + - name: Check os coverage if: ${{ matrix.build_type == 'Debug' && matrix.compiler.c == 'gcc' }} working-directory: ${{env.BUILD_DIR}} run: | - export COVERAGE_FILE_NAME=${{env.COVERAGE_NAME}}-${{matrix.os}}-shared-${{matrix.shared_library}}-no_hwloc-${{matrix.disable_hwloc}} + export COVERAGE_FILE_NAME=${{env.COVERAGE_NAME}}-${{matrix.ubuntu_ver}}-shared-${{matrix.shared_library}}-no_hwloc-${{matrix.disable_hwloc}} echo "COVERAGE_FILE_NAME: $COVERAGE_FILE_NAME" ../scripts/coverage/coverage_capture.sh $COVERAGE_FILE_NAME mkdir -p ${{env.COVERAGE_DIR}} @@ -194,22 +181,22 @@ jobs: - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: ${{ matrix.build_type == 'Debug' && matrix.compiler.c == 'gcc' }} with: - name: ${{env.COVERAGE_NAME}}-${{matrix.os}}-shared-${{matrix.shared_library}}-no_hwloc-${{matrix.disable_hwloc}} + name: ${{env.COVERAGE_NAME}}-${{matrix.ubuntu_ver}}-shared-${{matrix.shared_library}}-no_hwloc-${{matrix.disable_hwloc}} path: ${{env.COVERAGE_DIR}} - name: Remove the installation directory run: rm -rf ${{env.INSTL_DIR}} - - name: Test UMF installation and uninstallation - # The '--shared-library' parameter is added to the installation test when the UMF is built as a shared library - run: > - python3 ${{github.workspace}}/test/test_installation.py - --build-dir ${{env.BUILD_DIR}} - --install-dir ${{env.INSTL_DIR}} - --build-type ${{matrix.build_type}} - ${{ matrix.install_tbb == 'ON' && matrix.disable_hwloc != 'ON' && matrix.shared_library == 'ON' && '--proxy' || '' }} - --umf-version ${{env.UMF_VERSION}} - ${{ matrix.shared_library == 'ON' && '--shared-library' || '' }} + # - name: Test UMF installation and uninstallation + # # The '--shared-library' parameter is added to the installation test when the UMF is built as a shared library + # run: > + # python3 ${{github.workspace}}/test/test_installation.py + # --build-dir ${{env.BUILD_DIR}} + # --install-dir ${{env.INSTL_DIR}} + # --build-type ${{matrix.build_type}} + # ${{ matrix.install_tbb == 'ON' && matrix.disable_hwloc != 'ON' && matrix.shared_library == 'ON' && '--proxy' || '' }} + # --umf-version ${{env.UMF_VERSION}} + # ${{ matrix.shared_library == 'ON' && '--shared-library' || '' }} windows-build: name: Windows diff --git a/.github/workflows/reusable_dockers_build.yml b/.github/workflows/reusable_dockers_build.yml new file mode 100644 index 000000000..fe4bb15a4 --- /dev/null +++ b/.github/workflows/reusable_dockers_build.yml @@ -0,0 +1,39 @@ +# Build and push Docker images to GHCR +name: BuildDockers + +on: + workflow_call: + workflow_dispatch: + +permissions: + packages: write + contents: read + +jobs: + build-dockers: + runs-on: ubuntu-latest + strategy: + matrix: + ubuntu-version: [20.04, 22.04, 24.04] + outputs: + status: ${{ job.status }} + env: + IMG: ghcr.io/bb-ur/umf-ubuntu-${{ matrix.ubuntu-version }}:latest + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: Login to GitHub Container Registry + uses: docker/login-action@30f019fb76bb54d03ec1e716054622be511a13b2 # v3.2.0 + with: + registry: ghcr.io + username: bb-ur + password: ${{ secrets.BB_GHCR_TOKEN }} + + - name: Build and push ubuntu-${{ matrix.ubuntu-version }} Docker image + run: | + docker build -f .github/docker/ubuntu-${{ matrix.ubuntu-version }}.Dockerfile -t ${{ env.IMG }} . + docker push ${{ env.IMG }} diff --git a/.github/workflows/reusable_fast.yml b/.github/workflows/reusable_fast.yml index 5166f2b96..e186064e0 100644 --- a/.github/workflows/reusable_fast.yml +++ b/.github/workflows/reusable_fast.yml @@ -1,54 +1,105 @@ -# Fast builds +# Fast build linux part is working in dockers, Windows is not name: FastBuild on: workflow_call permissions: contents: read + packages: read env: BUILD_DIR : "${{github.workspace}}/build" INSTL_DIR : "${{github.workspace}}/../install-dir" jobs: - FastBuild: - name: Fast builds - env: - VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows" + ubuntu-build: + name: Linux + runs-on: ${{ github.repository_owner == 'oneapi-src' && 'intel-ubuntu-22.04' || 'ubuntu-22.04' }} + container: + image: ghcr.io/bb-ur/umf-ubuntu-${{ matrix.ubuntu_ver }}:latest + options: --user root --privileged + volumes: + - ${{ github.workspace }}:${{ github.workspace }} strategy: matrix: include: - - os: windows-latest + - ubuntu_ver: 22.04 build_tests: 'ON' + extra_build_options: ' -DUMF_BUILD_BENCHMARKS=ON -DUMF_BUILD_BENCHMARKS_MT=ON' simple_cmake: 'OFF' - # pure C build (Windows) - - os: windows-latest - # Tests' building is off for a pure C build + # pure C build + - ubuntu_ver: 22.04 build_tests: 'OFF' - simple_cmake: 'OFF' - - os: ubuntu-latest - build_tests: 'ON' - # Windows doesn't recognize 'CMAKE_BUILD_TYPE', it uses '--config' param in build command - extra_build_options: '-DCMAKE_BUILD_TYPE=Release -DUMF_BUILD_BENCHMARKS=ON -DUMF_BUILD_BENCHMARKS_MT=ON' - simple_cmake: 'OFF' - # pure C build (Linux) - - os: ubuntu-latest - # Windows doesn't recognize 'CMAKE_BUILD_TYPE', it uses '--config' param in build command - # Tests' building is off for a pure C build - build_tests: 'OFF' - extra_build_options: '-DCMAKE_BUILD_TYPE=Release -DUMF_BUILD_BENCHMARKS=ON' + extra_build_options: '-DUMF_BUILD_BENCHMARKS=ON' simple_cmake: 'OFF' # simplest CMake on ubuntu-latest - - os: ubuntu-latest + - ubuntu_ver: 24.04 build_tests: 'ON' - extra_build_options: '-DCMAKE_BUILD_TYPE=Release' simple_cmake: 'ON' - # simplest CMake ubuntu-20.04 - - os: ubuntu-20.04 + - ubuntu_ver: 20.04 build_tests: 'ON' - extra_build_options: '-DCMAKE_BUILD_TYPE=Release' simple_cmake: 'ON' - runs-on: ${{ (matrix.os == 'ubuntu-latest' && github.repository_owner == 'oneapi-src') && 'intel-ubuntu-22.04' || matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: Configure CMake + if: matrix.simple_cmake == 'OFF' + run: > + cmake + -B ${{env.BUILD_DIR}} + -DCMAKE_BUILD_TYPE=Release + -DUMF_FORMAT_CODE_STYLE=OFF + -DUMF_DEVELOPER_MODE=ON + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON + -DUMF_BUILD_TESTS=${{matrix.build_tests}} + -DUMF_BUILD_EXAMPLES=ON + -DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON + -DUMF_BUILD_CUDA_PROVIDER=ON + -DUMF_TESTS_FAIL_ON_SKIP=ON + -DUMF_BUILD_SHARED_LIBRARY=ON + ${{matrix.extra_build_options}} + + - name: Configure CMake (simple) + if: matrix.simple_cmake == 'ON' + run: > + cmake + -B ${{env.BUILD_DIR}} + -DCMAKE_BUILD_TYPE=Release + -DUMF_BUILD_SHARED_LIBRARY=ON + -DUMF_TESTS_FAIL_ON_SKIP=ON + ${{matrix.extra_build_options}} + + - name: Build + run: cmake --build ${{env.BUILD_DIR}} --config Release -j $(nproc) + + - name: Run examples + working-directory: ${{env.BUILD_DIR}} + run: ctest --output-on-failure --test-dir examples -C Release + + - name: Run tests + if: matrix.build_tests == 'ON' + working-directory: ${{env.BUILD_DIR}} + run: ctest --output-on-failure --test-dir test -C Release + + windows-build: + name: Windows + runs-on: windows-latest + + env: + VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows" + strategy: + matrix: + include: + - build_tests: 'ON' + simple_cmake: 'OFF' + - build_tests: 'OFF' + simple_cmake: 'OFF' + - build_tests: 'OFF' + simple_cmake: 'ON' steps: - name: Checkout repository @@ -57,30 +108,15 @@ jobs: fetch-depth: 0 - name: Initialize vcpkg - if: matrix.os == 'windows-latest' uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 with: vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289 vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg vcpkgJsonGlob: '**/vcpkg.json' - - name: Install dependencies (windows-latest) - if: matrix.os == 'windows-latest' + - name: Install dependencies run: vcpkg install - shell: pwsh # Specifies PowerShell as the shell for running the script. - - - name: Install dependencies (ubuntu-latest) - if: matrix.os == 'ubuntu-latest' - run: | - sudo apt-get update - sudo apt-get install -y cmake libhwloc-dev libnuma-dev libtbb-dev - - - name: Install dependencies (ubuntu-20.04) - if: matrix.os == 'ubuntu-20.04' - run: | - sudo apt-get update - sudo apt-get install -y cmake libnuma-dev libtbb-dev - .github/scripts/install_hwloc.sh # install hwloc-2.3.0 instead of hwloc-2.1.0 present in the OS package + shell: pwsh - name: Configure CMake if: matrix.simple_cmake == 'OFF' @@ -98,7 +134,6 @@ jobs: -DUMF_BUILD_CUDA_PROVIDER=ON -DUMF_TESTS_FAIL_ON_SKIP=ON -DUMF_BUILD_SHARED_LIBRARY=ON - ${{matrix.extra_build_options}} - name: Configure CMake (simple) if: matrix.simple_cmake == 'ON' @@ -106,12 +141,12 @@ jobs: cmake -B ${{env.BUILD_DIR}} -DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}" + -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}" -DUMF_BUILD_SHARED_LIBRARY=ON -DUMF_TESTS_FAIL_ON_SKIP=ON - ${{matrix.extra_build_options}} - name: Build - run: cmake --build ${{env.BUILD_DIR}} --config Release -j + run: cmake --build ${{env.BUILD_DIR}} --config Release -j $Env:NUMBER_OF_PROCESSORS - name: Run examples working-directory: ${{env.BUILD_DIR}} @@ -125,7 +160,6 @@ jobs: # TODO: We could add some script to verify metadata of dll's (selected fields, perhaps) # ref. https://superuser.com/questions/381276/what-are-some-nice-command-line-ways-to-inspect-dll-exe-details - name: Print metadata of our dll's - if: matrix.os == 'windows-latest' run: | get-command ${{github.workspace}}/build/bin/Release/umf.dll | format-list get-command ${{github.workspace}}/build/src/proxy_lib/Release/umf_proxy.dll | format-list