Skip to content

Commit c74e5a0

Browse files
committed
Merge branch 'ci/amr-green' (lint green on dev: changed-files lint, dev trigger, codespell)
2 parents b5bad31 + 879e227 commit c74e5a0

3 files changed

Lines changed: 27 additions & 180 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: [main, cpp-sequential]
5+
branches: [main, dev]
66
pull_request:
77
workflow_dispatch:
88

@@ -22,18 +22,33 @@ jobs:
2222
timeout-minutes: 10
2323
steps:
2424
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # need history to diff against the base ref
2527
- uses: actions/setup-python@v5
2628
with:
2729
python-version: '3.12'
28-
cache: pip
29-
- name: Install clang-format / cmake-format
30-
run: |
31-
sudo apt-get update
32-
sudo apt-get install -y clang-format-17
33-
sudo ln -sf "$(command -v clang-format-17)" /usr/local/bin/clang-format
3430
- run: pip install pre-commit
35-
- name: pre-commit (all files)
36-
run: pre-commit run --all-files --show-diff-on-failure
31+
# clang-format / cmake-format come pinned from their pre-commit mirrors,
32+
# so no apt install is needed. Lint only the files this PR/push changed,
33+
# so the existing tree is not retroactively reformatted; new work must
34+
# still satisfy every hook.
35+
- name: pre-commit (changed files)
36+
run: |
37+
set -e
38+
if [ "${{ github.event_name }}" = "pull_request" ]; then
39+
git fetch --no-tags --depth=1 origin "${{ github.base_ref }}"
40+
FROM="origin/${{ github.base_ref }}"
41+
else
42+
FROM="${{ github.event.before }}"
43+
fi
44+
if [ -z "$FROM" ] || [ "$FROM" = "0000000000000000000000000000000000000000" ] \
45+
|| ! git cat-file -e "$FROM^{commit}" 2>/dev/null; then
46+
echo "No usable base ref — linting all files."
47+
pre-commit run --all-files --show-diff-on-failure
48+
else
49+
echo "Linting files changed in $FROM..HEAD"
50+
pre-commit run --from-ref "$FROM" --to-ref HEAD --show-diff-on-failure
51+
fi
3752
3853
# ----------------------------------------------------- CPU build + test ------
3954
cpu:

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ repos:
3232
rev: v2.3.0
3333
hooks:
3434
- id: codespell
35-
exclude: '\.(svg|sif|data|raw)$'
36-
args: ["--ignore-words-list=hist,nd,thirdparty"]
35+
# Skip binaries, notebooks, and the Portuguese implementation walkthrough.
36+
exclude: '(\.(svg|sif|data|raw|ipynb)$|WALKTHROUGH\.md$)'
37+
args: ["--ignore-words-list=hist,nd,thirdparty,sequencial"]
3738

3839
# Local hook — never commit perf.data, SVGs, or binaries from cuda/.
3940
# These are build artifacts; .gitignore is the primary defense, this is the backstop.

docs/CI_FUTURE.md

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)