Skip to content

Speed up build_cache process when not needing to build cache #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,18 @@ jobs:
echo "CLING_HASH=$env:CLING_HASH" >> $GITHUB_ENV
echo "LLVM_HASH=$env:LLVM_HASH" >> $GITHUB_ENV

- name: Restore Cache LLVM/Clang runtime build directory
uses: actions/cache/restore@v4
id: cache
with:
path: |
llvm-project
${{ matrix.cling=='On' && 'cling' || '' }}
key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-patch-${{ hashFiles(format('patches/llvm/clang{0}-*.patch', matrix.clang-runtime)) || 'none' }}
lookup-only: true

- name: Setup default Build Type on *nux
if: runner.os != 'windows'
if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CODE_COVERAGE=0" >> $GITHUB_ENV
Expand All @@ -198,15 +208,15 @@ jobs:
fi

- name: Setup default Build Type on Windows
if: runner.os == 'windows'
if: ${{ runner.os == 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
echo "BUILD_TYPE=Release" >> $env:GITHUB_ENV
echo "CODE_COVERAGE=0" >> $env:GITHUB_ENV
echo "ncpus=%NUMBER_OF_PROCESSORS%"
echo "ncpus=%NUMBER_OF_PROCESSORS%" >> $GITHUB_ENV

- name: Setup compiler on Linux
if: runner.os == 'Linux'
if: ${{ runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' }}
run: |
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
vers="${compiler#*-}"
Expand All @@ -230,7 +240,7 @@ jobs:
compiler: ${{ matrix.compiler }}

- name: Setup compiler on macOS
if: runner.os == 'macOS'
if: ${{ runner.os == 'macOS' && steps.cache.outputs.cache-hit != 'true' }}
run: |
vers="${compiler#*-}"
if [[ "${{ matrix.compiler }}" == *"gcc"* ]]; then
Expand All @@ -251,7 +261,7 @@ jobs:
#Section slightly modified version of
#https://github.com/vgvassilev/clad/blob/40d8bec11bde47b14a281078183a4f6147abeac5/.github/workflows/ci.yml#L510C1-L534C10
- name: Setup compiler on Windows
if: runner.os == 'windows'
if: ${{ runner.os == 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
if ( "${{ matrix.compiler }}" -imatch "clang" )
{
Expand All @@ -274,21 +284,21 @@ jobs:
}

- name: Install deps on Windows
if: runner.os == 'windows'
if: ${{ runner.os == 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
choco install findutils
$env:PATH="C:\Program Files (x86)\GnuWin32\bin;$env:PATH"

- name: Install deps on Linux
if: runner.os == 'Linux'
if: ${{ runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' }}
run: |
# Install deps
sudo apt-get update
sudo apt-get autoremove
sudo apt-get clean

- name: Install deps on MacOS
if: runner.os == 'macOS'
if: ${{ runner.os == 'macOS' && steps.cache.outputs.cache-hit != 'true' }}
run: |
brew update
brew remove [email protected]
Expand All @@ -299,15 +309,6 @@ jobs:
done
brew upgrade

- name: Restore Cache LLVM/Clang runtime build directory
uses: actions/cache/restore@v4
id: cache
with:
path: |
llvm-project
${{ matrix.cling=='On' && 'cling' || '' }}
key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-patch-${{ hashFiles(format('patches/llvm/clang{0}-*.patch', matrix.clang-runtime)) || 'none' }}

- name: Build LLVM/Cling on Unix systems if the cache is invalid
if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
Expand Down