File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed
Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ name : ANTLR Grammar Lint
2+
3+ on :
4+ push :
5+ paths :
6+ - ' **/*.g4'
7+ pull_request :
8+ paths :
9+ - ' **/*.g4'
10+ workflow_dispatch :
11+
12+ jobs :
13+ lint-grammars :
14+ runs-on : ubuntu-latest
15+
16+ strategy :
17+ matrix :
18+ include :
19+ - dialect : redshift
20+ path : redshift
21+
22+ steps :
23+ - name : Checkout code
24+ uses : actions/checkout@v4
25+
26+ - name : Set up Python
27+ uses : actions/setup-python@v5
28+ with :
29+ python-version : ' 3.x'
30+
31+ - name : Install antlr-v4-linter
32+ run : |
33+ pip install antlr4-python3-runtime
34+ pip install antlr-v4-linter
35+
36+ - name : Lint ${{ matrix.dialect }} grammar files
37+ run : |
38+ echo "Linting ANTLR grammar files for ${{ matrix.dialect }}"
39+
40+ # Find all .g4 files in the dialect directory
41+ find ${{ matrix.path }} -name "*.g4" -type f | while read -r file; do
42+ echo "Checking: $file"
43+ antlr-v4-linter "$file" || exit_code=$?
44+
45+ if [ "${exit_code:-0}" -ne 0 ]; then
46+ echo "::error file=$file::ANTLR grammar linting failed"
47+ exit 1
48+ fi
49+ done
50+
51+ echo "✅ All grammar files for ${{ matrix.dialect }} passed linting"
52+
53+ - name : Summary
54+ if : always()
55+ run : |
56+ echo "## ANTLR Grammar Lint Results" >> $GITHUB_STEP_SUMMARY
57+ echo "Dialect: **${{ matrix.dialect }}**" >> $GITHUB_STEP_SUMMARY
58+ echo "Path: \`${{ matrix.path }}\`" >> $GITHUB_STEP_SUMMARY
59+ echo "" >> $GITHUB_STEP_SUMMARY
60+
61+ echo "### Files checked:" >> $GITHUB_STEP_SUMMARY
62+ find ${{ matrix.path }} -name "*.g4" -type f | while read -r file; do
63+ echo "- \`$file\`" >> $GITHUB_STEP_SUMMARY
64+ done
You can’t perform that action at this time.
0 commit comments