Skip to content

Commit

Permalink
try spack caching again
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Dec 20, 2024
1 parent 655f0be commit 6f9827a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 18 deletions.
38 changes: 37 additions & 1 deletion .github/actions/dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
description: 'Secrets to pass to the action'
required: false
default: ''
spack_version:
description: 'Version of Spack to use'
required: false
default: '2024-11-13'

runs:
using: 'composite'
Expand All @@ -18,7 +22,39 @@ runs:
if: startsWith(runner.os, 'macos')
shell: bash
run: |
brew install ninja ccache
brew install ninja ccache zstd
- name: Restore cache
id: cache-restore
uses: actions/cache/restore@v3
with:
path: spack.tar.zst
key: spack-${{ runner.os }}-${{ inputs.spack_version }}-${{ hashFiles('CI/dependencies/setup_spack.sh') }}

- name: Extract cached Spack
if: steps.cache-restore.outputs.cache-hit == 'true'
shell: bash
run: |
zstd -d spack.tar.zst -f
tar xf spack.tar
rm spack.tar
- name: Setup Spack from scratch
if: steps.cache-restore.outputs.cache-hit != 'true'
shell: bash
env:
SPACK_VERSION: ${{ inputs.spack_version }}
run: |
CI/dependencies/setup_spack.sh
tar cf spack.tar spack/
zstd -19 --rm spack.tar
- name: Save cache
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: spack.tar.zst
key: spack-${{ runner.os }}-${{ inputs.spack_version }}-${{ hashFiles('CI/dependencies/setup_spack.sh') }}

- name: Install dependencies
shell: bash
Expand Down
20 changes: 3 additions & 17 deletions CI/dependencies/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,12 @@ mkdir -p ${destination}

start_section "Install spack if not already installed"
if ! command -v spack &> /dev/null; then
if [ ! -d "spack" ]; then
echo "Cloning spack"
git clone -c feature.manyFiles=true https://github.com/spack/spack.git
pushd spack > /dev/null
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
# Apply patch for spack improvements
curl https://patch-diff.githubusercontent.com/raw/spack/spack/pull/47370.patch | git am
popd > /dev/null
else
echo "Updating spack"
pushd spack > /dev/null
git pull --rebase
popd > /dev/null
fi

source "$(pwd)/spack/share/spack/setup-env.sh"
"${SCRIPT_DIR}/setup_spack.sh"
fi
end_section

source "$(pwd)/spack/share/spack/setup-env.sh"

if [ -n "${CI:-}" ]; then
start_section "Add buildcache mirror"
mirror_name="acts-spack-buildcache"
Expand Down
20 changes: 20 additions & 0 deletions CI/dependencies/setup_spack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

_spack_version=${SPACK_VERSION:-develop}

if [ ! -d "spack" ]; then
echo "Cloning spack"
git clone -c feature.manyFiles=true https://github.com/spack/spack.git -b ${_spack_version}
pushd spack > /dev/null
git config user.name CI
git config user.email <>
echo "Applying patch for spack improvements"
curl https://patch-diff.githubusercontent.com/raw/spack/spack/pull/47370.patch | git am
curl https://patch-diff.githubusercontent.com/raw/spack/spack/pull/48236.patch | git am

rm -rf .git

echo "Populating the repository index"
bin/spack list > /dev/null
popd > /dev/null
fi

0 comments on commit 6f9827a

Please sign in to comment.