diff --git a/.github/workflows/spack.yml b/.github/workflows/spack.yml index 35de78828425eea863296ad134c1a0d9bc6da961..2825d16a5b4e19b623506786d5eabff15414c390 100644 --- a/.github/workflows/spack.yml +++ b/.github/workflows/spack.yml @@ -3,6 +3,8 @@ name: Spack on: push: branches: [ master ] + pull_request: + branches: [ master ] jobs: build: @@ -16,5 +18,13 @@ jobs: uses: actions/checkout@v2 with: path: arbor + + - name: Spack cache + uses: actions/cache@v2 + with: + path: ~/.spack-cache + key: cache-${{ github.sha }} + restore-keys: cache- + - name: Build Arbor's Spack package against the develop branch run: arbor/scripts/build_spack_package.sh arbor develop diff --git a/scripts/build_spack_package.sh b/scripts/build_spack_package.sh index 0eeb151351aa466c1728c44ff6fbd4c150cde964..ca767e97bc1475c7a3828fe6c6712fb45ab4db9c 100755 --- a/scripts/build_spack_package.sh +++ b/scripts/build_spack_package.sh @@ -46,12 +46,20 @@ case $SPACK_VERSION in echo "SPACK_VERSION" must be \"latest_release\" or \"develop\" exit 1 esac + +mkdir ~/.spack +cp $ARBOR_DIR/spack/config.yaml ~/.spack + source $SPACK_DIR/share/spack/setup-env.sh spack repo create $SPACK_CUSTOM_REPO mkdir -p $SPACK_CUSTOM_REPO/packages/arbor spack repo add $SPACK_CUSTOM_REPO +# to make use of the cached installations +spack reindex + cp $ARBOR_DIR/spack/package.py $SPACK_CUSTOM_REPO/packages/arbor cd $ARBOR_DIR -spack dev-build arbor@with-package-from-repo +ARBOR_VERSION=$(cat "$ARBOR_DIR/VERSION") +spack dev-build arbor@${ARBOR_VERSION} diff --git a/spack/config.yaml b/spack/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3c1b6127db63e67c925e5a0eb62ba18a2056479a --- /dev/null +++ b/spack/config.yaml @@ -0,0 +1,6 @@ +config: + source_cache: ~/.spack-cache/source_cache + misc_cache: ~/.spack-cache/misc_cache + test_cache: ~/.spack-cache/test_cache + install_tree: + root: ~/.spack-cache/install