Skip to content

Commit

Permalink
Add a workflow for concretizing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Sep 16, 2024
1 parent cb098a1 commit 16d28b9
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/concretize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
matrix:
image: [alma9, ubuntu22]
build_type: [release, nightly]
concretize:
runs-on: ubuntu-latest
steps:
- name: Start container
run: |
name=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
if [ "${{ inputs.image }}" = "alma9" ]; then
docker run --name container --privileged -v ${GITHUB_WORKSPACE}:/${name} -v ~/.cache/ccache:/root/.cache/ccache -d ghcr.io/key4hep/key4hep-images/alma9-cvmfs tail -f /dev/null
elif [ "${{ inputs.image }}" = "ubuntu22" ]; then
docker run --name container --privileged -v ${GITHUB_WORKSPACE}:/${name} -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
run: |
name=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
cat <<'EOF' > ${GITHUB_WORKSPACE}/script_container.sh
set -e
if [ "${{ inputs.build_type }}" = "release" ]; then
env=key4hep-release
elif [ "${{ inputs.build_type }}" = "nightly" ]; then
env=key4hep-nightly-opt
else
echo "Unknown build type"
exit 1
fi
cd /
git clone https://github.com/spack/spack -q
source spack/share/spack/setup-env.sh
cd /spack
git checkout $(cat /${name}/.latest-commit)
source /${name}/.cherry-pick
cd /${name}/environments/${env}
spacktivate .
spack concretize
EOF
chmod +x ${GITHUB_WORKSPACE}/script_container.sh
# cat ${GITHUB_WORKSPACE}/script_container.sh
docker exec container /bin/bash -c "/mount.sh && /${name}/script_container.sh"

0 comments on commit 16d28b9

Please sign in to comment.