Skip to content

Commit e944b35

Browse files
committed
Add CI workflow for Spack package testing
- Create GitHub Actions workflow to validate Spack package - Includes lint/style check and spec concretization tests - Fixes spack repo create command with required namespace - Simplified to 2 basic tests for fast validation
1 parent eed3c12 commit e944b35

File tree

1 file changed

+12
-154
lines changed

1 file changed

+12
-154
lines changed

.github/workflows/spack.yml

Lines changed: 12 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ on:
1313

1414
jobs:
1515
lint:
16-
name: Spack Lint & Audit
16+
name: Spack Lint & Style Check
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout MFC
2020
uses: actions/checkout@v4
21-
with:
22-
path: mfc-source
2321

2422
- name: Setup Python
2523
uses: actions/setup-python@v5
@@ -39,20 +37,15 @@ jobs:
3937
- name: Create Spack Repository
4038
run: |
4139
. spack/share/spack/setup-env.sh
42-
spack repo create mfc-repo
40+
spack repo create mfc-repo mfc
4341
mkdir -p mfc-repo/packages/mfc
44-
cp mfc-source/packaging/spack/package.py mfc-repo/packages/mfc/
42+
cp packaging/spack/package.py mfc-repo/packages/mfc/
4543
spack repo add mfc-repo
4644
4745
- name: Run Spack Style Check
4846
run: |
4947
. spack/share/spack/setup-env.sh
50-
spack style --fix mfc-repo/packages/mfc/package.py
51-
# Check if style made any changes
52-
if ! git -C mfc-repo diff --quiet; then
53-
echo "::warning::Style issues found - run 'spack style --fix' on package.py"
54-
git -C mfc-repo diff
55-
fi
48+
spack style mfc-repo/packages/mfc/package.py
5649
5750
- name: Run Spack Audit
5851
run: |
@@ -64,25 +57,12 @@ jobs:
6457
. spack/share/spack/setup-env.sh
6558
spack info mfc
6659
67-
test-concretize:
68-
name: Test Concretization
60+
test-spec:
61+
name: Test Package Spec
6962
runs-on: ubuntu-latest
70-
strategy:
71-
matrix:
72-
spec:
73-
- 'mfc' # Default configuration
74-
- 'mfc~mpi' # No MPI
75-
- 'mfc~post_process' # No post-processing
76-
- 'mfc precision=single' # Single precision
77-
- 'mfc+mpi+post_process precision=double' # Full build
78-
- 'mfc %gcc@11' # Specific compiler
79-
fail-fast: false
80-
8163
steps:
8264
- name: Checkout MFC
8365
uses: actions/checkout@v4
84-
with:
85-
path: mfc-source
8666

