Skip to content

Commit 5b04060

Browse files
committed
workflows: add check for generated AT Parser
Adds check for generated AT Parser lexer to determine if it's up to date according to the regex source. Signed-off-by: Mirko Covizzi <mirko.covizzi@nordicsemi.no>
1 parent 6fb156d commit 5b04060

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Check Generated AT Parser
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'lib/at_parser/at_match.re'
7+
8+
jobs:
9+
check-generated-at-parser:
10+
runs-on: ubuntu-latest
11+
name: Check Generated AT Parser
12+
steps:
13+
- name: Update PATH for west
14+
run: |
15+
echo "$HOME/.local/bin" >> $GITHUB_PATH
16+
17+
- name: Checkout sources
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event.pull_request.head.sha }}
21+
path: ncs/nrf
22+
fetch-depth: 0
23+
persist-credentials: false
24+
25+
- name: Install dependencies
26+
run: |
27+
sudo apt-get install re2c=3.0-1
28+
29+
- name: Generate lexer
30+
working-directory: ncs/nrf/lib/at_parser
31+
run: |
32+
re2c at_match.re -o at_match.c -W --tags --no-debug-info --no-generation-date --no-version
33+
34+
- name: Compare lexers
35+
working-directory: ncs/nrf/lib/at_parser
36+
run: |
37+
if diff -q at_match.c generated/at_match.c > /dev/null; then
38+
echo "Lexer is up to date."
39+
else
40+
echo "Lexer is not up to date. Please re-generate the lexer and update the PR."
41+
exit 1
42+
fi

0 commit comments

Comments
 (0)