diff --git a/.github/workflows/concretize-lxplus.yaml b/.github/workflows/concretize-lxplus.yaml deleted file mode 100644 index b714ff9e..00000000 --- a/.github/workflows/concretize-lxplus.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: concretize-lxplus -on: [push, pull_request] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: cvmfs-contrib/github-action-cvmfs@v2 - with: - cvmfs_repositories: 'sw.hsf.org,sw-nightlies.hsf.org,sft-nightlies.cern.ch,sft.cern.ch,geant4.cern.ch' - - name: Start container - run: | - docker run -it --name CI_container -e GITHUB_ENV=${GITHUB_ENV} -v ${GITHUB_WORKSPACE}:/Package -v /cvmfs:/cvmfs:shared -d ghcr.io/aidasoft/centos7:latest /bin/bash - - name: Setup Spack - run: | - docker exec CI_container /bin/bash -c 'cd ./Package - git clone --depth 1 https://github.com/key4hep/spack - git clone --depth 1 https://github.com/key4hep/key4hep-spack - ' - - name: Concretize - run: | - docker exec CI_container /bin/bash -c 'cd ./Package - source spack/share/spack/setup-env.sh - spack env activate environments/key4hep-release-user - spack repo add key4hep-spack - source environments/key4hep-release-user/setup_clingo_centos7.sh - spack add key4hep-stack - spack concretize -f --reuse | tee -a key4hep-stack-concretization.log;' - - uses: actions/upload-artifact@v2 - with: - name: concretization-log-artifact - path: key4hep-stack-concretization.log - retention-days: 5 diff --git a/.github/workflows/concretize-ubuntu.yaml b/.github/workflows/concretize-ubuntu.yaml deleted file mode 100644 index 2df0dbb1..00000000 --- a/.github/workflows/concretize-ubuntu.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: concretize-ubuntu - -on: [push, pull_request] - -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Concretize key4hep-stack - run: | - git clone --depth 1 https://github.com/key4hep/spack - source spack/share/spack/setup-env.sh - spack env create testenv - spack env activate testenv - spack repo add . - spack compiler find - spack add key4hep-stack - spack concretize | tee -a ${GITHUB_WORKSPACE}/key4hep-stack-concretization.log diff --git a/.github/workflows/concretize.yaml b/.github/workflows/concretize.yaml new file mode 100644 index 00000000..64f88286 --- /dev/null +++ b/.github/workflows/concretize.yaml @@ -0,0 +1,69 @@ +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 + run: | + + cat <<'EOF' > ${GITHUB_WORKSPACE}/script_container.sh + set -e + + cd / + ls -lah / + ls -lah /key4hep-spack + + git clone https://github.com/spack/spack -q + source spack/share/spack/setup-env.sh + + cd /spack + git checkout $(cat /key4hep-spack/.latest-commit) + source /key4hep-spack/.cherry-pick + + 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 concretize + + 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"