-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code format, commit format, code spell checks (#17)
* .github/workflows: Added workflow for formatting and spell check. Signed-off-by: Ramya Subramanyam <[email protected]> * .github/workflows: Rename the build and release action. Signed-off-by: Ramya Subramanyam <[email protected]> * ./tools: Helper scripts for gihub actions. Signed-off-by: Ramya Subramanyam <[email protected]> * cores/psoc: Formatted source code. Signed-off-by: Ramya Subramanyam <[email protected]> * ./docs: Formatted python script. Signed-off-by: Ramya Subramanyam <[email protected]> * ./README.md: Added badges for all github actions running. Signed-off-by: Ramya Subramanyam <[email protected]> * ./README.md: Modify badges. Signed-off-by: Eder Julian <[email protected]> --------- Signed-off-by: Ramya Subramanyam <[email protected]> Signed-off-by: Eder Julian <[email protected]> Co-authored-by: Julian Eder <[email protected]>
- Loading branch information
1 parent
d78b2cb
commit 29c0b77
Showing
13 changed files
with
182 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Code format check | ||
|
||
on: [push, pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
code-formatting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- name: Install packages | ||
run: source tools/ci.sh && ci_c_code_formatting_setup | ||
- name: Make sure there are no local changes | ||
run: git restore . | ||
- name: Run code formatting | ||
run: source tools/ci.sh && ci_c_code_formatting_run | ||
- name: Check code formatting | ||
run: git diff --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Code spell check | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
codespell: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# codespell version should be kept in sync with .pre-commit-config.yml | ||
- run: pip install --user codespell==2.2.6 tomli | ||
- run: codespell | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Commit message check | ||
|
||
on: [push, pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '100' | ||
- uses: actions/setup-python@v5 | ||
- name: Check commit message formatting | ||
run: source tools/ci.sh && ci_commit_formatting_run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: PSoC-for-Arduino Release Automation | ||
name: Release Automation | ||
|
||
on: | ||
release: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
if which nproc > /dev/null; then | ||
MAKEOPTS="-j$(nproc)" | ||
else | ||
MAKEOPTS="-j$(sysctl -n hw.ncpu)" | ||
fi | ||
|
||
# Ensure known OPEN_MAX (NO_FILES) limit. | ||
ulimit -n 1024 | ||
|
||
######################################################################################## | ||
# c code formatting | ||
|
||
function ci_c_code_formatting_setup { | ||
sudo apt-get install black | ||
black --version | ||
sudo apt-get install uncrustify | ||
uncrustify --version | ||
} | ||
|
||
function ci_c_code_formatting_run { | ||
python tools/codeformat.py -v | ||
} | ||
|
||
######################################################################################## | ||
# commit formatting | ||
|
||
function ci_commit_formatting_run { | ||
git remote add upstream https://github.com/Infineon/arduino-core-psoc.git | ||
git fetch --depth=100 upstream main | ||
# If the common ancestor commit hasn't been found, fetch more. | ||
git merge-base upstream/main HEAD || git fetch --unshallow upstream main | ||
# For a PR, upstream/main..HEAD ends with a merge commit into main, exclude that one. | ||
python tools/verifygitlog.py -n5 -v --no-merges | ||
} | ||
|
Oops, something went wrong.