Skip to content

ci: split workflow stages and add macOS arm64#131

Draft
zandivx wants to merge 3 commits into
mainfrom
improve-github-actions
Draft

ci: split workflow stages and add macOS arm64#131
zandivx wants to merge 3 commits into
mainfrom
improve-github-actions

Conversation

@zandivx

@zandivx zandivx commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

This should be revisited after #128 is merged as this simplifies the build process.

@zandivx zandivx requested a review from marjohma April 3, 2026 17:44
@zandivx zandivx self-assigned this Apr 3, 2026
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Split CI workflow into stages and add macOS arm64 support

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Split monolithic CI workflow into three separate jobs: pre-commit, build, and test
• Added macOS arm64 (macos-14) support with platform-specific dependency installation
• Implemented build artifact caching and upload/download for cross-job artifact sharing
• Replaced CMake commands with Makefile targets for simplified build and test execution
Diagram
flowchart LR
  A["Pre-commit<br/>ubuntu-latest"] --> B["Build<br/>ubuntu-latest &<br/>macos-14"]
  B --> C["Test<br/>ubuntu-latest &<br/>macos-14"]
  B -- "Upload artifacts" --> D["Artifact Storage"]
  D -- "Download artifacts" --> C
Loading

Grey Divider

File Changes

1. .github/workflows/ci.yml ⚙️ Configuration changes +155/-12

Refactor workflow into stages with macOS arm64 support

• Refactored single build-and-test job into three separate jobs: pre-commit, build, and test
• Added macOS arm64 (macos-14) platform support with matrix strategy for both build and test jobs
• Introduced platform-specific dependency installation for Ubuntu and macOS with conditional steps
• Replaced CMake configuration and build commands with make all and make test targets
• Added build artifact upload/download mechanism to share artifacts between build and test jobs
• Enhanced cache key to include runner.arch for better platform-specific caching
• Removed doxygen from Ubuntu dependencies list

.github/workflows/ci.yml


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Apr 3, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX Issues (0)

Grey Divider


Action required

1. CI missing doxygen dependency 🐞 Bug ≡ Correctness
Description
The workflow removed installation of doxygen, but CMake configuration unconditionally fails with a
fatal error when Doxygen is not present, so make all in the build job will fail and block the
entire pipeline. This also affects the new macOS arm64 job because Homebrew dependencies do not
include doxygen.
Code

.github/workflows/ci.yml[32]

-            doxygen \
Evidence
The CI workflow no longer installs Doxygen on Ubuntu and never installs it on macOS. The build uses
make all, which runs a CMake configure; the top-level project always adds the KiLCA subdirectory,
and KiLCA’s CMakeLists aborts configuration with FATAL_ERROR when Doxygen is missing—making CI
failure deterministic.

.github/workflows/ci.yml[56-103]
.github/workflows/ci.yml[172-194]
CMakeLists.txt[102-109]
KiLCA/CMakeLists.txt[309-319]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
CI no longer installs `doxygen`, but the CMake configure step fails with a fatal error when Doxygen is missing, causing `make all` (and thus CI) to fail.

## Issue Context
`KiLCA/CMakeLists.txt` calls `find_package(Doxygen)` and then `message(FATAL_ERROR ...)` when not found, and the root `CMakeLists.txt` always includes `add_subdirectory(KiLCA)`.

## Fix Focus Areas
- .github/workflows/ci.yml[56-103]
- .github/workflows/ci.yml[172-194]

### Suggested change
- Ubuntu: add `doxygen` back to the `apt-get install` package list.
- macOS: add `doxygen` to the `brew install` package list.

