Skip to content

Commit

Permalink
ci:oneapi: use cache
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Nov 30, 2023
1 parent 52e9093 commit 6089cb6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/oneapi-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: oneapi-linux

env:
CTEST_NO_TESTS_ACTION: error
LINUX_FORTRAN_COMPONENTS: intel-oneapi-compiler-fortran

on:
push:
Expand All @@ -25,23 +26,32 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Intel Apt repository
timeout-minutes: 1
- name: cache install oneAPI
id: cache-install
uses: actions/cache@v3
with:
path: |
/opt/intel/oneapi
key: install-apt

- name: non-cache install oneAPI
if: steps.cache-install.outputs.cache-hit != 'true'
timeout-minutes: 10
run: |
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
rm 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
- name: Install Intel oneAPI
timeout-minutes: 5
run: sudo apt-get install intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic ninja-build

sh -c .github/workflows/oneapi_setup_apt_repo_linux.sh
sudo apt install ${{ env.LINUX_FORTRAN_COMPONENTS }}
- name: Setup Intel oneAPI environment
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
- name: Install Ninja (separate from cache)
timeout-minutes: 5
run: sudo apt-get install ninja-build

- run: cmake --workflow --preset debug
- run: cmake --workflow --preset release

- name: exclude unused files from cache
if: steps.cache-install.outputs.cache-hit != 'true'
run: sh -c .github/workflows/oneapi_cache_exclude_linux.sh
13 changes: 13 additions & 0 deletions .github/workflows/oneapi_cache_exclude_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# SPDX-FileCopyrightText: 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT

#shellcheck disable=SC2010
LATEST_VERSION=$(ls -1 /opt/intel/oneapi/compiler/ | grep -v latest | sort | tail -1)

sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/compiler/lib/ia32_lin
sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/bin/ia32
sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/lib/emu
sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/lib/oclfpga
10 changes: 10 additions & 0 deletions .github/workflows/oneapi_setup_apt_repo_linux.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 6089cb6

Please sign in to comment.