Skip to content

Commit 24f3357

Browse files
Copilotwdconinc
andauthored
Align macOS CI with container build: derive configuration at runtime (#96)
* Initial plan * Align macOS CI with container build: spack versions, cherry-picks, externals, and buildcache Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com> * Derive spack configuration from spack.sh and spack-packages.sh at runtime Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com> * Fix cherry-pick loops to filter heredoc delimiters and empty lines Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com> * Improve cherry-pick filtering and add proper quoting for security Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
1 parent c53cdf7 commit 24f3357

File tree

1 file changed

+56
-24
lines changed

1 file changed

+56
-24
lines changed

.github/workflows/macos-ci.yml

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,48 +32,80 @@ jobs:
3232
with:
3333
submodules: recursive
3434

35+
- name: Extract Spack configuration
36+
id: spack-config
37+
run: |
38+
# Source spack.sh to get SPACK_VERSION and SPACK_CHERRYPICKS
39+
source spack.sh
40+
echo "spack-version=${SPACK_VERSION}" >> $GITHUB_OUTPUT
41+
echo "spack-cherrypicks<<EOF" >> $GITHUB_OUTPUT
42+
echo "${SPACK_CHERRYPICKS}" >> $GITHUB_OUTPUT
43+
echo "EOF" >> $GITHUB_OUTPUT
44+
45+
# Source spack-packages.sh to get SPACKPACKAGES_VERSION and SPACKPACKAGES_CHERRYPICKS
46+
source spack-packages.sh
47+
echo "spackpackages-version=${SPACKPACKAGES_VERSION}" >> $GITHUB_OUTPUT
48+
echo "spackpackages-cherrypicks<<EOF" >> $GITHUB_OUTPUT
49+
echo "${SPACKPACKAGES_CHERRYPICKS}" >> $GITHUB_OUTPUT
50+
echo "EOF" >> $GITHUB_OUTPUT
51+
52+
# Extract buildcache URL from mirrors.yaml.in (simplified - get the version)
53+
echo "buildcache-version=${SPACKPACKAGES_VERSION}" >> $GITHUB_OUTPUT
54+
3555
- name: Setup Spack
3656
uses: spack/setup-spack@v2.1.1
3757
with:
38-
ref: develop
58+
ref: ${{ steps.spack-config.outputs.spack-version }}
3959
color: true
4060
path: ${{ github.workspace }}/spack
4161

62+
- name: Apply Spack cherry-picks
63+
run: |
64+
cd ${{ github.workspace }}/spack
65+
git config user.name "GitHub Actions"
66+
git config user.email "actions@github.com"
67+
68+
# Apply cherry-picks from spack.sh (match only valid git commit hashes)
69+
echo "${{ steps.spack-config.outputs.spack-cherrypicks }}" | grep -E '^[a-f0-9]{40}$' | while read -r commit; do
70+
echo "Cherry-picking ${commit}"
71+
git cherry-pick "${commit}"
72+
done
73+
74+
- name: Checkout and configure spack-packages
75+
run: |
76+
cd ${{ github.workspace }}/spack
77+
git clone https://github.com/spack/spack-packages.git var/spack/repos/spack-packages
78+
cd var/spack/repos/spack-packages
79+
git checkout ${{ steps.spack-config.outputs.spackpackages-version }}
80+
git config user.name "GitHub Actions"
81+
git config user.email "actions@github.com"
82+
83+
# Apply cherry-picks from spack-packages.sh (match only valid git commit hashes)
84+
echo "${{ steps.spack-config.outputs.spackpackages-cherrypicks }}" | grep -E '^[a-f0-9]{40}$' | while read -r commit; do
85+
echo "Cherry-picking ${commit}"
86+
git cherry-pick "${commit}"
87+
done
88+
89+
cd ${{ github.workspace }}/spack
90+
spack repo add var/spack/repos/spack-packages
91+
4292
- name: Add Spack environment
4393
run: |
4494
spack env create ci spack-environment/ci
4595
spack env activate ci
4696
spack -e ci compiler find
97+
spack -e ci external find llvm
4798
spack -e ci external find --not-buildable cmake
4899
49100
- name: Concretize
50101
run: |
51102
spack -e ci concretize -f
52103
53-
- name: Setup buildcache access
54-
uses: spack/github-actions-buildcache@v2
55-
with:
56-
mode: readwrite
57-
key: macos-${{ matrix.compiler }}-ci
104+
- name: Configure buildcache
105+
run: |
106+
spack -e ci mirror add eic oci://ghcr.io/eic/spack-${{ steps.spack-config.outputs.buildcache-version }}
107+
spack -e ci buildcache keys --install --trust
58108
59109
- name: Install
60110
run: |
61111
spack -e ci install --no-check-signature --show-log-on-error
62-
63-
- name: Push to buildcache
64-
if: always()
65-
run: |
66-
spack -e ci buildcache push --update-index --only=package --unsigned ${{ github.workspace }}/buildcache-macos
67-
68-
- name: Show environment info
69-
if: always()
70-
run: |
71-
spack -e ci find -lv
72-
spack -e ci graph --dot > ci-graph.dot
73-
74-
- name: Upload environment graph
75-
if: always()
76-
uses: actions/upload-artifact@v4
77-
with:
78-
name: ci-environment-graph-${{ matrix.compiler }}
79-
path: ci-graph.dot

0 commit comments

Comments
 (0)