(Alternative long-term fix: change `KiLCA/CMakeLists.txt` to make Doxygen optional unless building the `doc` target.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. ci.yml 2-space indentation 📘 Rule violation ⚙ Maintainability
Description
The updated GitHub Actions workflow uses 2-space indentation (e.g., before pre-commit:), but the
project style requires 4-space indentation. This can create inconsistent formatting and violates the
repo’s indentation policy for modified files.
Code

.github/workflows/ci.yml[R10-12]

+  pre-commit:
+    name: Pre-commit
    runs-on: ubuntu-latest
Evidence
PR Compliance ID 3 requires 4-space indentation (no tabs). In .github/workflows/ci.yml, the added
job keys are indented with 2 spaces (e.g.,   pre-commit:), which does not meet the 4-space
indentation requirement.

AGENTS.md
.github/workflows/ci.yml[10-12]
AGENTS.md[138-146]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The GitHub Actions workflow `.github/workflows/ci.yml` uses 2-space indentation, but the repository policy requires 4-space indentation for modified files.

## Issue Context
The project coding-style documentation specifies `Indentation: 4 spaces (no tabs)` and the PR compliance checklist enforces this formatting rule.

## Fix Focus Areas
- .github/workflows/ci.yml[10-204]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: Pre-commit

Failed stage: Run pre-commit hooks [❌]

Failed test name: ""

Failure summary:

The action failed because pre-commit hooks reported errors and auto-formatting changes that were not
committed:
- check-executables-have-shebangs failed: python/susc_functions/f2py_Ifuncs.sh is marked
executable but has no (or an invalid) shebang (lines 212-218).
-
check-shebang-scripts-are-executable failed: KiLCA/flre/tensor/math2f90.pl has a shebang but is not
marked executable (lines 221-227).
- isort failed because it modified files that were not committed:
python/KIMpy/init.py and python/KIMpy/electromagnetic_solver.py (lines 236-240).
- black failed
due to formatting differences (and likely would modify files), as shown by diffs in
python/KIMpy/electromagnetic_solver.py and test/ql-balance/golden_record/ensure_golden.py (lines
241+).
These hook failures caused the job to exit with code 1 (line 401).

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

197:  [INFO] Initializing environment for https://github.com/pycqa/isort.
198:  [INFO] Initializing environment for https://github.com/psf/black-pre-commit-mirror.
199:  [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
200:  [INFO] Once installed this environment will be reused.
201:  [INFO] This may take a few minutes...
202:  [INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks.
203:  [INFO] Once installed this environment will be reused.
204:  [INFO] This may take a few minutes...
205:  [INFO] Installing environment for https://github.com/pycqa/isort.
206:  [INFO] Once installed this environment will be reused.
207:  [INFO] This may take a few minutes...
208:  [INFO] Installing environment for https://github.com/psf/black-pre-commit-mirror.
209:  [INFO] Once installed this environment will be reused.
210:  [INFO] This may take a few minutes...
211:  check for case conflicts.................................................Passed
212:  check that executables have shebangs.....................................Failed
213:  - hook id: check-executables-have-shebangs
214:  - exit code: 1
215:  python/susc_functions/f2py_Ifuncs.sh: marked executable but has no (or invalid) shebang!
216:  If it isn't supposed to be executable, try: `chmod -x python/susc_functions/f2py_Ifuncs.sh`
217:  If on Windows, you may also need to: `git add --chmod=-x python/susc_functions/f2py_Ifuncs.sh`
218:  If it is supposed to be executable, double-check its shebang.
219:  check illegal windows names..........................(no files to check)Skipped
220:  check for merge conflicts................................................Passed
221:  check that scripts with shebangs are executable..........................Failed
222:  - hook id: check-shebang-scripts-are-executable
223:  - exit code: 1
224:  KiLCA/flre/tensor/math2f90.pl: has a shebang but is not marked executable!
225:  If it is supposed to be executable, try: `chmod +x KiLCA/flre/tensor/math2f90.pl`
226:  If on Windows, you may also need to: `git add --chmod=+x KiLCA/flre/tensor/math2f90.pl`
227:  If it is not supposed to be executable, double-check its shebang is wanted.
228:  check for broken symlinks............................(no files to check)Skipped
229:  check toml...............................................................Passed
230:  check yaml...............................................................Passed
231:  detect private key.......................................................Passed
232:  fix end of files.........................................................Passed
233:  mixed line ending........................................................Passed
234:  trim trailing whitespace.................................................Passed
235:  Tabs remover.............................................................Passed
236:  isort....................................................................Failed
237:  - hook id: isort
238:  - files were modified by this hook
239:  Fixing /home/runner/work/KAMEL/KAMEL/python/KIMpy/__init__.py
240:  Fixing /home/runner/work/KAMEL/KAMEL/python/KIMpy/electromagnetic_solver.py
241:  black....................................................................Failed
242:  - hook id: black
...

293:  # B0 on xl grid from geometry (avoids HDF5 grid mismatch for backs/B0)
294:  -        self._b0_xl = np.abs(self.btor) * np.sqrt(1.0 + (self.xl / (self._q_xl * self.R0))**2)
295:  +        self._b0_xl = np.abs(self.btor) * np.sqrt(1.0 + (self.xl / (self._q_xl * self.R0)) ** 2)
296:  # Aligned potential for BCs
297:  self.phi_aligned = 1j * self._e0r_xl / (self._kp_xl * self._b0_xl)
298:  @@ -104,14 +104,10 @@ class KIMElectromagneticSolver:
299:  crossings = []
300:  for i in range(len(q_abs) - 1):
301:  if (q_abs[i] - q_res) * (q_abs[i + 1] - q_res) < 0:
302:  -                r_cross = r[i] + (q_res - q_abs[i]) * (r[i + 1] - r[i]) / (
303:  -                    q_abs[i + 1] - q_abs[i]
304:  -                )
305:  +                r_cross = r[i] + (q_res - q_abs[i]) * (r[i + 1] - r[i]) / (q_abs[i + 1] - q_abs[i])
306:  crossings.append(r_cross)
307:  if not crossings:
308:  -            raise ValueError(
309:  -                f"No resonant surface found for m={self.m_mode}, n={self.n_mode}"
310:  -            )
311:  +            raise ValueError(f"No resonant surface found for m={self.m_mode}, n={self.n_mode}")
312:  return crossings[-1]
...

386:  a_mat[:, 0] = 0.0
387:  a_mat[:, -1] = 0.0
388:  diff --git a/test/ql-balance/golden_record/ensure_golden.py b/test/ql-balance/golden_record/ensure_golden.py
389:  index 2a6f3b8..ed6469f 100755
390:  --- a/test/ql-balance/golden_record/ensure_golden.py
391:  +++ b/test/ql-balance/golden_record/ensure_golden.py
392:  @@ -108,9 +108,7 @@ def setup_runfolder() -> Path:
393:  shutil.rmtree(RUNFOLDER_DIR)
394:  RUNFOLDER_DIR.mkdir(parents=True)
395:  -    main_nml_template = str(
396:  -        MAIN_REF_DIR / "QL-Balance" / "namelists" / "balance_conf.nml"
397:  -    )
398:  +    main_nml_template = str(MAIN_REF_DIR / "QL-Balance" / "namelists" / "balance_conf.nml")
399:  setup_runfolder_external(str(RUNFOLDER_DIR), nml_template=main_nml_template)
400:  return RUNFOLDER_DIR
401:  ##[error]Process completed with exit code 1.
402:  Post job cleanup.

Comment thread .github/workflows/ci.yml
@zandivx zandivx force-pushed the improve-github-actions branch 2 times, most recently from c5dec28 to fc63995 Compare April 3, 2026 17:53
@zandivx zandivx marked this pull request as draft April 3, 2026 17:58
@zandivx zandivx force-pushed the improve-github-actions branch from fc63995 to 889f029 Compare April 3, 2026 18:14
@zandivx

zandivx commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

!build

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.

1 participant