diff --git a/.github/workflows/macos-ci.yml b/.github/workflows/macos-ci.yml new file mode 100644 index 000000000..77e6d6dd7 --- /dev/null +++ b/.github/workflows/macos-ci.yml @@ -0,0 +1,185 @@ +name: macOS CI Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: false + +permissions: + contents: read + packages: write + +jobs: + build: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + ENV: [ci, xl, tf] + + env: + GITHUB_REGISTRY_USER: ${{ secrets.GHCR_REGISTRY_USER }} + GITHUB_REGISTRY_TOKEN: ${{ secrets.GHCR_REGISTRY_TOKEN }} + + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Set Deployment Target to match runner SDK + run: | + # Fetch the active SDK version (e.g., 14.5) + CURRENT_SDK=$(xcrun --show-sdk-version) + + # Export it to the GitHub environment so all future steps use it + echo "MACOSX_DEPLOYMENT_TARGET=$CURRENT_SDK" >> $GITHUB_ENV + + - name: Extract Spack configuration + id: spack-config + run: | + # Source spack.sh to get SPACK_VERSION and SPACK_CHERRYPICKS + source spack.sh + echo "spack-version=${SPACK_VERSION}" >> $GITHUB_OUTPUT + echo "spack-cherrypicks<> $GITHUB_OUTPUT + echo "${SPACK_CHERRYPICKS}" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + # Source spack-packages.sh to get SPACKPACKAGES_VERSION and SPACKPACKAGES_CHERRYPICKS + source spack-packages.sh + echo "spackpackages-version=${SPACKPACKAGES_VERSION}" >> $GITHUB_OUTPUT + echo "spackpackages-cherrypicks<> $GITHUB_OUTPUT + echo "${SPACKPACKAGES_CHERRYPICKS}" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + # Source key4hep-spack.sh to get KEY4HEPSPACK_VERSION + source key4hep-spack.sh + echo "key4hepspack-version=${KEY4HEPSPACK_VERSION}" >> $GITHUB_OUTPUT + + # Source eic-spack.sh to get EICSPACK_VERSION + source eic-spack.sh + echo "eicspack-version=${EICSPACK_VERSION}" >> $GITHUB_OUTPUT + + # Extract buildcache URL from mirrors.yaml.in (simplified - get the version) + echo "buildcache-version=${SPACKPACKAGES_VERSION}" >> $GITHUB_OUTPUT + + - name: Checkout Spack repository + uses: actions/checkout@v7 + with: + repository: spack/spack + path: spack + ref: ${{ steps.spack-config.outputs.spack-version }} + fetch-depth: 0 + + - name: Configure spack + run: | + cd ${{ github.workspace }}/spack + echo "${{ github.workspace }}/spack/bin" >> $GITHUB_PATH + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + # Fetch branches from which we cherry-pick + git fetch origin refs/heads/develop:refs/heads/develop + git fetch origin pull/51584/head:pr-51584 + git fetch origin pull/52207/head:pr-52207 + + # Apply cherry-picks from spack.sh (match only valid git commit hashes) + while read -r commit; do + if git merge-base --is-ancestor "${commit}" HEAD; then + echo "Skipping already applied ${commit}" + continue + fi + echo "Cherry-picking ${commit}" + git cherry-pick "${commit}" + done < <(echo "${{ steps.spack-config.outputs.spack-cherrypicks }}" | grep -E '^[a-f0-9]{40}$' || true) + + - name: Checkout spack-packages repository + uses: actions/checkout@v7 + with: + repository: spack/spack-packages + path: spack/var/spack/repos/spack-packages + ref: ${{ steps.spack-config.outputs.spackpackages-version }} + + - name: Configure spack-packages + run: | + cd ${{ github.workspace }}/spack/var/spack/repos/spack-packages + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + # Fetch branches from which we cherry-pick + git fetch origin refs/heads/develop:refs/heads/develop + git fetch origin pull/3698/head:pr-3698 + git fetch origin pull/4871/head:pr-4871 + git fetch origin pull/5856/head:pr-5856 + + # Apply cherry-picks from spack-packages.sh (match only valid git commit hashes) + while read -r commit; do + if git merge-base --is-ancestor "${commit}" HEAD; then + echo "Skipping already applied ${commit}" + continue + fi + echo "Cherry-picking ${commit}" + git cherry-pick "${commit}" + done < <(echo "${{ steps.spack-config.outputs.spackpackages-cherrypicks }}" | grep -E '^[a-f0-9]{40}$' || true) + + cd ${{ github.workspace }}/spack + spack repo add var/spack/repos/spack-packages/repos/spack_repo/builtin + + - name: Checkout key4hep-spack repository + uses: actions/checkout@v7 + with: + repository: key4hep/key4hep-spack + path: spack/var/spack/repos/key4hep-spack + ref: ${{ steps.spack-config.outputs.key4hepspack-version }} + + - name: Configure key4hep-spack + run: | + cd ${{ github.workspace }}/spack + spack repo add var/spack/repos/key4hep-spack + + - name: Checkout eic-spack repository + uses: actions/checkout@v7 + with: + repository: eic/eic-spack + path: spack/var/spack/repos/eic-spack + ref: ${{ steps.spack-config.outputs.eicspack-version }} + + - name: Configure eic-spack + run: | + cd ${{ github.workspace }}/spack + spack repo add var/spack/repos/eic-spack/spack_repo/eic + + - name: Add Spack environment + run: | + spack compiler find --scope site + spack external find --scope site llvm + + - name: Configure buildcache + run: | + spack mirror add --scope site eic \ + --autopush --unsigned \ + --oci-username-variable GITHUB_REGISTRY_USER \ + --oci-password-variable GITHUB_REGISTRY_TOKEN \ + oci://ghcr.io/eic/spack-${{ steps.spack-config.outputs.buildcache-version }} + + - name: Concretize base environment + run: | + spack -e spack-environment/${{matrix.ENV}} -c view:false concretize --force + + - name: Install base environment + run: | + spack -e spack-environment/${{matrix.ENV}} -c view:false install --no-check-signature --show-log-on-error + + - name: Concretize epic environment + run: | + spack -e spack-environment/${{matrix.ENV}}/epic -c view:false concretize --force + + - name: Install epic environment + run: | + spack -e spack-environment/${{matrix.ENV}}/epic -c view:false install --no-check-signature --show-log-on-error diff --git a/spack-environment/ci/spack.yaml b/spack-environment/ci/spack.yaml index 00873132e..9893f6c7b 100644 --- a/spack-environment/ci/spack.yaml +++ b/spack-environment/ci/spack.yaml @@ -5,6 +5,18 @@ spack: - ../packages.yaml - ../packages_root_without_opengl.yaml - ../view.yaml + definitions: + # Note that in definitions 'when' takes a python expression as argument + # https://spack.readthedocs.io/en/latest/environments.html#spec-list-references + - when: arch.satisfies("platform=linux") + linux_packages: + - imagemagick + - nopayloadclient + - ollama + - py-numpy + - py-scipy + - when: arch.satisfies("platform=darwin") + linux_packages: [] specs: - acts - actsvg @@ -24,15 +36,12 @@ spack: - hepmc3 - hepmcmerger - heppdt - - imagemagick - irt - irt2 - iwyu - jana2 - just - - nopayloadclient - npsim -geocad - - ollama - onnx - osg-ca-certs - pelican @@ -58,14 +67,12 @@ spack: - py-matplotlib - py-mplhep - py-htgettoken - - py-numpy - py-onnx - py-onnxruntime - py-pandas - py-particle - py-pip - py-rucio-clients - - py-scipy - py-seaborn - py-snakemake-storage-plugin-fs - py-snakemake-storage-plugin-pelican diff --git a/spack-environment/packages.yaml b/spack-environment/packages.yaml index 49b402160..03d50ddab 100644 --- a/spack-environment/packages.yaml +++ b/spack-environment/packages.yaml @@ -60,7 +60,7 @@ packages: - +brotli +bz2 +dataset +filesystem +glog +ipc +jemalloc +lz4 +parquet +snappy +zlib +zstd binutils: require: - - ~gold + - '@2.44:' blas: require: - openblas @@ -73,14 +73,26 @@ packages: - cxxstd=20 c: prefer: - - gcc - require: - - gcc + - spec: gcc + when: platform=linux + - spec: apple-clang + when: platform=darwin + require: + - spec: gcc + when: platform=linux + - spec: apple-clang + when: platform=darwin cxx: prefer: - - gcc - require: - - gcc + - spec: gcc + when: platform=linux + - spec: apple-clang + when: platform=darwin + require: + - spec: gcc + when: platform=linux + - spec: apple-clang + when: platform=darwin cairo: require: - '@1.18.2:' @@ -202,9 +214,15 @@ packages: - +shared cxxstd=20 fortran: prefer: - - gcc - require: - - gcc + - spec: gcc + when: platform=linux + - spec: gcc + when: platform=darwin + require: + - spec: gcc + when: platform=linux + - spec: gcc + when: platform=darwin freetype: require: - build_system=autotools @@ -248,7 +266,13 @@ packages: require: - '@11.4.1.east' - cxxstd=20 -vecgeom +threads -vtk - - any_of: [+opengl +qt +x11, -opengl -qt -x11] + - any_of: [+opengl +qt, -opengl -qt] + - spec: ~x11 + when: ~opengl platform=linux + - spec: +x11 + when: +opengl platform=linux + - spec: ~x11 + when: platform=darwin geant4-data: require: - +nudexlib +tendl +urrpt @@ -263,10 +287,16 @@ packages: - ~gtk gl: require: - - glx + - spec: glx + when: platform=linux + - spec: apple-gl + when: platform=darwin glu: require: - - openglu + - spec: openglu + when: platform=linux + - spec: apple-glu + when: platform=darwin gloo: require: - '@2023-12-03' @@ -642,8 +672,12 @@ packages: root: require: - '@6.40.02' - - cxxstd=20 +fftw +fortran +gdml +http -ipo +mlp +python +root7 +tmva +tmva-sofie +x +xrootd +ssl + - cxxstd=20 +fftw +fortran +gdml +http -ipo +mlp +python +root7 +tmva +tmva-sofie +xrootd +ssl - any_of: [+opengl +webgui, -opengl -webgui] + - spec: +x + when: platform=linux + - spec: ~x + when: platform=darwin sherpa: require: - '@3.0.1' diff --git a/spack-environment/tf/spack.yaml b/spack-environment/tf/spack.yaml index 5813947b8..6c24037a2 100644 --- a/spack-environment/tf/spack.yaml +++ b/spack-environment/tf/spack.yaml @@ -4,7 +4,13 @@ spack: - ../config.yaml - ../packages.yaml - ../view.yaml + definitions: + - when: arch.satisfies("platform=linux") + tensorflow: [py-tensorflow +cuda] + - when: arch.satisfies("platform=darwin") + tensorflow: [py-tensorflow ~cuda] specs: + - $tensorflow - edm4hep - onnx - osg-ca-certs @@ -42,7 +48,6 @@ spack: - py-rucio-clients - py-scipy - py-seaborn - - py-tensorflow +cuda - py-tf2onnx - py-toml - py-uproot diff --git a/spack-environment/xl/spack.yaml b/spack-environment/xl/spack.yaml index 8b6cf2a60..48258b496 100644 --- a/spack-environment/xl/spack.yaml +++ b/spack-environment/xl/spack.yaml @@ -5,7 +5,15 @@ spack: - ../packages.yaml - ../packages_root_with_opengl.yaml - ../view.yaml + definitions: + # Note that in definitions 'when' takes a python expression as argument + # https://spack.readthedocs.io/en/latest/environments.html#spec-list-references + - when: arch.satisfies("platform=linux") + linux_packages: [strace, valgrind] + - when: arch.satisfies("platform=darwin") + linux_packages: [] specs: + - $linux_packages - acts - actsvg - afterburner @@ -133,8 +141,6 @@ spack: - snakemake - spdlog - stow - - strace - - valgrind - xeyes - xrootd - xrootd-mcp-server diff --git a/spack-packages.sh b/spack-packages.sh index 49b5b3f5e..0f5051fc0 100644 --- a/spack-packages.sh +++ b/spack-packages.sh @@ -12,21 +12,22 @@ SPACKPACKAGES_VERSION="v2026.06.0" ## Space-separated list of spack-packages cherry-picks read -r -d '' SPACKPACKAGES_CHERRYPICKS <<- \ --- || true -a115a811bdfce4db5298a9ba9b7903ccfb0de101 -20444b8e9382e659360a1446688d10a8c2d2ad31 -f5742718da7bd1d078ddc8423011a82ef2e3c759 +384fd54caf18c6393607bff018853747d02c6e0f +bd9b4838fbf9e4ca01ad7b6c6df633ddcc750d71 deb4f17d93dbe012403614245334f7c73fcc086f 82a6d07a37d13c247e84417055f9cb5b4802ac4f 47780b2c59a8356c1f13cd7c8d250e3250c15ba8 28bd1a044251fca35e14ba55d7ddb567deadcdaa -a7c32f24cd5b69b237dc974804a71326306f4e58 -de97f131df3dbc940151f406afd5c2c1158a660c -caf013be0ee1594fdbba8feb07ffecc88474a2b0 +72269859719d77f986be7cc752946650d020ac3f +125ca0c4f3b8bb2c5312c571e27006d9ddc06085 +7a6fa1c4f62f27531c93ecfeedad30181e9616f9 +c72830c64ceda0390b12e0b7ddda6418fa3806be 75395349957ad785cca50002dffb18bbcb48af27 acac89d6bb7079412e711a50a3f06681132a2723 438abd1e09f0cea9cb0ccc7e0326adcd0408196b d4fb37cedfb7552a753bdc9c0c4792082f4b46e8 4dc856a13e9066ca3249a593d351af8cda521fa3 +3dcad5bb860184c91c17b97a9f3b13252d26d309 --- ## Optional hash table with comma-separated file list ## For these commits, the cherry-pick will be restricted to the listed files only. @@ -36,18 +37,19 @@ read -r -d '' SPACKPACKAGES_CHERRYPICKS_FILES <<- \ --- ## Ref: https://github.com/spack/spack-packages/commit/[hash] ## [hash]: [description] -## a115a811bdfce4db5298a9ba9b7903ccfb0de101: github-copilot: new package -## 20444b8e9382e659360a1446688d10a8c2d2ad31: github-copilot: add v1.0.8 -## f5742718da7bd1d078ddc8423011a82ef2e3c759: gaudi: workaround test-dependency bug with a when +## 384fd54caf18c6393607bff018853747d02c6e0f: github-copilot: new package +## bd9b4838fbf9e4ca01ad7b6c6df633ddcc750d71: gaudi: workaround test-dependency bug with a when ## deb4f17d93dbe012403614245334f7c73fcc086f: fix: add latest osg-ca-cert ## 82a6d07a37d13c247e84417055f9cb5b4802ac4f: osg-ca-certs: depends on gmake and perl, type build ## 47780b2c59a8356c1f13cd7c8d250e3250c15ba8: py-pynacl: depends on gmake, type build ## 28bd1a044251fca35e14ba55d7ddb567deadcdaa: py-throttler: add v1.2.3 -## a7c32f24cd5b69b237dc974804a71326306f4e58: py-tensorboard: add v2.21.0 -## de97f131df3dbc940151f406afd5c2c1158a660c: TensorFlow: add v2.21.0 -## caf013be0ee1594fdbba8feb07ffecc88474a2b0: Add missing xxd dep +## 72269859719d77f986be7cc752946650d020ac3f: py-tensorboard: add v2.21.0 +## 125ca0c4f3b8bb2c5312c571e27006d9ddc06085: TensorFlow: add v2.21.0 +## 7a6fa1c4f62f27531c93ecfeedad30181e9616f9: Add missing xxd dep +## c72830c64ceda0390b12e0b7ddda6418fa3806be: Workaround for macOS arm64 compile bug ## 75395349957ad785cca50002dffb18bbcb48af27: py-torch: ensure setuptools is not unnecessarily constrained for 2.10: ## acac89d6bb7079412e711a50a3f06681132a2723: cuda: append --allow-unsupported-compiler to CUDAFLAGS for dependent_spec ## 438abd1e09f0cea9cb0ccc7e0326adcd0408196b: herwig3: add CT14(?n)lo pdfsets as build-time resources ## d4fb37cedfb7552a753bdc9c0c4792082f4b46e8: py-tensorflow: add libclang variant ## 4dc856a13e9066ca3249a593d351af8cda521fa3: root: add v6.40.00, v6.40.02 +## 3dcad5bb860184c91c17b97a9f3b13252d26d309: readline: switch url for patch download diff --git a/spack.sh b/spack.sh index f3509ca49..842764525 100644 --- a/spack.sh +++ b/spack.sh @@ -11,7 +11,7 @@ SPACK_VERSION="v1.2.2" read -r -d '' SPACK_CHERRYPICKS <<- \ --- || true 292b0dcaba3b2a5e3f9668d205d39fee2c715721 -678e506a95b319c573ba7e84703b06d7275ab80e +473d1459fba532de0d3d7edc34d27b1432bc90cd --- ## Optional hash table with comma-separated file list read -r -d '' SPACK_CHERRYPICKS_FILES <<- \ @@ -20,4 +20,4 @@ read -r -d '' SPACK_CHERRYPICKS_FILES <<- \ ## Ref: https://github.com/spack/spack/commit/[hash] ## [hash]: [description] ## 292b0dcaba3b2a5e3f9668d205d39fee2c715721: fix: write created time field with OCI buildcache config -## 678e506a95b319c573ba7e84703b06d7275ab80e: fix: don't map prefix to view root for pkgs excluded from view +## 473d1459fba532de0d3d7edc34d27b1432bc90cd: fix: don't map prefix to view root for pkgs excluded from view