Skip to content

Commit

Permalink
Speed up build_cache process when needing to build cache (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbarton authored May 7, 2024
1 parent e41a157 commit f5303eb
Showing 1 changed file with 18 additions and 17 deletions.
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 ruby@3.0
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

0 comments on commit f5303eb

Please # to comment.