8767
- name: Setup Python
8868
uses: actions/setup-python@v5
@@ -102,139 +82,17 @@ jobs:
10282
- name: Create Spack Repository
10383
run: |
10484
. spack/share/spack/setup-env.sh
105-
spack repo create mfc-repo
85+
spack repo create mfc-repo mfc
10686
mkdir -p mfc-repo/packages/mfc
107-
cp mfc-source/packaging/spack/package.py mfc-repo/packages/mfc/
87+
cp packaging/spack/package.py mfc-repo/packages/mfc/
10888
spack repo add mfc-repo
10989
110-
- name: Test Spec Concretization
90+
- name: Test Default Spec
11191
run: |
11292
. spack/share/spack/setup-env.sh
113-
spack spec ${{ matrix.spec }}
114-
115-
test-install:
116-
name: Test Installation
117-
runs-on: ubuntu-latest
118-
strategy:
119-
matrix:
120-
config:
121-
- spec: 'mfc~mpi~post_process'
122-
desc: 'Minimal build'
123-
- spec: 'mfc+mpi~post_process'
124-
desc: 'MPI without post-processing'
125-
fail-fast: false
126-
127-
steps:
128-
- name: Checkout MFC
129-
uses: actions/checkout@v4
130-
with:
131-
path: mfc-source
132-
133-
- name: Setup Python
134-
uses: actions/setup-python@v5
135-
with:
136-
python-version: '3.11'
137-
138-
- name: Install System Dependencies
139-
run: |
140-
sudo apt-get update
141-
sudo apt-get install -y \
142-
build-essential \
143-
gfortran \
144-
cmake \
145-
libopenmpi-dev \
146-
openmpi-bin
147-
148-
- name: Install Spack
149-
run: |
150-
git clone --depth=1 https://github.com/spack/spack.git
151-
echo "${GITHUB_WORKSPACE}/spack/bin" >> $GITHUB_PATH
152-
153-
- name: Setup Spack
154-
run: |
155-
. spack/share/spack/setup-env.sh
156-
spack compiler find
157-
# Use system packages to speed up build
158-
spack external find --not-buildable cmake
159-
spack external find python
160-
161-
- name: Create Spack Repository
162-
run: |
163-
. spack/share/spack/setup-env.sh
164-
spack repo create mfc-repo
165-
mkdir -p mfc-repo/packages/mfc
166-
cp mfc-source/packaging/spack/package.py mfc-repo/packages/mfc/
167-
spack repo add mfc-repo
168-
169-
- name: Install MFC (${{ matrix.config.desc }})
170-
run: |
171-
. spack/share/spack/setup-env.sh
172-
spack install --show-log-on-error ${{ matrix.config.spec }}
173-
timeout-minutes: 60
174-
175-
- name: Load and Test MFC
176-
run: |
177-
. spack/share/spack/setup-env.sh
178-
spack load mfc
179-
# Verify binaries are available
180-
which pre_process
181-
which simulation
182-
pre_process --help || true
183-
simulation --help || true
184-
185-
- name: Test Uninstall
186-
run: |
187-
. spack/share/spack/setup-env.sh
188-
spack uninstall -y mfc
189-
190-
test-conflicts:
191-
name: Test Conflict Detection
192-
runs-on: ubuntu-latest
193-
strategy:
194-
matrix:
195-
invalid-spec:
196-
- spec: 'mfc+openacc+openmp'
197-
reason: 'OpenACC and OpenMP are mutually exclusive'
198-
- spec: 'mfc+openacc %gcc'
199-
reason: 'OpenACC requires NVHPC or Cray compiler'
200-
fail-fast: false
201-
202-
steps:
203-
- name: Checkout MFC
204-
uses: actions/checkout@v4
205-
with:
206-
path: mfc-source
207-
208-
- name: Setup Python
209-
uses: actions/setup-python@v5
210-
with:
211-
python-version: '3.11'
212-
213-
- name: Install Spack
214-
run: |
215-
git clone --depth=1 https://github.com/spack/spack.git
216-
echo "${GITHUB_WORKSPACE}/spack/bin" >> $GITHUB_PATH
217-
218-
- name: Setup Spack
219-
run: |
220-
. spack/share/spack/setup-env.sh
221-
spack compiler find
222-
223-
- name: Create Spack Repository
224-
run: |
225-
. spack/share/spack/setup-env.sh
226-
spack repo create mfc-repo
227-
mkdir -p mfc-repo/packages/mfc
228-
cp mfc-source/packaging/spack/package.py mfc-repo/packages/mfc/
229-
spack repo add mfc-repo
93+
spack spec mfc
23094
231-
- name: Test Invalid Spec (${{ matrix.invalid-spec.reason }})
95+
- name: Test Minimal Spec
23296
run: |
23397
. spack/share/spack/setup-env.sh
234-
# This should fail
235-
if spack spec ${{ matrix.invalid-spec.spec }} 2>&1; then
236-
echo "::error::Expected spec to fail but it succeeded: ${{ matrix.invalid-spec.spec }}"
237-
exit 1
238-
else
239-
echo "✓ Correctly detected conflict: ${{ matrix.invalid-spec.reason }}"
240-
fi
98+
spack spec mfc~mpi~post_process

0 commit comments

Comments
 (0)