Skip to content

Commit c93d78f

Browse files
committed
Optimize Spack CI with binary cache and system packages
Performance improvements: - Add Spack binary cache mirror for pre-built dependencies - Mark system packages as external (cmake, python, perl, gcc) - Pre-install system libraries (openblas, fftw, hdf5) via apt - Use buildcache for dependencies to avoid source builds - Reduce timeout from 60 to 45 minutes Conditional execution: - Install test only runs on PRs or manual workflow_dispatch - Saves CI time on routine commits to packaging files - Lint and spec tests still run on every push
1 parent a2cfdb3 commit c93d78f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/spack.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ jobs:
112112
113113
test-install:
114114
name: Test Installation & Execution
115+
# Only run on pull requests or manual workflow dispatch to save CI time
116+
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
115117
runs-on: ubuntu-latest
116118
steps:
117119
- name: Checkout MFC
@@ -125,17 +127,23 @@ jobs:
125127
- name: Install System Dependencies
126128
run: |
127129
sudo apt-get update
128-
sudo apt-get install -y gfortran cmake
130+
sudo apt-get install -y gfortran cmake libopenblas-dev libfftw3-dev libhdf5-dev
129131
130132
- name: Install Spack
131133
run: |
132134
git clone --depth=1 https://github.com/spack/spack.git
133135
echo "${GITHUB_WORKSPACE}/spack/bin" >> $GITHUB_PATH
134136
135-
- name: Setup Spack
137+
- name: Setup Spack with Binary Cache
136138
run: |
137139
. spack/share/spack/setup-env.sh
138140
spack compiler find
141+
# Add binary cache mirror for pre-built packages
142+
spack mirror add binary_mirror https://binaries.spack.io/v0.23.1
143+
spack buildcache keys --install --trust
144+
# Mark system packages as external to avoid building
145+
spack external find --not-buildable cmake python perl gfortran gcc
146+
spack config add "packages:all:target:[x86_64]"
139147
140148
- name: Install Package into Spack
141149
run: |
@@ -152,9 +160,9 @@ jobs:
152160
- name: Install MFC via Spack
153161
run: |
154162
. spack/share/spack/setup-env.sh
155-
# Install minimal configuration to save time
156-
spack install --show-log-on-error mfc~mpi~post_process
157-
timeout-minutes: 60
163+
# Install minimal configuration, use binary cache when available
164+
spack install --show-log-on-error --use-buildcache package:auto,dependencies:only mfc~mpi~post_process
165+
timeout-minutes: 45
158166

159167
- name: Test MFC Execution
160168
run: |

0 commit comments

Comments
 (0)