diff --git a/.github/workflow_scripts/oneapi_cache_exclude_linux.sh b/.github/workflow_scripts/oneapi_cache_exclude_linux.sh new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflow_scripts/oneapi_setup_apt_repo_linux.sh b/.github/workflow_scripts/oneapi_setup_apt_repo_linux.sh new file mode 100644 index 0000000..ab47b08 --- /dev/null +++ b/.github/workflow_scripts/oneapi_setup_apt_repo_linux.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT + +wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB +sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB +echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list +sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/oneAPI.list" -o APT::Get::List-Cleanup="0" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bf96c10..6e1d03b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,17 +1,52 @@ +# based on: https://gist.github.com/scivision/b22455e3322826a1c385d5d4b1a8d25e + name: Build project -on: [push] +env: + LINUX_CPP_COMPONENTS: intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + # https://github.com/oneapi-src/oneapi-ci/blob/master/.github/workflows/build_all.yml + CTEST_NO_TESTS_ACTION: error + +on: + push: + paths: + - "**.cpp" + - "**.hpp" + - "CMakeLists.txt" + - ".github/workflows/*.yaml" + - "build.sh" jobs: - build: + linux: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 + # must be first as we're using scripts from this repo + - uses: actions/checkout@v4 + + - name: cache install oneAPI + id: cache-install + uses: actions/cache@v3 + with: + path: | + /opt/intel/oneapi + key: install-apt - - name: Set up environment - run: sudo apt-get update && sudo apt-get install -y build-essential + - name: non-cache install oneAPI + if: steps.cache-install.outputs.cache-hit != 'true' + timeout-minutes: 10 + run: | + sh -c .github/workflow_scripts/oneapi_setup_apt_repo_linux.sh + sudo apt install ${{ env.LINUX_CPP_COMPONENTS }} + + - name: Setup Intel oneAPI environment + run: | + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV - name: Run build script run: ./build.sh + + - name: exclude unused files from cache + if: steps.cache-install.outputs.cache-hit != 'true' + run: sh -c .github/workflow_scripts/oneapi_cache_exclude_linux.sh