Skip to content

Commit a5ca696

Browse files
committed
Updating the uncrustify bot to use the new formatting action. Idea is to just apply the patch the formatting action created.
1 parent 813f2f6 commit a5ca696

File tree

4 files changed

+33
-741
lines changed

4 files changed

+33
-741
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ jobs:
334334
runs-on: cbmc_ubuntu-latest_16-core
335335
steps:
336336
- name: Set up CBMC runner
337-
uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@main
337+
uses: FreeRTOS/CI-CD-Github-Actions/set_up_cbmc_runner@v2
338338
with:
339339
cbmc_version: "5.61.0"
340340

@@ -352,6 +352,6 @@ jobs:
352352
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
353353
354354
- name: Run CBMC
355-
uses: FreeRTOS/CI-CD-Github-Actions/run_cbmc@main
355+
uses: FreeRTOS/CI-CD-Github-Actions/run_cbmc@v2
356356
with:
357357
proofs_dir: test/cbmc/proofs

.github/workflows/uncrustify.yml

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,23 @@
1-
name: Uncrustify the source code
1+
name: Format Pull Request Files
22

33
on:
44
issue_comment:
55
types: [created]
66

7+
env:
8+
bashPass: \033[32;1mPASSED -
9+
bashInfo: \033[33;1mINFO -
10+
bashFail: \033[31;1mFAILED -
11+
bashEnd: \033[0m
12+
713
jobs:
8-
Uncrustify:
9-
name: Run_Uncrustify
10-
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/bot run uncrustify' }}
14+
Formatting:
15+
name: Run Formatting Check
16+
if: ${{ github.event.issue.pull_request }} &&
17+
( ( github.event.comment.body == '/bot run uncrustify' ) ||
18+
( github.event.comment.body == '/bot run formatting' ) )
1119
runs-on: ubuntu-20.04
1220
steps:
13-
- name: Dump GitHub context
14-
env:
15-
GITHUB_CONTEXT: ${{ toJson(github) }}
16-
run: echo "$GITHUB_CONTEXT"
17-
- name: Install Utils
18-
run: |
19-
sudo apt-get update && sudo apt-get --assume-yes install software-properties-common curl jq sed
20-
sudo add-apt-repository ppa:git-core/ppa
21-
sudo apt-get update && sudo apt-get --assume-yes install git
22-
git --version
23-
- name: get pullrequest url
24-
run: |
25-
echo ${{ github.event.issue.pull_request.url }}
26-
- name: get upstream repo
27-
id: upstreamrepo
28-
run: |
29-
echo "RemoteRepo=$(curl -H "Accept: application/vnd.github.sailor-v-preview+json" --url ${{ github.event.issue.pull_request.url }} | jq '.head.repo.full_name' | sed 's/\"//g')" >> $GITHUB_OUTPUT
30-
- name: get upstream branch
31-
id: upstreambranch
32-
run: |
33-
echo "branchname=$(curl -H "Accept: application/vnd.github.sailor-v-preview+json" --url ${{ github.event.issue.pull_request.url }} | jq '.head.ref' | sed 's/\"//g')" >> $GITHUB_OUTPUT
34-
- name: echo upstream repo:branch
35-
run: |
36-
echo ${{ steps.upstreamrepo.outputs.RemoteRepo }}:${{ steps.upstreambranch.outputs.branchname }}
37-
- name: Checkout upstream repo
38-
uses: actions/checkout@v3
39-
with:
40-
repository: ${{ steps.upstreamrepo.outputs.RemoteRepo }}
41-
ref: ${{ steps.upstreambranch.outputs.branchname }}
42-
- name: Install Uncrustify
43-
run: |
44-
: # Install Uncrustify
45-
echo "::group::Install Uncrustify"
46-
sudo apt-get update && sudo apt-get --assume-yes install uncrustify
47-
echo "::endgroup::"
48-
- name: Run Uncrustify
49-
run: |
50-
: # Uncrustify on C files while ignoring symlinks.
51-
: # Make a collapsible section in the log to run uncrustify
52-
echo "::group::Uncrustify Check"
53-
uncrustify --version
54-
find . -iname "*.[ch]" | xargs uncrustify --no-backup --replace --if-changed -c tools/uncrustify.cfg -l C
55-
echo "::endgroup::"
56-
echo -e "\033[32;3mUncrustify Formatting Applied\033[0m"
57-
- name: Push changes to upstream repository
58-
run: |
59-
: # Push changes to upstream repository
60-
echo "::group::Push changes to upstream repository"
61-
git config --global --add safe.directory '*'
62-
git config --global user.name 'GitHub Action'
63-
git config --global user.email '[email protected]'
64-
git add -A
65-
git commit -m "Uncrustify: triggered by comment."
66-
echo "::endgroup::"
67-
git push
68-
if [ "$?" = "0" ]; then
69-
echo -e "\033[32;3mPushed formatting changes, don't forget to run 'git pull'!\033[0m"
70-
exit 0
71-
else
72-
echo -e "\033[32;31mFailed to push the formatting changes\033[0m"
73-
exit 1
74-
fi
21+
- name: Apply Formatting Fix
22+
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@v2
23+
id: check-formatting

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# Ignore MacOS file system related.
2+
**/*.DS_Store*
3+
4+
# Ignore build results
5+
[Dd]ebug/
6+
[Dd]ebugPublic/
7+
[Dd]ebug_with_Libslirp/
8+
[Rr]elease/
9+
[Rr]eleases/
10+
[Bb]in/
11+
[Oo]bj/
12+
[Ll]og/
13+
[Ll]ogs/
14+
[Bb]uild/
15+
__pycache__/
16+
117
**/*.d
218
**/*.o
319
**/*.su

0 commit comments

Comments
 (0)