Skip to content

Conversation

@wdconinc
Copy link
Contributor

This PR adds a GitHub Actions workflow to build the ci environment on macOS.

Features

  • Uses spack/setup-spack@v2.1.1 for Spack installation
  • Uses spack/github-actions-buildcache@v2 for build cache management
  • Matrix strategy testing both GCC and Clang compilers
  • Automatic buildcache push/pull for faster rebuilds
  • Uploads environment graph as artifact for inspection

Testing

The workflow will run automatically on this PR to validate the macOS build.

…s-buildcache

This workflow builds the ci environment on macOS using:
- spack/setup-spack@v2.1.1 for Spack installation
- spack/github-actions-buildcache@v2 for build cache management
- Matrix strategy for both gcc and clang compilers
- Automatic buildcache push/pull for faster rebuilds
Copilot AI review requested due to automatic review settings December 18, 2025 22:30
- name: Setup Spack
uses: spack/setup-spack@v2.1.1
with:
ref: develop
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot Use the same spack version (and spack-packages version) that is used in the container build in this repository.

with:
ref: develop
color: true
path: ${{ github.workspace }}/spack
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot Apply the same cherry-picks that are used in the container build in this repository.

Comment on lines 46 to 47
spack -e ci compiler find
spack -e ci external find --not-buildable cmake
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot Use the same compiler and external package finding strategy as used in the container build in this repository.

Comment on lines 53 to 57
- name: Setup buildcache access
uses: spack/github-actions-buildcache@v2
with:
mode: readwrite
key: macos-${{ matrix.compiler }}-ci
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot Use the same buildcache as used in the container build in this repository.

Comment on lines 68 to 79
- name: Show environment info
if: always()
run: |
spack -e ci find -lv
spack -e ci graph --dot > ci-graph.dot

- name: Upload environment graph
if: always()
uses: actions/upload-artifact@v4
with:
name: ci-environment-graph-${{ matrix.compiler }}
path: ci-graph.dot
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot Ditch the environment graph.

Copy link
Contributor

Copilot AI commented Dec 18, 2025

@wdconinc I've opened a new pull request, #96, to work on those changes. Once the pull request is ready, I'll request review from you.

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 introduces a GitHub Actions workflow to build and test the ci Spack environment on macOS platforms, expanding CI coverage beyond the existing Linux-based workflows.

Key Changes:

  • Adds macOS CI workflow with GCC and Clang compiler matrix testing
  • Integrates Spack buildcache management for faster rebuilds
  • Includes environment graph artifact generation for inspection

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

uses: actions/checkout@v4
with:
submodules: recursive

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

There is trailing whitespace at the end of this line. This should be removed to maintain consistent formatting.

Suggested change

Copilot uses AI. Check for mistakes.
ref: develop
color: true
path: ${{ github.workspace }}/spack

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

There is trailing whitespace at the end of this line. This should be removed to maintain consistent formatting.

Suggested change

Copilot uses AI. Check for mistakes.
spack env activate ci
spack -e ci compiler find
spack -e ci external find --not-buildable cmake

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

There is trailing whitespace at the end of this line. This should be removed to maintain consistent formatting.

Suggested change

Copilot uses AI. Check for mistakes.
with:
mode: readwrite
key: macos-${{ matrix.compiler }}-ci

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

There is trailing whitespace at the end of this line. This should be removed to maintain consistent formatting.

Suggested change

Copilot uses AI. Check for mistakes.
- name: Add Spack environment
run: |
spack env create ci spack-environment/ci
spack env activate ci
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The workflow activates the Spack environment with "spack env activate ci" but doesn't persist the activation for subsequent steps. Each "run" step in GitHub Actions starts a new shell session. The activation command needs to be repeated in each step that uses the environment, or use "spack -e ci" consistently as done in later steps.

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 --not-buildable cmake
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Using --not-buildable with external find for cmake means that if cmake is not found externally, the build will fail. Consider whether this is intentional or if cmake should be allowed to be built by Spack as a fallback.

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

Copilot uses AI. Check for mistakes.
- name: Push to buildcache
if: always()
run: |
spack -e ci buildcache push --update-index --only=package --unsigned ${{ github.workspace }}/buildcache-macos
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The buildcache push command references a local directory path using github.workspace, but the github-actions-buildcache action at line 54 is configured with mode: readwrite and a key, which suggests it uses GitHub's cache. The push command should reference the buildcache location configured by the action, or the workflow should be updated to ensure consistency between the buildcache setup and push operations.

Suggested change
spack -e ci buildcache push --update-index --only=package --unsigned ${{ github.workspace }}/buildcache-macos
spack -e ci buildcache push --update-index --only=package --unsigned

Copilot uses AI. Check for mistakes.
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The compiler matrix variable is defined but never used in the workflow. The Spack compiler configuration relies on "spack -e ci compiler find" which will auto-detect available compilers. To properly test with different compilers as intended by the matrix strategy, the workflow should specify which compiler to use, likely through Spack's spec syntax or compiler configuration.

Copilot uses AI. Check for mistakes.

jobs:
build:
runs-on: macos-latest
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The workflow specifies "macos-latest" but doesn't consider that different macOS versions may have different default compilers and system libraries. For a more robust CI setup, consider pinning to specific macOS versions (e.g., macos-13, macos-14) or documenting which version is expected, especially since the compiler matrix suggests compiler-specific testing.

Suggested change
runs-on: macos-latest
runs-on: macos-13

Copilot uses AI. Check for mistakes.
fail-fast: false
matrix:
compiler: [gcc, clang]

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

There is trailing whitespace at the end of this line. This should be removed to maintain consistent formatting.

Suggested change

Copilot uses AI. Check for mistakes.
…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>
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