correct CODEOWNERS #11
Workflow file for this run
This file contains hidden or 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
| name: 00-Check-Code-Convention | |
| on: | |
| push: | |
| branches-ignore: | |
| - main | |
| - "tests/**" | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| - "release/**" | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to test' | |
| type: string | |
| default: 'dev' | |
| jobs: | |
| job1: | |
| name: Check coding convention | |
| runs-on: ubuntu-22.04 #uncrustify 0.64 can not be compiled on ubuntu-24.04 | |
| steps: | |
| - name: Trigger | |
| run: echo "Triggered by ${{github.event_name}} event" | |
| - name: Check Branch Input | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| if [ -z "${{ github.event.inputs.branch }}" ]; then | |
| echo "Branch input is required for manual trigger." | |
| exit 1 | |
| fi | |
| fi | |
| - name: Checkout | |
| uses: actions/[email protected] | |
| with: | |
| ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref }}" | |
| submodules: true | |
| fetch-depth: 0 | |
| ## an internal repo as a submodule is present therefore PAT is needed | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| - name: Log Current Branch and Commit | |
| run: | | |
| echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" | |
| echo "Current commit: $(git rev-parse HEAD)" | |
| - name: Install commit check tools | |
| run: | | |
| echo "Installing pre-commit ..." | |
| python3 -m pip install pre-commit | |
| echo "Installing uncrustify 0.64 from source code ..." | |
| sudo apt-get install --no-install-recommends -y\ | |
| binutils ca-certificates git cmake make \ | |
| gcc g++ binutils libc6-dev | |
| echo "Cloning Uncrustify repository..." | |
| git clone -b uncrustify-0.64 --single-branch https://github.com/uncrustify/uncrustify.git | |
| echo "Building and installing Uncrustify..." | |
| mkdir ./uncrustify/build && cd ./uncrustify/build | |
| cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=RelWithDebInfo ../ | |
| sudo make -j "$(nproc)" | |
| sudo make install | |
| echo "Uncrustify has been installed successfully!" | |
| cd ../../ | |
| sudo cp ./.github/coding-convention-tool/tools/uncrustify.cfg ./uncrustify/uncrustify.cfg | |
| echo "Install clang-tidy and cppcheck ..." | |
| sudo apt-get install clang-tidy cppcheck | |
| - name: Run test | |
| run: | | |
| pre-commit install | |
| pre-commit run --all-files 2>&1 | tee CodingConventionTool.txt | |
| - name: Upload Result | |
| if: always() | |
| uses: actions/[email protected] | |
| with: | |
| name: CodingConventionResult | |
| path: CodingConventionTool.txt | |
| retention-days: 90 | |
| - name: Check log file to set status of the job | |
| run: | | |
| keywords=("Failed") | |
| for keyword in "${keywords[@]}"; do | |
| if grep -q "$keyword" CodingConventionTool.txt; then | |
| echo "Keyword '$keyword' found in the file." | |
| exit 1 | |
| else | |
| echo "Keyword '$keyword' not found in the file." | |
| fi | |
| done |