Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 18, 2025

The macOS CI workflow was using different spack configuration than the container builds, risking inconsistent behavior and package versions across environments.

Changes:

  • Runtime configuration: Extract spack versions and cherry-picks dynamically from spack.sh and spack-packages.sh at workflow runtime instead of hardcoding values
  • Spack versions: Use extracted versions (v1.0.2 for spack, v2025.07.0 for spack-packages) instead of hardcoded develop branch
  • Cherry-picks: Apply all commits (3 spack + 61 spack-packages) by parsing them from configuration files with robust filtering
  • External packages: Find llvm externally in addition to cmake, matching container build strategy
  • Buildcache: Configure OCI mirror dynamically using extracted version: oci://ghcr.io/eic/spack-${VERSION}
  • Cleanup: Remove environment graph generation and artifact upload
  • Maintainability: Workflow automatically stays in sync when spack.sh or spack-packages.sh are updated - no manual YAML changes needed
- name: Extract Spack configuration
  id: spack-config
  run: |
    source spack.sh
    echo "spack-version=${SPACK_VERSION}" >> $GITHUB_OUTPUT
    echo "spack-cherrypicks<<EOF" >> $GITHUB_OUTPUT
    echo "${SPACK_CHERRYPICKS}" >> $GITHUB_OUTPUT
    echo "EOF" >> $GITHUB_OUTPUT
    
- name: Setup Spack
  uses: spack/setup-spack@v2.1.1
  with:
    ref: ${{ steps.spack-config.outputs.spack-version }}
    
- name: Configure buildcache
  run: |
    spack -e ci mirror add eic oci://ghcr.io/eic/spack-${{ steps.spack-config.outputs.buildcache-version }}
    spack -e ci buildcache keys --install --trust

The workflow now maintains a single source of truth for spack configuration in the repository's existing configuration files.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ternals, and buildcache

Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Copilot AI changed the title [WIP] Update macOS CI workflow based on feedback Align macOS CI with container build: spack versions, cherry-picks, and buildcache Dec 18, 2025
Copilot AI requested a review from wdconinc December 18, 2025 22:42
Copy link
Contributor

@wdconinc wdconinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot The information from spack.sh and spack-packages.sh must be derived at runtime and not hardcoded in the workflow yaml definition.

…time

Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 18, 2025

@copilot The information from spack.sh and spack-packages.sh must be derived at runtime and not hardcoded in the workflow yaml definition.

Updated to derive all configuration from spack.sh and spack-packages.sh at runtime using bash source and GitHub Actions outputs. The workflow now automatically extracts versions and cherry-picks instead of hardcoding them (commit a82b16e)

Copilot AI and others added 2 commits December 18, 2025 22:49
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Copilot AI changed the title Align macOS CI with container build: spack versions, cherry-picks, and buildcache Align macOS CI with container build: derive configuration at runtime Dec 18, 2025
Copilot AI requested a review from wdconinc December 18, 2025 22:52
@wdconinc wdconinc marked this pull request as ready for review December 19, 2025 02:52
Copilot AI review requested due to automatic review settings December 19, 2025 02:52
@wdconinc wdconinc merged commit 24f3357 into macos-ci-workflow Dec 19, 2025
5 of 6 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns the macOS CI workflow with the container build configuration by dynamically extracting Spack configuration from source files rather than hardcoding values. This creates a single source of truth and ensures consistency across different build environments.

Key Changes:

  • Extracts Spack versions and cherry-picks dynamically from spack.sh and spack-packages.sh at runtime
  • Applies cherry-picks (3 for spack, 61 for spack-packages) using extracted commit hashes with validation filtering
  • Configures buildcache to use OCI mirror with extracted version: oci://ghcr.io/eic/spack-${VERSION}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- name: Checkout and configure spack-packages
