Skip to content
Open

Ghci #11

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fcfe96c
new file
roiser Nov 22, 2025
455dde3
change branch
roiser Nov 22, 2025
20d96e9
pwd
roiser Nov 23, 2025
1584cc0
Enhance hello world step with directory listing
roiser Nov 23, 2025
b53c23b
update submodule
roiser Nov 26, 2025
c68e609
fix process
roiser Jan 8, 2026
4cdb1bc
move ci file
roiser Jan 9, 2026
226cbfb
add py.py
roiser Jan 12, 2026
f796dc4
gen one process
roiser Jan 12, 2026
feb6198
pwd
roiser Jan 12, 2026
f3c9a77
pwd
roiser Jan 12, 2026
cfd76e8
pwd
roiser Jan 12, 2026
6ea27c9
mg5
roiser Jan 12, 2026
09b8a6c
fetch submodules
roiser Jan 12, 2026
2cb439e
disable all processes, generate first process
roiser Jan 12, 2026
331443b
fix remote repo
roiser Jan 12, 2026
3ff119e
fix typo
roiser Jan 12, 2026
ddf8612
copy files over
roiser Jan 12, 2026
4f9b6e3
move to PAT
roiser Jan 12, 2026
79cf8f2
empty
roiser Jan 12, 2026
ca538eb
add pwd
roiser Jan 12, 2026
0dd24c7
add git status
roiser Jan 12, 2026
852cd2f
spell out repo
roiser Jan 12, 2026
430e800
fix repo name
roiser Jan 12, 2026
88c24ad
more debug
roiser Jan 12, 2026
e3b5131
go one level up
roiser Jan 12, 2026
1c1811a
move to new token
roiser Jan 12, 2026
5ac5288
remove persist credentials
roiser Jan 12, 2026
3f2e4ab
change pat name
roiser Jan 12, 2026
bf09b51
add ls
roiser Jan 12, 2026
acca24a
remove if, single line commit
roiser Jan 12, 2026
8dbc493
simplify ci
roiser Jan 12, 2026
90277fd
pat in local repo
roiser Jan 12, 2026
b98cb5f
fix clang format
roiser Jan 12, 2026
71abf00
fix commit to remote repo
roiser Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/mg5_codegen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Code Generator CI

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
generate-and-check:
runs-on: ubuntu-latest

steps:
- name: Checkout codegen repo
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Run code generator
run: |
if [ ! -e MG5aMC/mg5amcnlo/PLUGIN/CUDACPP_SA_OUTPUT ] ; then pushd MG5aMC/mg5amcnlo/PLUGIN/ && ln -s ../../../epochX/cudacpp/CODEGEN/PLUGIN/CUDACPP_SA_OUTPUT && popd ; fi
./MG5aMC/mg5amcnlo/bin/mg5_aMC test/processes/pp_ttx/output.mg5

- name: Check code format with clang-format
id: format-check
run: |
cd PROC_pp_ttx
# Find all generated C/C++ files (adjust pattern as needed)
find . -type f \( -name "*.cc" -o -name "*.h" \) > files.txt

# Run clang-format check
#if find . -name '*.cc' -o -name '*.h' | xargs -n1 clang-format -style=file -assume-filename={} {} | diff -u {} -; then
if clang-format --dry-run --Werror $(cat files.txt) 2>&1 | tee format-output.txt; then
echo "format_ok=true" >> $GITHUB_OUTPUT
echo "✅ Code is properly formatted"
else
echo "format_ok=false" >> $GITHUB_OUTPUT
echo "❌ Code needs formatting"

# Generate the diff for needed changes
clang-format -i $(cat files.txt)
git diff > format-changes.patch
fi

- name: Commit to target repository
# if: steps.format-check.outputs.format_ok == 'true'
env:
TARGET_REPO: roiser/madgraph4gpu-generated-processes
GH_TOKEN: ${{ secrets.MG4GPU_GEN_PAT }}
run: |
# Configure git
git config --global user.name "github-actions"
git config --global user.email "github-actions@users.noreply.github.com"

# Clone target repo
git clone https://x-access-token:${GH_TOKEN}@github.com/${TARGET_REPO}.git
cd madgraph4gpu-generated-processes

# Create branch based on PR number
BRANCH_NAME="codegen-pr-${{ github.event.pull_request.number }}"
git checkout -b ${BRANCH_NAME}

# Copy generated files (adjust paths as needed)
cp -r ${GITHUB_WORKSPACE}/PROC_pp_ttx .

# Commit and push
git add .
git commit -m "Code generated from PR #${{ github.event.pull_request.number }}" \
-m "Source PR: ${{ github.event.pull_request.html_url }}"

git push origin ${BRANCH_NAME}

echo "✅ Pushed to ${TARGET_REPO} on branch ${BRANCH_NAME}"

- name: Comment on PR with format issues
if: steps.format-check.outputs.format_ok == 'false'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const patch = fs.readFileSync('format-changes.patch', 'utf8');

const comment = `## ❌ Code Format Check Failed

The generated code does not conform to clang-format rules.

<details>
<summary>Required formatting changes</summary>

\`\`\`diff
${patch}
\`\`\`

</details>

Please update your code generator to produce properly formatted code.`;

github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});

- name: Fail if format check failed
if: steps.format-check.outputs.format_ok == 'false'
run: exit 1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.mod
*.pyc
*.so
py.py
build.*
.build.*

Expand Down
6 changes: 6 additions & 0 deletions test/processes/pp_ttx/launch.mg5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
launch PROC_pp_ttx
set vector_size 32
set nevents 25k
set sde_strategy 1
set gridpack True

2 changes: 2 additions & 0 deletions test/processes/pp_ttx/output.mg5
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
generate p p > t t~
output madevent_simd PROC_pp_ttx