Skip to content
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

Add a workflow to concretize using the latest release of spack #699

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
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
37 changes: 37 additions & 0 deletions .github/scripts/concretize-tag-spack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cd /
if [ -z "$2" ]; then
tag=$(curl -s https://api.github.com/repos/spack/spack/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
else
tag="$2"
fi
echo "Checking out the spack tag: $tag"
git clone https://github.com/spack/spack -q -b $tag
source spack/share/spack/setup-env.sh

cd /spack
# git checkout $(cat /key4hep-spack/.latest-commit)
# source /key4hep-spack/.cherry-pick

if [ "$1" = "release" ]; then
env=key4hep-release-opt
elif [ "$1" = "nightly" ]; then
env=key4hep-nightly-opt
else
echo "Unknown build type"
exit 1
fi
cd /key4hep-spack/environments/${env}

echo "========="
echo "spack.yaml"
cat spack.yaml
echo "========="
echo "packages.yaml"
cat packages.yaml
echo "========="
echo "key4hep-common/packages.yaml"
cat /key4hep-spack/environments/key4hep-common/packages.yaml
echo "========="

spack env activate .
spack concretize
52 changes: 52 additions & 0 deletions .github/workflows/concretize-latest-spack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Concretize latest spack

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
concretize:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.image }}-${{ matrix.build_type }}
cancel-in-progress: true
strategy:
matrix:
image: [alma9, ubuntu22]
build_type: [release, nightly]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start container
run: |
name=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
if [ "${{ matrix.image }}" = "alma9" ]; then
docker run --name container --privileged -v ${GITHUB_WORKSPACE}:/key4hep-spack -v ~/.cache/ccache:/root/.cache/ccache -d ghcr.io/key4hep/key4hep-images/alma9-cvmfs tail -f /dev/null
elif [ "${{ matrix.image }}" = "ubuntu22" ]; then
docker run --name container --privileged -v ${GITHUB_WORKSPACE}:/key4hep-spack -v ~/.cache/ccache:/root/.cache/ccache -d ghcr.io/key4hep/key4hep-images/ubuntu22-cvmfs tail -f /dev/null
else
echo "Unknown image"
exit 1
fi

- name: Setup environment and concretize
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |

export GITHUB_TOKEN=${GH_TOKEN}

cat <<'EOF' > ${GITHUB_WORKSPACE}/script_container.sh
set -e

/key4hep-spack/.github/scripts/concretize-tag-spack.sh "${{ matrix.build_type }}"

EOF

chmod +x ${GITHUB_WORKSPACE}/script_container.sh

# cat ${GITHUB_WORKSPACE}/script_container.sh

docker exec container /bin/bash -c "/mount.sh && /key4hep-spack/script_container.sh"
Loading