run: |
cd ${{ github.workspace }}/spack
git clone https://github.com/spack/spack-packages.git var/spack/repos/spack-packages
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git clone command lacks error handling and doesn't specify a depth. If the clone fails due to network issues or if the repository is unavailable, the subsequent cd and git checkout commands will fail with confusing error messages. Consider adding --depth 1 for faster cloning since only a specific version is needed, and ensure the clone succeeds before proceeding.

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +72
echo "${{ steps.spack-config.outputs.spack-cherrypicks }}" | grep -E '^[a-f0-9]{40}$' | while read -r commit; do
echo "Cherry-picking ${commit}"
git cherry-pick "${commit}"
done
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grep pattern '^[a-f0-9]{40}$' will silently filter out invalid lines including the heredoc delimiters (---) and any malformed commit hashes. While this provides robustness, it also means that if the configuration files are accidentally corrupted or contain invalid data, the workflow will silently skip those entries without warning. Consider adding a validation step that warns if any lines are filtered out, or explicitly count and verify the expected number of cherry-picks were applied.

Copilot uses AI. Check for mistakes.
spack env create ci spack-environment/ci
spack env activate ci
spack -e ci compiler find
spack -e ci external find llvm
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spack external find llvm command is added without the --not-buildable flag, unlike cmake. This means spack may still attempt to build llvm from source if the external installation doesn't meet requirements. Based on the PR description mentioning "Find llvm externally in addition to cmake, matching container build strategy", consider whether --not-buildable should also be applied to llvm to enforce using only the external installation.

Suggested change
spack -e ci external find llvm
spack -e ci external find --not-buildable llvm

Copilot uses AI. Check for mistakes.
echo "Cherry-picking ${commit}"
git cherry-pick "${commit}"
done
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step changes directory multiple times (cd commands on lines 76, 78, and 89). Each cd in a multi-line run block affects subsequent commands in that block. While the logic appears correct, the final cd ${{ github.workspace }}/spack on line 89 before spack repo add could be fragile. Consider adding verification that you're in the correct directory, or restructure to avoid multiple directory changes.

Suggested change
- name: Register spack-packages repository
run: |

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +72
echo "${{ steps.spack-config.outputs.spack-cherrypicks }}" | grep -E '^[a-f0-9]{40}$' | while read -r commit; do
echo "Cherry-picking ${commit}"
git cherry-pick "${commit}"
done
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cherry-pick loop uses a pipe with while read, which runs in a subshell. If any cherry-pick fails, the error won't cause the workflow step to fail because the exit code is lost in the subshell. This could result in silently skipped cherry-picks and divergent behavior from the container builds.

Consider using a for loop with process substitution or command substitution to properly propagate errors. For example:

while IFS= read -r commit; do
  echo "Cherry-picking ${commit}"
  git cherry-pick "${commit}" || exit 1
done < <(echo "${{ steps.spack-config.outputs.spack-cherrypicks }}" | grep -E '^[a-f0-9]{40}$')

Or use command substitution with a for loop:

for commit in $(echo "${{ steps.spack-config.outputs.spack-cherrypicks }}" | grep -E '^[a-f0-9]{40}$'); do
  echo "Cherry-picking ${commit}"
  git cherry-pick "${commit}"
done

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +87
echo "${{ steps.spack-config.outputs.spackpackages-cherrypicks }}" | grep -E '^[a-f0-9]{40}$' | while read -r commit; do
echo "Cherry-picking ${commit}"
git cherry-pick "${commit}"
done
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same cherry-pick error handling issue exists here. The pipe with while read runs in a subshell, so if any cherry-pick fails, the error won't cause the workflow step to fail. This could result in silently skipped cherry-picks.

Apply the same fix as suggested for the spack cherry-picks: use process substitution or command substitution with proper error propagation.

Copilot uses AI. Check for mistakes.
done
cd ${{ github.workspace }}/spack
spack repo add var/spack/repos/spack-packages
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spack repo add command could fail if the repository path is invalid or if there are configuration issues. This would prevent the workflow from proceeding correctly but wouldn't be immediately obvious from the error message. Consider adding error context or verification that the repository was successfully added.

Suggested change
spack repo add var/spack/repos/spack-packages
if ! spack repo add var/spack/repos/spack-packages; then
echo "ERROR: Failed to add Spack repository 'var/spack/repos/spack-packages'." >&2
echo "Current Spack repositories:" >&2
spack repo list >&2 || true
exit 1
fi
# Verify that the repository was successfully registered
if ! spack repo list | grep -q 'var/spack/repos/spack-packages'; then
echo "ERROR: Spack repository 'var/spack/repos/spack-packages' does not appear in 'spack repo list' after adding." >&2
spack repo list >&2 || true
exit 1
fi

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants