From c21c1df0c3a6be58ace92296890a3a243078ff70 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:52:28 +0200 Subject: [PATCH] Add a workflow to concretize on top of the current nightlies on CVMFS (#660) --- .../workflows/concretize-current-nightly.yaml | 90 +++++++++++++++++++ .github/workflows/concretize.yaml | 8 +- 2 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/concretize-current-nightly.yaml diff --git a/.github/workflows/concretize-current-nightly.yaml b/.github/workflows/concretize-current-nightly.yaml new file mode 100644 index 00000000..14f7199d --- /dev/null +++ b/.github/workflows/concretize-current-nightly.yaml @@ -0,0 +1,90 @@ +# Concretize using the current nightlies as upstream to check if packages are changed or not +# with the new changes + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + concretize-current-nightly: + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.image }}-${{ matrix.build_type }} + cancel-in-progress: true + strategy: + matrix: + image: [alma9, ubuntu22] + build_type: [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 + + + if [ "${{ matrix.image }}" = "alma9" ]; then + os=almalinux9 + elif [ "${{ matrix.image }}" = "ubuntu22" ]; then + os=ubuntu22 + else + echo "Unknown image" + exit 1 + fi + + rel=$(find /cvmfs/sw-nightlies.hsf.org/key4hep/releases/ -maxdepth 3 -type f -wholename "*$os*opt*/.scratch" | sort -r | head -1) + rel=$(dirname $rel) + + cd / + git clone https://github.com/spack/spack -q + cd /spack + git checkout $(cat /key4hep-spack/.latest-commit) + source /key4hep-spack/.cherry-pick + source /spack/share/spack/setup-env.sh + + if [ "${{ matrix.build_type }}" = "release" ]; then + env=key4hep-release + elif [ "${{ matrix.build_type }}" = "nightly" ]; then + env=key4hep-nightly-opt + pip3 install pyyaml + python3 /key4hep-spack/scripts/fetch_nightly_versions.py --path /key4hep-spack/environments/key4hep-common/packages.yaml --extra-path /key4hep-spack/environments/key4hep-nightly-opt/packages.yaml "" + else + echo "Unknown build type" + exit 1 + fi + cd /key4hep-spack/environments/${env} + spack env activate . + spack config add "upstreams:nightly-from-scratch:install_tree: $rel" + spack concretize >> conc.txt + cat conc.txt + echo "=========================================" + echo "List of changes:" + cat conc.txt | grep -E " -" + + 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" diff --git a/.github/workflows/concretize.yaml b/.github/workflows/concretize.yaml index 64f88286..423b5629 100644 --- a/.github/workflows/concretize.yaml +++ b/.github/workflows/concretize.yaml @@ -30,15 +30,17 @@ jobs: 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 - cd / - ls -lah / - ls -lah /key4hep-spack + cd / git clone https://github.com/spack/spack -q source spack/share/spack/setup-env.sh