Skip to content

Test for Ubuntu and Ubuntu version #2485

Test for Ubuntu and Ubuntu version

Test for Ubuntu and Ubuntu version #2485

name: Coding Style Check
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '**.cpp'
- '**.h'
- '**.mm'
- '**.sh'
- '**.py'
pull_request:
branches: [ main ]
paths:
- '**.cpp'
- '**.h'
- '**.mm'
- '**.sh'
- '**.py'
permissions:
contents: read
jobs:
check-c-like-style:
name: Verify C-like coding style
# As this action runs with minimal permissions and does not influence the build output,
# we perform no version pinning for the runner or the installed tools here.
# The clangFormatVersion is based on Ubuntu current LTS (jammy at time of writing).
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check .cpp/.h/.mm with clang-format
uses: DoozyX/clang-format-lint-action@a83a8fb7d371f66da7dd1c4f33a193023899494b
with:
clangFormatVersion: 14
# When updating the extension list, remember to update
# Jamulus.pro's CLANG_SOURCES as well and the paths: in 'on:' list above.
extensions: 'cpp,h,mm'
check-bash-style:
name: Verify shell script (Bash) coding style
runs-on: ubuntu-latest
# shellcheck is already pre-installed on ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check .sh with shellcheck
run: find -name '*.sh' -not -path './libs/*' -exec shellcheck --shell=bash {} +
- name: Install shfmt
run: sudo snap install shfmt
- name: Check .sh with shfmt
run: shfmt -d .
check-python-style:
name: Verify Python coding style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install pylint
run: pip install --user "pylint < 3.0"
- name: Check Python files with pylint
run: find ./tools -name '*.py' -print -exec pylint {} +