Skip to content

Commit 804655b

Browse files
committed
feat: CICD check for generated code
Closes #120
1 parent 0167820 commit 804655b

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// "forwardPorts": [],
1515

1616
// Use 'postCreateCommand' to run commands after the container is created.
17-
"postCreateCommand": "uv venv --clear && uv sync --extra test",
17+
"postCreateCommand": "uv venv --clear && uv sync --extra test --extra gen_proto",
1818

1919
// Configure tool-specific properties.
2020
"customizations": {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Code Generation Check
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
codegen-check:
11+
name: Verify Code Generation
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v5
16+
with:
17+
submodules: recursive
18+
19+
- name: Run code generation in devcontainer
20+
uses: devcontainers/[email protected]
21+
with:
22+
runCmd: |
23+
# Ensure dependencies are installed
24+
uv sync --extra test --extra gen_proto
25+
# Run all code generation steps
26+
make antlr
27+
./gen_proto.sh
28+
make codegen-extensions
29+
30+
- name: Check for uncommitted changes (ignoring timestamps)
31+
run: |
32+
# Check for diffs, ignoring timestamp lines
33+
if ! git diff -I '#.*timestamp:.*' --quiet --exit-code src/substrait/gen/; then
34+
echo "Code generation produced changes. Generated code is out of sync!"
35+
echo ""
36+
git diff -I '#.*timestamp:.*' src/substrait/gen/
37+
echo ""
38+
echo "To fix this, run:"
39+
echo " make antlr"
40+
echo " ./gen_proto.sh"
41+
echo " make codegen-extensions"
42+
echo "Then commit the changes."
43+
exit 1
44+
fi

0 commit comments

Comments
 (0)